Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Note that A.change_ring(RDF) does not change A "in place", (so as it is the case with the sort method, applied on a list,) instead, it delivers an other object living over RDF. To see this:

sage: G = graphs.CycleGraph(3)
sage: A = G.adjacency_matrix()
sage: A.base_ring()
Integer Ring
sage: A.change_ring( RDF )
[0.0 1.0 1.0]
[1.0 0.0 1.0]
[1.0 1.0 0.0]
sage: A
[0 1 1]
[1 0 1]
[1 1 0]
sage: A.base_ring()
Integer Ring

Now the solution is simple:

sage: G = graphs.CycleGraph(3)
sage: A = G.adjacency_matrix()
sage: a = A.change_ring( RDF )
sage: a.SVD()
(
[   -0.5773502691896255 2.7755575615628914e-16     0.8164965809277258]
[   -0.5773502691896257    -0.7071067811865475    -0.4082482904638628]
[   -0.5773502691896255     0.7071067811865476   -0.40824829046386313],

[               2.0                0.0                0.0]
[               0.0 0.9999999999999999                0.0]
[               0.0                0.0 0.9999999999999999],

[ -0.577350269189626                -0.0 -0.8164965809277259]
[-0.5773502691896256  0.7071067811865475 0.40824829046386313]
[-0.5773502691896256 -0.7071067811865476 0.40824829046386313]
)
sage: