Macaulay2 » Documentation
Packages » SVDComplexes :: SVDComplex
next | previous | forward | backward | up | index | toc

SVDComplex -- Compute the SVD decomposition of a chainComplex over RR

Synopsis

Description

We compute the singular value decomposition either by the iterated Projections or by the Laplacian method. In case the input consists of two chainComplexes we use the iterated Projection method, and identify the stable singular values.

i1 : needsPackage "RandomComplexes"

o1 = RandomComplexes

o1 : Package
i2 : h={1,3,5,2,1}

o2 = {1, 3, 5, 2, 1}

o2 : List
i3 : r={5,11,3,2}

o3 = {5, 11, 3, 2}

o3 : List
i4 : elapsedTime C=randomChainComplex(h,r,Height=>4)
 -- 0.00460542 seconds elapsed

       6       19       19       7       3
o4 = ZZ  <-- ZZ   <-- ZZ   <-- ZZ  <-- ZZ
                                        
     0       1        2        3       4

o4 : ChainComplex
i5 : C.dd^2

           6          19
o5 = 0 : ZZ  <----- ZZ   : 2
                0

           19          7
     1 : ZZ   <----- ZZ  : 3
                 0

           19          3
     2 : ZZ   <----- ZZ  : 4
                 0

o5 : ChainComplexMap
i6 : CR=(C**RR_53)[1]

         6         19         19         7         3
o6 = RR    <-- RR     <-- RR     <-- RR    <-- RR
       53        53         53         53        53
                                                
     -1        0          1          2         3

o6 : ChainComplex
i7 : elapsedTime (h,U)=SVDComplex CR;
 -- 0.00165253 seconds elapsed
i8 : h

o8 = HashTable{-1 => 1}
               0 => 3
               1 => 5
               2 => 2
               3 => 1

o8 : HashTable
i9 : Sigma =source U

         6         19         19         7         3
o9 = RR    <-- RR     <-- RR     <-- RR    <-- RR
       53        53         53         53        53
                                                
     -1        0          1          2         3

o9 : ChainComplex
i10 : Sigma.dd_0

o10 = | 20.7789 0       0       0       0       0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
      | 0       18.3883 0       0       0       0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
      | 0       0       9.51991 0       0       0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
      | 0       0       0       7.19109 0       0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
      | 0       0       0       0       2.40088 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
      | 0       0       0       0       0       0 0 0 0 0 0 0 0 0 0 0 0 0 0 |

                 6         19
o10 : Matrix RR    <-- RR
               53        53
i11 : errors=apply(toList(min CR+1..max CR),ell->CR.dd_ell-U_(ell-1)*Sigma.dd_ell*transpose U_ell);
i12 : maximalEntry chainComplex errors

o12 = {7.10543e-15, 1.7053e-13, 4.61853e-14, 1.42109e-14}

o12 : List
i13 : elapsedTime (hL,U)=SVDComplex(CR,Strategy=>Laplacian);
 -- 0.00513382 seconds elapsed
i14 : hL === h

o14 = true
i15 : SigmaL =source U;
i16 : for i from min CR+1 to max CR list maximalEntry(SigmaL.dd_i -Sigma.dd_i)

o16 = {1.06581e-14, 1.13687e-13, 1.98952e-13, 1.77636e-14}

o16 : List
i17 : errors=apply(toList(min C+1..max C),ell->CR.dd_ell-U_(ell-1)*SigmaL.dd_ell*transpose U_ell);
i18 : maximalEntry chainComplex errors

o18 = {3.41061e-13, 1.27898e-13, 3.55493e-13, -infinity}

o18 : List

The optional argument

Caveat

The algorithm might fail if the condition numbers of the differential are too bad

Ways to use SVDComplex :

For the programmer

The object SVDComplex is a method function with options.