Ask Your Question

Revision history [back]

It depends on the ring of the matrix. For example, it works for matrices over CDF:

sage: M = matrix(CDF, [[1,2,3],[1,4,6]])
sage: M.SVD()
(
[-0.455252372951 -0.890362441325]
[-0.890362441325  0.455252372951],

[ 8.17345734477            0.0            0.0]
[           0.0 0.441129270439            0.0],

[   -0.164632267291    -0.986355015482 -2.81388521797e-16]
[   -0.547131320636    0.0913215509714    -0.832050294338]
[   -0.820696980953     0.136982326457     0.554700196225]
)

but not for matrices over QQ:

sage: M = matrix(QQ, [[1,2,3],[1,4,6]])
sage: M.SVD()
AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense' object has no attribute 'SVD'

It depends on the ring of the matrix. For example, it works for matrices over CDF:

sage: M = matrix(CDF, [[1,2,3],[1,4,6]])
sage: M.SVD()
(
[-0.455252372951 -0.890362441325]
[-0.890362441325  0.455252372951],

[ 8.17345734477            0.0            0.0]
[           0.0 0.441129270439            0.0],

[   -0.164632267291    -0.986355015482 -2.81388521797e-16]
[   -0.547131320636    0.0913215509714    -0.832050294338]
[   -0.820696980953     0.136982326457     0.554700196225]
)

but not for matrices over QQ:

sage: M = matrix(QQ, [[1,2,3],[1,4,6]])
sage: M.SVD()
AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense' object has no attribute 'SVD'

So, the method .SVD() is not implemented for every kind of matrices.