@@ -1730,32 +1730,6 @@ cdef class DenseMatrix(MatrixBase):
1730
1730
else :
1731
1731
raise NotImplementedError
1732
1732
1733
- def row_join (self , rhs ):
1734
- cdef DenseMatrix o = _sympify(rhs)
1735
- if self .rows != o.rows:
1736
- raise ShapeError(" `self` and `rhs` must have the same number of rows." )
1737
- cdef DenseMatrix result = zeros(self .rows, self .cols + o.cols)
1738
- for i in range (self .rows):
1739
- for j in range (self .cols):
1740
- result[i, j] = self [i, j]
1741
- for i in range (o.rows):
1742
- for j in range (o.cols):
1743
- result[i, j + self .cols] = o[i, j]
1744
- return result
1745
-
1746
- def col_join (self , bott ):
1747
- cdef DenseMatrix o = _sympify(bott)
1748
- if self .cols != o.cols:
1749
- raise ShapeError(" `self` and `rhs` must have the same number of columns." )
1750
- cdef DenseMatrix result = zeros(self .rows + o.rows, self .cols)
1751
- for i in range (self .rows):
1752
- for j in range (self .cols):
1753
- result[i, j] = self [i, j]
1754
- for i in range (o.rows):
1755
- for j in range (o.cols):
1756
- result[i + self .rows, j] = o[i, j]
1757
- return result
1758
-
1759
1733
@property
1760
1734
def rows (self ):
1761
1735
return self .nrows()
@@ -2080,6 +2054,94 @@ class DenseMatrixIter(object):
2080
2054
2081
2055
Matrix = DenseMatrix
2082
2056
2057
+ cdef class MutableDenseMatrix(DenseMatrix):
2058
+
2059
+ def __cinit__ (self , row = None , col = None , v = None ):
2060
+ super (MutableDenseMatrix, self ).__cinit__(self , row, col, v)
2061
+
2062
+ def as_mutable (self ):
2063
+ return self .copy()
2064
+
2065
+ def row_join (self , rhs ):
2066
+ cdef DenseMatrix o = _sympify(rhs)
2067
+ if self .rows != o.rows:
2068
+ raise ShapeError(" `self` and `rhs` must have the same number of rows." )
2069
+ cdef DenseMatrix result = zeros(self .rows, self .cols + o.cols)
2070
+ for i in range (self .rows):
2071
+ for j in range (self .cols):
2072
+ result[i, j] = self [i, j]
2073
+ for i in range (o.rows):
2074
+ for j in range (o.cols):
2075
+ result[i, j + self .cols] = o[i, j]
2076
+ return result
2077
+
2078
+ def col_join (self , bott ):
2079
+ cdef DenseMatrix o = _sympify(bott)
2080
+ if self .cols != o.cols:
2081
+ raise ShapeError(" `self` and `rhs` must have the same number of columns." )
2082
+ cdef DenseMatrix result = zeros(self .rows + o.rows, self .cols)
2083
+ for i in range (self .rows):
2084
+ for j in range (self .cols):
2085
+ result[i, j] = self [i, j]
2086
+ for i in range (o.rows):
2087
+ for j in range (o.cols):
2088
+ result[i + self .rows, j] = o[i, j]
2089
+ return result
2090
+
2091
+ def col_del (self , i ):
2092
+ raise NotImplementedError
2093
+
2094
+ def col_op (self , j , f ):
2095
+ raise NotImplementedError
2096
+
2097
+ def col_swap (self , i , j ):
2098
+ for k in range (0 , self .rows):
2099
+ self [k, i], self [k, j] = self [k, j], self [k, i]
2100
+
2101
+ def copyin_list (self , key , value ):
2102
+ raise NotImplementedError
2103
+
2104
+ def copyin_matrix (self , key , value ):
2105
+ raise NotImplementedError
2106
+
2107
+ def fill (self , value ):
2108
+ raise NotImplementedError
2109
+
2110
+ def row_del (self , i ):
2111
+ raise NotImplementedError
2112
+
2113
+ def row_op (self , i , f ):
2114
+ raise NotImplementedError
2115
+
2116
+ def row_swap (self , i , j ):
2117
+ for k in range (0 , self .cols):
2118
+ self [i, k], self [j, k] = self [j, k], self [i, k]
2119
+
2120
+ def simplify (self , *args ):
2121
+ raise NotImplementedError
2122
+
2123
+ def zip_row_op (self , i , k , f ):
2124
+ raise NotImplementedError
2125
+
2126
+
2127
+ cdef class ImmutableDenseMatrix(DenseMatrix):
2128
+
2129
+ def __cinit__ (self , row = None , col = None , v = None ):
2130
+ super (ImmutableDenseMatrix, self ).__cinit__(self , row, col, v)
2131
+
2132
+ def _entry (self , i , j ):
2133
+ return DenseMatrix.__getitem__ (self , (i, j))
2134
+
2135
+ def __setitem__ (self , key , value ):
2136
+ raise TypeError (" Cannot set values of {}" .format(self .__class__))
2137
+
2138
+ def set (self , i , j , e ):
2139
+ raise TypeError (" Cannot set values of {}" .format(self .__class__))
2140
+
2141
+ def _set (self , i , j , e ):
2142
+ raise TypeError (" Cannot set values of {}" .format(self .__class__))
2143
+
2144
+
2083
2145
cdef matrix_to_vec(DenseMatrix d, symengine.vec_basic& v):
2084
2146
cdef Basic e_
2085
2147
for i in range (d.nrows()):
0 commit comments