コード例 #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
ファイル: immutable.py プロジェクト: bladewang/sympy
 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
ファイル: matrixutils.py プロジェクト: sidhu1012/sympy
def numpy_to_sympy(m, **options):
    """Convert a numpy matrix to a SymPy matrix."""
    return MatrixBase(m)
コード例 #11
0
ファイル: matrixutils.py プロジェクト: sidhu1012/sympy
def scipy_sparse_to_sympy(m, **options):
    """Convert a scipy.sparse matrix to a SymPy matrix."""
    return MatrixBase(m.todense())