Ticket #4983: trac_4983-subdivisions-rebased.patch

File trac_4983-subdivisions-rebased.patch, 26.2 KB (added by jhpalmieri, 9 years ago)
  • sage/matrix/action.pyx

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1300902580 25200
    # Node ID 5a7a763bf77bb0d2812762909bc39cc202f919b1
    # Parent  91687375f0759dfda9bd416b25c97a2c3dc37a37
    #4983: change subdivisions to _subdivisions
    
    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/action.pyx
    a b cdef class MatrixMatrixAction(MatrixMulA 
    145145            else:
    146146                A = A.dense_matrix()
    147147        prod = A._matrix_times_matrix_(B)
    148         if A.subdivisions is not None or B.subdivisions is not None:
    149             Asubs = A.get_subdivisions()
    150             Bsubs = B.get_subdivisions()
     148        if A._subdivisions is not None or B._subdivisions is not None:
     149            Asubs = A.subdivisions()
     150            Bsubs = B.subdivisions()
    151151            if Asubs[1] == Bsubs[0]:
    152152                prod.subdivide(Asubs[0], Bsubs[1])
    153153        return prod
  • sage/matrix/matrix0.pxd

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix0.pxd
    a b cimport sage.structure.mutability 
    1616cdef class Matrix(sage.structure.element.Matrix):
    1717    # Properties of any matrix  (plus _parent, inherited from base class)
    1818    cdef public object _cache
    19     cdef public object subdivisions
     19    cdef public object _subdivisions
    2020    cdef public object _base_ring
    2121    cdef sage.structure.mutability.Mutability _mutability
    2222
  • sage/matrix/matrix0.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix0.pyx
    a b cdef class Matrix(sage.structure.element 
    15181518        except (AttributeError, NotImplementedError):
    15191519            M = sage.matrix.matrix_space.MatrixSpace(ring, self._nrows, self._ncols, sparse=self.is_sparse())
    15201520            mat = M(self.list(), coerce=True, copy=False)
    1521             mat.subdivide(self.get_subdivisions())
     1521            mat.subdivide(self.subdivisions())
    15221522            return mat
    15231523
    15241524    def _test_change_ring(self, **options):
    cdef class Matrix(sage.structure.element 
    16731673        if nr == 0 or nc == 0:
    16741674            return "[]"
    16751675
    1676         row_divs, col_divs = self.get_subdivisions()
     1676        row_divs, col_divs = self.subdivisions()
    16771677
    16781678        # Set the mapping based on keyword arguments
    16791679        if rep_mapping is None:
    cdef class Matrix(sage.structure.element 
    18331833        S = self.list()
    18341834        rows = []
    18351835       
    1836         row_divs, col_divs = self.get_subdivisions()
     1836        row_divs, col_divs = self.subdivisions()
    18371837       
    18381838        from sage.server.support import EMBEDDED_MODE
    18391839
  • sage/matrix/matrix1.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix1.pyx
    a b cdef class Matrix(matrix0.Matrix): 
    10161016            will be discarded, since it would be ambiguous how to interpret
    10171017            them.  If the subdivision behavior is not what you need,
    10181018            you can manage subdivisions yourself with methods like
    1019             :meth:`~sage.matrix.matrix2.Matrix.get_subdivisions`
     1019            :meth:`~sage.matrix.matrix2.Matrix.subdivisions`
    10201020            and
    10211021            :meth:`~sage.matrix.matrix2.Matrix.subdivide`.
    10221022            You might also find :func:`~sage.matrix.constructor.block_matrix`
    cdef class Matrix(matrix0.Matrix): 
    17241724
    17251725            sage: a = matrix(ZZ, 3, range(9))
    17261726            sage: a.subdivide([1,2],2)
    1727             sage: a.get_subdivisions()
     1727            sage: a.subdivisions()
    17281728            ([1, 2], [2])
    17291729            sage: b = a.sparse_matrix().dense_matrix()
    1730             sage: b.get_subdivisions()
     1730            sage: b.subdivisions()
    17311731            ([1, 2], [2])
    17321732        """
    17331733        if self.is_dense():
    cdef class Matrix(matrix0.Matrix): 
    17371737                               copy = False, sparse=False)
    17381738        for i,j in self.nonzero_positions():
    17391739            A.set_unsafe(i,j,self.get_unsafe(i,j))
    1740         A.subdivide(self.get_subdivisions())
     1740        A.subdivide(self.subdivisions())
    17411741        return A
    17421742
    17431743    def sparse_matrix(self):
    cdef class Matrix(matrix0.Matrix): 
    17821782            return self
    17831783        A = self.new_matrix(self._nrows, self._ncols, entries = self.dict(), coerce=False,
    17841784                               copy = False, sparse=True)
    1785         A.subdivide(self.get_subdivisions())
     1785        A.subdivide(self.subdivisions())
    17861786        return A
    17871787
    17881788    def matrix_space(self, nrows=None, ncols=None, sparse=None):
  • sage/matrix/matrix2.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix2.pyx
    a b cdef class Matrix(matrix1.Matrix): 
    50425042            [73 79 83]
    50435043            sage: M.subdivision_entry(1,0,0,0)
    50445044            31
    5045             sage: M.get_subdivisions()
     5045            sage: M.subdivisions()
    50465046            ([2], [3])
    50475047            sage: M.subdivide(None, [1,3]); M
    50485048            [ 2| 3  5| 7 11]
    cdef class Matrix(matrix1.Matrix): 
    51015101            col_lines = [col_lines]
    51025102        row_lines = [0] + [int(ZZ(x)) for x in row_lines] + [self._nrows]
    51035103        col_lines = [0] + [int(ZZ(x)) for x in col_lines] + [self._ncols]
    5104         if self.subdivisions is not None:
     5104        if self._subdivisions is not None:
    51055105            self.clear_cache()
    5106         self.subdivisions = (row_lines, col_lines)
     5106        self._subdivisions = (row_lines, col_lines)
    51075107       
    51085108    def subdivision(self, i, j):
    51095109        """
    5110         Returns in immutable copy of the (i,j)th submatrix of self,
     5110        Returns an immutable copy of the (i,j)th submatrix of self,
    51115111        according to a previously set subdivision.
    51125112       
    51135113        Before a subdivision is set, the only valid arguments are (0,0)
    cdef class Matrix(matrix1.Matrix): 
    51525152            sage: M.subdivision(0,1)
    51535153            []
    51545154        """
    5155         if self.subdivisions is None:
    5156             self.subdivisions = ([0, self._nrows], [0, self._ncols])
     5155        if self._subdivisions is None:
     5156            self._subdivisions = ([0, self._nrows], [0, self._ncols])
    51575157        key = "subdivision %s %s"%(i,j)
    51585158        sd = self.fetch(key)
    51595159        if sd is None:
    5160             sd = self[self.subdivisions[0][i]:self.subdivisions[0][i+1], self.subdivisions[1][j]:self.subdivisions[1][j+1]]
     5160            sd = self[self._subdivisions[0][i]:self._subdivisions[0][i+1],
     5161                      self._subdivisions[1][j]:self._subdivisions[1][j+1]]
    51615162            sd.set_immutable()
    51625163            self.cache(key, sd)
    51635164        return sd
    cdef class Matrix(matrix1.Matrix): 
    51975198            ...
    51985199            IndexError: Submatrix 0,0 has no entry 4,0
    51995200        """
    5200         if self.subdivisions is None:
     5201        if self._subdivisions is None:
    52015202            if not i and not j:
    52025203                return self[x,y]
    52035204            else:
    52045205                raise IndexError, "No such submatrix %s, %s"%(i,j)
    5205         if x >= self.subdivisions[0][i+1]-self.subdivisions[0][i] or \
    5206            y >= self.subdivisions[1][j+1]-self.subdivisions[1][j]:
     5206        if x >= self._subdivisions[0][i+1]-self._subdivisions[0][i] or \
     5207           y >= self._subdivisions[1][j+1]-self._subdivisions[1][j]:
    52075208            raise IndexError, "Submatrix %s,%s has no entry %s,%s"%(i,j, x, y)
    5208         return self[self.subdivisions[0][i] + x , self.subdivisions[1][j] + y]
     5209        return self[self._subdivisions[0][i] + x , self._subdivisions[1][j] + y]
    52095210
    52105211    def _subdivide_on_augment(self, left, right):
    52115212        r"""
    cdef class Matrix(matrix1.Matrix): 
    52395240        More descriptive, but indirect, doctests are at
    52405241        :meth:`sage.matrix.matrix1.Matrix.augment`.
    52415242        """
    5242         left_rows, left_cols = left.get_subdivisions()
    5243         right_rows, right_cols = right.get_subdivisions()
     5243        left_rows, left_cols = left.subdivisions()
     5244        right_rows, right_cols = right.subdivisions()
    52445245        if left_rows == right_rows:
    52455246            self_rows = left_rows
    52465247        else:
    cdef class Matrix(matrix1.Matrix): 
    52895290        More descriptive, but indirect, doctests are at
    52905291        :meth:`sage.matrix.matrix1.Matrix.augment`.
    52915292        """
    5292         top_rows, top_cols = top.get_subdivisions()
    5293         bottom_rows, bottom_cols = bottom.get_subdivisions()
     5293        top_rows, top_cols = top.subdivisions()
     5294        bottom_rows, bottom_cols = bottom.subdivisions()
    52945295        if top_cols == bottom_cols:
    52955296            self_cols = top_cols
    52965297        else:
    cdef class Matrix(matrix1.Matrix): 
    53025303        self.subdivide(self_rows, self_cols)
    53035304        return None
    53045305
    5305     def get_subdivisions(self):
     5306    def subdivisions(self):
    53065307        """
    53075308        Returns the current subdivision of self.
    53085309       
    53095310        EXAMPLES::
    53105311       
    53115312            sage: M = matrix(5, 5, range(25))
    5312             sage: M.get_subdivisions()
     5313            sage: M.subdivisions()
    53135314            ([], [])
    53145315            sage: M.subdivide(2,3)
    5315             sage: M.get_subdivisions()
     5316            sage: M.subdivisions()
    53165317            ([2], [3])
    53175318            sage: N = M.parent()(1)
    5318             sage: N.subdivide(M.get_subdivisions()); N
     5319            sage: N.subdivide(M.subdivisions()); N
    53195320            [1 0 0|0 0]
    53205321            [0 1 0|0 0]
    53215322            [-----+---]
    cdef class Matrix(matrix1.Matrix): 
    53235324            [0 0 0|1 0]
    53245325            [0 0 0|0 1]
    53255326        """
    5326         if self.subdivisions is None:
     5327        if self._subdivisions is None:
    53275328            return ([], [])
    53285329        else:
    5329             return (self.subdivisions[0][1:-1], self.subdivisions[1][1:-1])
     5330            return (self._subdivisions[0][1:-1], self._subdivisions[1][1:-1])
     5331
     5332    # 'get_subdivisions' is kept for backwards compatibility: see #4983.
     5333    get_subdivisions = subdivisions
    53305334           
    53315335    def tensor_product(self,Y):
    53325336        """
  • sage/matrix/matrix_dense.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_dense.pyx
    a b cdef class Matrix_dense(matrix.Matrix): 
    3030        not change the entries of this matrix.
    3131        """
    3232        A = self.new_matrix(entries=self.list(), coerce=False, copy=False)
    33         if self.subdivisions is not None:
    34             A.subdivide(*self.get_subdivisions())
     33        if self._subdivisions is not None:
     34            A.subdivide(*self.subdivisions())
    3535        return A
    3636
    3737    def __hash__(self):
    cdef class Matrix_dense(matrix.Matrix): 
    196196            for i from 0<= i < nr:
    197197                trans.set_unsafe(j,i,self.get_unsafe(i,j))
    198198
    199         if self.subdivisions is not None:
    200             row_divs, col_divs = self.get_subdivisions()
     199        if self._subdivisions is not None:
     200            row_divs, col_divs = self.subdivisions()
    201201            trans.subdivide(col_divs, row_divs)
    202202        return trans
    203203
    cdef class Matrix_dense(matrix.Matrix): 
    241241                ri = ri-1
    242242                atrans.set_unsafe(j , i, self.get_unsafe(ri,rj))
    243243
    244         if self.subdivisions is not None:
    245             row_divs, col_divs = self.get_subdivisions()
     244        if self._subdivisions is not None:
     245            row_divs, col_divs = self.subdivisions()
    246246            atrans.subdivide([nc - t for t in reversed(col_divs)],
    247247                             [nr - t for t in reversed(row_divs)])
    248248        return atrans
    cdef class Matrix_dense(matrix.Matrix): 
    331331        M = sage.matrix.matrix_space.MatrixSpace(R, self._nrows,
    332332                   self._ncols, sparse=False)
    333333        image = M([phi(z) for z in self.list()])
    334         if self.subdivisions is not None:
    335             image.subdivide(*self.get_subdivisions())
     334        if self._subdivisions is not None:
     335            image.subdivide(*self.subdivisions())
    336336        return image
    337337
    338338    def apply_map(self, phi, R=None, sparse=False):
    cdef class Matrix_dense(matrix.Matrix): 
    422422        M = sage.matrix.matrix_space.MatrixSpace(R, self._nrows,
    423423                   self._ncols, sparse=sparse)
    424424        image = M(v)
    425         if self.subdivisions is not None:
    426             image.subdivide(*self.get_subdivisions())
     425        if self._subdivisions is not None:
     426            image.subdivide(*self.subdivisions())
    427427        return image
    428428
    429429    def _derivative(self, var=None):
    cdef class Matrix_dense(matrix.Matrix): 
    454454        M = sage.matrix.matrix_space.MatrixSpace(R, self._nrows,
    455455                   self._ncols, sparse=False)
    456456        image = M(v)
    457         if self.subdivisions is not None:
    458             image.subdivide(*self.get_subdivisions())
     457        if self._subdivisions is not None:
     458            image.subdivide(*self.subdivisions())
    459459        return image
    460460
  • sage/matrix/matrix_double_dense.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_double_dense.pyx
    a b cdef class Matrix_double_dense(matrix_de 
    517517        cdef Matrix_double_dense A
    518518        A = self._new(self._nrows, self._ncols)
    519519        A._matrix_numpy = self._matrix_numpy.copy()
    520         if self.subdivisions is not None:
    521             A.subdivide(*self.get_subdivisions())
     520        if self._subdivisions is not None:
     521            A.subdivide(*self.subdivisions())
    522522        return A
    523523
    524524
    cdef class Matrix_double_dense(matrix_de 
    10901090        cdef Matrix_double_dense trans
    10911091        trans = self._new(self._ncols, self._nrows)
    10921092        trans._matrix_numpy = self._matrix_numpy.transpose().copy()
    1093         if self.subdivisions is not None:
    1094             row_divs, col_divs = self.get_subdivisions()
     1093        if self._subdivisions is not None:
     1094            row_divs, col_divs = self.subdivisions()
    10951095            trans.subdivide(col_divs, row_divs)
    10961096        return trans
    10971097
  • sage/matrix/matrix_generic_dense.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_generic_dense.pyx
    a b cdef class Matrix_generic_dense(matrix_d 
    225225            [3|4 5]
    226226        """
    227227        A = self.__class__(self._parent, self._entries, copy = True, coerce=False)
    228         if self.subdivisions is not None:
    229             A.subdivide(*self.get_subdivisions())
     228        if self._subdivisions is not None:
     229            A.subdivide(*self.subdivisions())
    230230        return A
    231231
    232232    def _multiply_classical(left, matrix.Matrix _right):
  • sage/matrix/matrix_generic_sparse.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_generic_sparse.pyx
    a b cdef class Matrix_generic_sparse(matrix_ 
    265265   
    266266    def __copy__(self):
    267267        A = self.__class__(self._parent, self._entries, copy = True, coerce=False)
    268         if self.subdivisions is not None:
    269             A.subdivide(*self.get_subdivisions())
     268        if self._subdivisions is not None:
     269            A.subdivide(*self.subdivisions())
    270270        return A
    271271
    272272   
  • sage/matrix/matrix_integer_2x2.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_integer_2x2.pyx
    a b cdef class Matrix_integer_2x2(matrix_den 
    311311        mpz_set(x.c ,self.c)
    312312        mpz_set(x.d, self.d)
    313313        x._mutability = Mutability(False)
    314         if self.subdivisions is not None:
    315             x.subdivide(*self.get_subdivisions())
     314        if self._subdivisions is not None:
     315            x.subdivide(*self.subdivisions())
    316316        return x
    317317
    318318    cpdef ModuleElement _add_(left, ModuleElement right):
  • sage/matrix/matrix_integer_dense.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_integer_dense.pyx
    a b cdef class Matrix_integer_dense(matrix_d 
    266266            mpz_init_set(A._entries[i], self._entries[i])
    267267        sig_off()
    268268        A._initialized = True
    269         if self.subdivisions is not None:
    270             A.subdivide(*self.get_subdivisions())
     269        if self._subdivisions is not None:
     270            A.subdivide(*self.subdivisions())
    271271        return A
    272272       
    273273    def __hash__(self):
    cdef class Matrix_integer_dense(matrix_d 
    48424842                mpz_init_set(A._matrix[j][i], self._matrix[i][j])
    48434843        sig_off()
    48444844        A._initialized = True
    4845         if self.subdivisions is not None:
    4846             row_divs, col_divs = self.get_subdivisions()
     4845        if self._subdivisions is not None:
     4846            row_divs, col_divs = self.subdivisions()
    48474847            A.subdivide(col_divs, row_divs)
    48484848        return A
    48494849
    cdef class Matrix_integer_dense(matrix_d 
    48944894        sig_off()
    48954895        A._initialized = True
    48964896
    4897         if self.subdivisions is not None:
    4898             row_divs, col_divs = self.get_subdivisions()
     4897        if self._subdivisions is not None:
     4898            row_divs, col_divs = self.subdivisions()
    48994899            A.subdivide([nc - t for t in reversed(col_divs)],
    49004900                        [nr - t for t in reversed(row_divs)])
    49014901        return A
  • sage/matrix/matrix_mod2_dense.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_mod2_dense.pyx
    a b cdef class Matrix_mod2_dense(matrix_dens 
    489489            return matrix_dense.Matrix_dense.str(self, rep_mapping=rep_mapping, zero=zero, plus_one=plus_one)
    490490
    491491        cdef list row_div, col_div
    492         if self.subdivisions is not None:
     492        if self._subdivisions is not None:
    493493            row_s = empty_row
    494494            div_s = row_divider = b"[%s]" % ("-" * (self._ncols*2-1))
    495             row_div, col_div = self.get_subdivisions()
     495            row_div, col_div = self.subdivisions()
    496496            last_i = 0
    497497            for i in col_div:
    498498                if i == last_i or i == self._ncols:
    cdef class Matrix_mod2_dense(matrix_dens 
    508508                row_s[1+2*j] = c'0' + mzd_read_bit(self._entries,i,j)
    509509            s.append(row)
    510510
    511         if self.subdivisions is not None:
     511        if self._subdivisions is not None:
    512512            for i in reversed(row_div):
    513513                s.insert(i, row_divider)
    514514
    cdef class Matrix_mod2_dense(matrix_dens 
    10011001        if self._nrows and self._ncols:
    10021002            mzd_copy(A._entries, self._entries)
    10031003
    1004         if self.subdivisions is not None:
    1005             A.subdivide(*self.get_subdivisions())
     1004        if self._subdivisions is not None:
     1005            A.subdivide(*self.subdivisions())
    10061006
    10071007        return A
    10081008       
    cdef class Matrix_mod2_dense(matrix_dens 
    14521452            return A
    14531453
    14541454        A._entries = mzd_transpose(A._entries, self._entries)
    1455         if self.subdivisions is not None:
    1456             A.subdivide(*self.get_subdivisions())
     1455        if self._subdivisions is not None:
     1456            A.subdivide(*self.subdivisions())
    14571457        return A
    14581458
    14591459    cdef int _cmp_c_impl(self, Element right) except -2:
  • sage/matrix/matrix_modn_dense.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_modn_dense.pyx
    a b cdef class Matrix_modn_dense(matrix_dens 
    668668        memcpy(A._entries, self._entries, sizeof(mod_int)*self._nrows*self._ncols)
    669669        A.p = self.p
    670670        A.gather = self.gather
    671         if self.subdivisions is not None:
    672             A.subdivide(*self.get_subdivisions())
     671        if self._subdivisions is not None:
     672            A.subdivide(*self.subdivisions())
    673673        return A
    674674
    675675
    cdef class Matrix_modn_dense(matrix_dens 
    18541854            for j from 0 <= j < self._ncols:
    18551855                mpz_init_set_si(L_row[j], A_row[j])
    18561856        L._initialized = 1
    1857         L.subdivide(self.get_subdivisions())
     1857        L.subdivide(self.subdivisions())
    18581858        return L
    18591859
    18601860
  • sage/matrix/matrix_modn_sparse.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_modn_sparse.pyx
    a b cdef class Matrix_modn_sparse(matrix_spa 
    688688            row = self.rows[i]
    689689            for j from 0 <= j < row.num_nonzero:
    690690                set_entry(&B.rows[row.positions[j]], i, row.entries[j])
    691         if self.subdivisions is not None:
    692             row_divs, col_divs = self.get_subdivisions()
     691        if self._subdivisions is not None:
     692            row_divs, col_divs = self.subdivisions()
    693693            B.subdivide(col_divs, row_divs)
    694694        return B
    695695                               
    cdef class Matrix_modn_sparse(matrix_spa 
    10111011            for j from 0 <= j < A_row.num_nonzero:
    10121012                L_row.positions[j] = A_row.positions[j]
    10131013                mpz_init_set_si(L_row.entries[j], A_row.entries[j])
    1014         L.subdivide(self.get_subdivisions())
     1014        L.subdivide(self.subdivisions())
    10151015        return L
    10161016
  • sage/matrix/matrix_rational_dense.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_rational_dense.pyx
    a b cdef class Matrix_rational_dense(matrix_ 
    524524        for i from 0 <= i < self._nrows*self._ncols:
    525525            mpq_set(M._entries[i],self._entries[i])
    526526        sig_off()
    527         if self.subdivisions is not None:
    528             M.subdivide(*self.get_subdivisions())
     527        if self._subdivisions is not None:
     528            M.subdivide(*self.subdivisions())
    529529        return M
    530530
    531531
    cdef class Matrix_rational_dense(matrix_ 
    13201320            A, d = self._clear_denom()
    13211321            if d != 1:
    13221322                raise TypeError("matrix has denominators so can't change to ZZ.")
    1323             A.subdivide(self.get_subdivisions())
     1323            A.subdivide(self.subdivisions())
    13241324            return A
    13251325        elif is_IntegerModRing(R) and R.order() < MAX_MODULUS:
    13261326            b = R.order()
    cdef class Matrix_rational_dense(matrix_ 
    13291329                raise TypeError("matrix denominator not coprime to modulus")
    13301330            B = A._mod_int(b)
    13311331            C = (1/(B.base_ring()(d))) * B
    1332             C.subdivide(self.get_subdivisions())
     1332            C.subdivide(self.subdivisions())
    13331333            return C
    13341334        else:
    13351335            D = matrix_dense.Matrix_dense.change_ring(self, R)
    1336             D.subdivide(self.get_subdivisions())
     1336            D.subdivide(self.subdivisions())
    13371337            return D
    13381338           
    13391339   
    cdef class Matrix_rational_dense(matrix_ 
    23582358                mpq_set(A._matrix[j][i], self._matrix[i][j])
    23592359        sig_off()
    23602360
    2361         if self.subdivisions is not None:
    2362             row_divs, col_divs = self.get_subdivisions()
     2361        if self._subdivisions is not None:
     2362            row_divs, col_divs = self.subdivisions()
    23632363            A.subdivide(col_divs, row_divs)
    23642364        return A
    23652365
    cdef class Matrix_rational_dense(matrix_ 
    24092409                mpq_set(A._matrix[rj][ri], self._matrix[i][j])
    24102410        sig_off()
    24112411
    2412         if self.subdivisions is not None:
    2413             row_divs, col_divs = self.get_subdivisions()
     2412        if self._subdivisions is not None:
     2413            row_divs, col_divs = self.subdivisions()
    24142414            A.subdivide([nc - t for t in reversed(col_divs)],
    24152415                        [nr - t for t in reversed(row_divs)])
    24162416        return A
  • sage/matrix/matrix_rational_sparse.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_rational_sparse.pyx
    a b cdef class Matrix_rational_sparse(matrix 
    603603
    604604            sage: a.subdivide([1,1], [2])
    605605            sage: b = a.dense_matrix().sparse_matrix().dense_matrix()
    606             sage: b.get_subdivisions() == a.get_subdivisions()
     606            sage: b.subdivisions() == a.subdivisions()
    607607            True
    608608        """
    609609        cdef Matrix_rational_dense B
    cdef class Matrix_rational_sparse(matrix 
    614614            v = &(self._matrix[i])
    615615            for j from 0 <= j < v.num_nonzero:
    616616                mpq_set(B._matrix[i][v.positions[j]], v.entries[j])
    617         B.subdivide(self.get_subdivisions())
     617        B.subdivide(self.subdivisions())
    618618        return B
    619619
    620620##     def _set_row_to_negative_of_row_of_A_using_subset_of_columns(self, Py_ssize_t i, Matrix A,
  • sage/matrix/matrix_sparse.pyx

    diff -r 91687375f075 -r 5a7a763bf77b sage/matrix/matrix_sparse.pyx
    a b cdef class Matrix_sparse(matrix.Matrix): 
    6666       
    6767        M = sage.matrix.matrix_space.MatrixSpace(ring, self._nrows, self._ncols, sparse=self.is_sparse_c())
    6868        mat = M(self.dict(), coerce=True, copy=False)
    69         mat.subdivide(self.get_subdivisions())
     69        mat.subdivide(self.subdivisions())
    7070        return mat
    7171
    7272    def __copy__(self):
    cdef class Matrix_sparse(matrix.Matrix): 
    9292            [ 2 -2]
    9393        """
    9494        A = self.new_matrix(entries=self.dict(), coerce=False, copy=False)
    95         if self.subdivisions is not None:
    96             A.subdivide(*self.get_subdivisions())
     95        if self._subdivisions is not None:
     96            A.subdivide(*self.subdivisions())
    9797        return A
    9898
    9999    def __hash__(self):
    cdef class Matrix_sparse(matrix.Matrix): 
    390390            i = get_ij(nz, k, 0)
    391391            j = get_ij(nz, k, 1)
    392392            A.set_unsafe(j,i,self.get_unsafe(i,j))
    393         if self.subdivisions is not None:
    394             row_divs, col_divs = self.get_subdivisions()
     393        if self._subdivisions is not None:
     394            row_divs, col_divs = self.subdivisions()
    395395            A.subdivide(col_divs, row_divs)
    396396        return A
    397397
    cdef class Matrix_sparse(matrix.Matrix): 
    405405            i = get_ij(nz, k, 0)
    406406            j = get_ij(nz, k, 1)
    407407            A.set_unsafe(self._ncols-j-1, self._nrows-i-1,self.get_unsafe(i,j))
    408         if self.subdivisions is not None:
    409             row_divs, col_divs = self.get_subdivisions()
     408        if self._subdivisions is not None:
     409            row_divs, col_divs = self.subdivisions()
    410410            A.subdivide(list(reversed([self._ncols - t for t in col_divs])),
    411411                            list(reversed([self._nrows - t for t in row_divs])))
    412412        return A
    cdef class Matrix_sparse(matrix.Matrix): 
    645645            m = M([zero_res] * (self._nrows * self._ncols))
    646646            for i,n in v.items():
    647647                m[i] = n
    648             if self.subdivisions is not None:
    649                 m.subdivide(*self.get_subdivisions())
     648            if self._subdivisions is not None:
     649                m.subdivide(*self.subdivisions())
    650650            return m
    651651           
    652652        M = sage.matrix.matrix_space.MatrixSpace(R, self._nrows,
    653653                   self._ncols, sparse=sparse)
    654654        m = M(v)
    655         if self.subdivisions is not None:
    656             m.subdivide(*self.get_subdivisions())
     655        if self._subdivisions is not None:
     656            m.subdivide(*self.subdivisions())
    657657        return m
    658658
    659659    def _derivative(self, var=None):