Opened 13 years ago

Closed 13 years ago

#1607 closed enhancement (duplicate)

kernel -- A.right_kernel and A.left_kernel

Reported by: was Owned by: was
Priority: major Milestone: sage-3.0
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by was)

It would be really useful to have

   sage: A.right_kernel()

to mean the set of vectors v such that A*v = 0, i.e., the vectors on the right.
That would have to be clearly documented -- the function itself would
be defined in matrix2.pyx and would just transpose A and call kernel
on the resulting transpose.  It would also cache the result.  

We have A.right_eigenvectors() in some cases (e.g., A an RDF matrix), and
the documentation makes the meaning very clear:

------------------------------

sage: A = random_matrix(RDF,3)
sage: A.right_eigenvectors()
([1.34856636676, -1.04338481358, -0.208244283695],
 [-0.250271326138  0.846883172518 0.0580964218791]
[ 0.884959315834  0.223023546117 -0.702413116863]
[ 0.392697431404   0.48275189278  0.709394543977])
sage: A.left_eigenvectors()
([1.34856636676, -1.04338481358, -0.208244283695],
 [ -0.51163197441  0.589230432257  0.625332088145]
[ 0.967591994779  0.214539369634  0.133186300037]
[-0.344957735432 -0.460493249193  0.817893714497])
sage: A.right_eigenvectors?
Type:           builtin_function_or_method
Base Class:     <type 'builtin_function_or_method'>
String Form:    <built-in method right_eigenvectors of sage.matrix.matrix_real_double_dense.Matrix_real_double_dense object at 0x2b077b08c3b0>
Namespace:      Interactive
Docstring:
    
            Computes the eigenvalues and *right* eigenvectors of this
            matrix m acting *from the left*.  I.e., vectors v such that
            m * v = lambda*v, where v is viewed as a column vector. 
------------------------------



It actually might be possible to define

   sage: A.left_kernel()

and

   sage: A.right_kernel()

and have
  
  sage: A.kernel()

default to A.right_kernel() without breaking sage into a million pieces.
One would first define only A.left_kernel and A.right_kernel.  Then
one would go through all of Sage and make sure every instance of
A.kernel where A is a matrix is changed to A.left_kernel -- since that
is what is currently assumed, then doctest everything, and finally
define a function kernel() in matrix2.pyx, which just calls self.right_kernel().

This would of course break code not in Sage that relies on the current
behavior, which is not desirable, but not a deal breaker either at this
stage in Sage development. 


Since x*A and A*x are both defined for x = vector(...), I think this
would be reasonable. 


Another possibility would be to *only* define A.left_kernel() and
A.right_kernel() and deprecate A.kernel().   That seems a little
 too anal to me. 

If we decide to do
the above, what are the other similar functions to worry about?
Certainly eigenspaces. 


 -- William 

Change History (4)

comment:1 Changed 13 years ago by was

  • Description modified (diff)

comment:2 Changed 13 years ago by was

  • Description modified (diff)

comment:3 Changed 13 years ago by was

From David Joyner:

+1 and

"An option is to add column_echelon in addition to echelon (ie, row_echelon). This is another left vs right thing."

comment:4 Changed 13 years ago by mhansen

  • Milestone changed from sage-wishlist to sage-3.0
  • Resolution set to duplicate
  • Status changed from new to closed

This was taken care of by #2542.

Note: See TracTickets for help on using tickets.