def formatted_string(self, **kwargs): if 'name' not in kwargs and self.name is not None: kwargs.update(name=self.name) if len(self.shape) == 1: raise NotImplementedError elif len(self.shape) == 2: fmt = MatrixFormatter(**kwargs) else: fmt =TensorFormatter(**kwargs) return fmt.format(self)
def formatted_string(self, **kwargs): if 'name' not in kwargs and self.name is not None: kwargs.update(name=self.name) if len(self.shape) == 1: raise NotImplementedError elif len(self.shape) == 2: fmt = MatrixFormatter(**kwargs) else: fmt = TensorFormatter(**kwargs) return fmt.format(self)
def formatted_string(self, **kwargs): if len(self.shape) == 1: raise NotImplementedError elif len(self.shape) == 2: fmt = MatrixFormatter(**kwargs) else: fmt =TensorFormatter(**kwargs) if self.first_dimension_different: first_lbls = [coord.name for coord in self.representation] other_lbls = [coord.name for coord in self.secondary_representation] lbls = [first_lbls] + [other_lbls] * (len(self.shape) - 1) else: lbls = [coord.name for coord in self.representation] return fmt.format(self, labels=lbls)
def formatted_string(self, **kwargs): if len(self.shape) == 1: raise NotImplementedError elif len(self.shape) == 2: fmt = MatrixFormatter(**kwargs) else: fmt = TensorFormatter(**kwargs) if self.first_dimension_different: first_lbls = [coord.name for coord in self.representation] other_lbls = [ coord.name for coord in self.secondary_representation ] lbls = [first_lbls] + [other_lbls] * (len(self.shape) - 1) else: lbls = [coord.name for coord in self.representation] return fmt.format(self, labels=lbls)