Changeset 3271:d86a714eab75 for sage/matrix/matrix_rational_sparse.pyx
- Timestamp:
- 03/03/07 23:06:15 (6 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/matrix/matrix_rational_sparse.pyx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/matrix/matrix_rational_sparse.pyx
r3114 r3271 38 38 ######################################################################## 39 39 def __new__(self, parent, entries, copy, coerce): 40 # set the parent, nrows, ncols, etc. 41 matrix_sparse.Matrix_sparse.__init__(self, parent) 42 40 43 self._matrix = <mpq_vector*> sage_malloc(parent.nrows()*sizeof(mpq_vector)) 41 44 if self._matrix == NULL: 42 45 raise MemoryError, "error allocating sparse matrix" 46 # initialize the rows 47 for i from 0 <= i < parent.nrows(): 48 init_mpq_vector(&self._matrix[i], self._ncols, 0) 49 50 # record that rows have been initialized 51 self._initialized = True 52 43 53 44 54 def __dealloc__(self): … … 66 76 cdef Rational z 67 77 cdef void** X 68 69 # set the parent, nrows, ncols, etc.70 matrix_sparse.Matrix_sparse.__init__(self, parent)71 72 # initialize the rows73 for i from 0 <= i < parent.nrows():74 init_mpq_vector(&self._matrix[i], self._ncols, 0)75 76 # record that rows have been initialized77 self._initialized = True78 78 79 79 # fill in entries in the dict case
Note: See TracChangeset
for help on using the changeset viewer.
