I'm refactoring the CDF and RDF matrix code and moving things to numpy. 
  I ran across the following code in the CDF matrix function 
solve_left_LU that handles degenerate cases.  This code is supposed to 
solve the equation self*x = b and return x.


         if self._nrows == 0 or self._ncols == 0:
             M=self._column_ambient_module()
             return M.zero_vector()
         if self._nrows == 0 or self._ncols == 0:
             return self.row_module().zero_vector()


The tests provide a use-case:

             sage: A = matrix(CDF, 0, 3, [])
             sage: A.solve_left_LU(vector(CDF,[]))
             ()
             sage: A = matrix(CDF, 3, 0, [])
             sage: A.solve_left_LU(vector(CDF,3, [1,2,3]))
             (0, 0, 0)


In the above code, it seems that the second if statement is never 
triggered.  Should it be triggered sometimes?  What is the correct 
behavior for a degenerate matrix?

The corresponding code in the RDF case is:

         if self._nrows != b.degree():
             raise ValueError, "number of rows of self must equal degree 
of b"
         if self._nrows == 0 or self._ncols == 0:
             return self._row_ambient_module().zero_vector()

Giving the following behavior:

             sage: A = matrix(RDF, 0, 3, [])
             sage: A.solve_left_LU(vector(RDF,[]))
             (0.0, 0.0, 0.0)
             sage: A = matrix(RDF, 3, 0, [])
             sage: A.solve_left_LU(vector(RDF,3, [1,2,3]))
             ()


Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to