示例#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
示例#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)
示例#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)
示例#4
0
文件: dense.py 项目: FireJade/sympy
 def __pow__(self, other):
     return MatrixBase.__pow__(self, other)
示例#5
0
文件: dense.py 项目: FireJade/sympy
 def __truediv__(self, other):
     return MatrixBase.__truediv__(self, _force_mutable(other))
示例#6
0
文件: dense.py 项目: FireJade/sympy
 def __rmul__(self, other):
     return MatrixBase.__rmul__(self, _force_mutable(other))
示例#7
0
文件: dense.py 项目: nthorne/sympy
 def __pow__(self, other):
     return MatrixBase.__pow__(self, other)
示例#8
0
文件: dense.py 项目: nthorne/sympy
 def __truediv__(self, other):
     return MatrixBase.__truediv__(self, _force_mutable(other))
示例#9
0
文件: dense.py 项目: nthorne/sympy
 def __rmul__(self, other):
     return MatrixBase.__rmul__(self, _force_mutable(other))
示例#10
0
def numpy_to_sympy(m, **options):
    """Convert a numpy matrix to a SymPy matrix."""
    return MatrixBase(m)
示例#11
0
def scipy_sparse_to_sympy(m, **options):
    """Convert a scipy.sparse matrix to a SymPy matrix."""
    return MatrixBase(m.todense())