Ticket #174: trac-174-part2.patch

File trac-174-part2.patch, 1.3 KB (added by was, 14 years ago)
  • sage/matrix/matrix_integer_dense.pyx

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1202484480 28800
    # Node ID 32d885f93e2cd6351f1baa01b620350a5bc62017
    # Parent  1662f89e140e7821b81bc5e26216bde00d1acb98
    Fix rank  -- give it an option.
    
    diff -r 1662f89e140e -r 32d885f93e2c sage/matrix/matrix_integer_dense.pyx
    a b cdef class Matrix_integer_dense(matrix_d 
    20262026                raise ZeroDivisionError, "input matrix must be nonsingular"
    20272027            return self._solve_iml(P.identity_matrix(), right=True)
    20282028
    2029     def solve_right(self, B):
     2029    def solve_right(self, B, check_rank=True):
    20302030        r"""
    20312031        If self is a matrix $A$ of full rank, then this function
    20322032        returns a vector or matrix $X$ such that $A X = B$.  If $B$ is
    cdef class Matrix_integer_dense(matrix_d 
    20922092        # throws an error instead of ** going into an infinite loop **
    20932093        # in the non-full rank case.  In any case, we do this for now,
    20942094        # since rank is very fast and infinite loops are evil.
    2095         if self.rank() < self.nrows():
     2095        if check_rank and self.rank() < self.nrows():
    20962096            raise ValueError, "self must be of full rank."
    20972097
    20982098        if not self.is_square():