Ejemplo n.º 1
0
 def _new(cls, *args, **kwargs):
     rows, cols, flat_list = MatrixBase._handle_creation_inputs(*args, **kwargs)
     self = object.__new__(cls)
     self.rows = rows
     self.cols = cols
     self._mat = list(flat_list) # create a shallow copy
     return self
Ejemplo n.º 2
0
 def _new(cls, *args, **kwargs):
     if len(args) == 1 and isinstance(args[0], ImmutableMatrix):
         return args[0]
     rows, cols, flat_list = MatrixBase._handle_creation_inputs(
         *args, **kwargs)
     rows = Integer(rows)
     cols = Integer(cols)
     mat = Tuple(*flat_list)
     return Basic.__new__(cls, rows, cols, mat)
Ejemplo n.º 3
0
 def _new(cls, *args, **kwargs):
     if len(args) == 1 and isinstance(args[0], ImmutableMatrix):
         return args[0]
     rows, cols, flat_list = MatrixBase._handle_creation_inputs(
         *args, **kwargs)
     rows = Integer(rows)
     cols = Integer(cols)
     mat = Tuple(*flat_list)
     return Basic.__new__(cls, rows, cols, mat)
Ejemplo n.º 4
0
 def __pow__(self, other):
     return MatrixBase.__pow__(self, other)
Ejemplo n.º 5
0
 def __truediv__(self, other):
     return MatrixBase.__truediv__(self, _force_mutable(other))
Ejemplo n.º 6
0
 def __rmul__(self, other):
     return MatrixBase.__rmul__(self, _force_mutable(other))
Ejemplo n.º 7
0
 def __pow__(self, other):
     return MatrixBase.__pow__(self, other)
Ejemplo n.º 8
0
 def __truediv__(self, other):
     return MatrixBase.__truediv__(self, _force_mutable(other))
Ejemplo n.º 9
0
 def __rmul__(self, other):
     return MatrixBase.__rmul__(self, _force_mutable(other))
Ejemplo n.º 10
0
def numpy_to_sympy(m, **options):
    """Convert a numpy matrix to a SymPy matrix."""
    return MatrixBase(m)
Ejemplo n.º 11
0
def scipy_sparse_to_sympy(m, **options):
    """Convert a scipy.sparse matrix to a SymPy matrix."""
    return MatrixBase(m.todense())