Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Note that the type of output depends on the base ring of the matrix, for example a floating point (double) matrix

sage: matrix(RDF,[[1/2,-1/4],[-1/2,1/3]]).eigenvalues()
[0.779908245295, 0.0534250880383]

yields a floating-point result. A matrix over the rationals

sage: matrix(QQ,[[1/2,-1/4],[-1/2,1/3]]).eigenvalues()
[0.05342508803827721?, 0.779908245295057?]

returns eigenvalues in the splitting field which uses interval arithmetic. For arbitrary precision floating point numbers, there is no special implementation,

sage: matrix(RR,[[1/2,-1/4],[-1/2,1/3]]).eigenvalues()
/home/vbraun/opt/sage-5.0.beta11/local/bin/sage-ipython:1: UserWarning: Using generic algorithm for an inexact ring, which will probably give incorrect results due to numerical precision issues.
  #!/usr/bin/env python
[0.779908245295056, 0.0534250880382772]

so Sage falls back to the lapack implementation which doesn't track precision. Finally, over the symbolic ring

sage: matrix(SR,[[1/2,-1/4],[-1/2,1/3]]).eigenvalues()
[-1/12*sqrt(19) + 5/12, 1/12*sqrt(19) + 5/12]

Sage computes the symbolic answer.

Now to your question, nobody has implemented SVD for matrices with base field other than floating point numbers (the only implementation is via lapack). Probably because the real utility of the SVD is that there are efficient numerical ways to compute it, while the symbolic answer is almost always going to be a huge mess of roots.

A possible project would be to implement SVD for more base fields, for example starting with the explicit formula for 2x2 matrices.