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

SVDComplex -- Compute the SVD decomposition of a chain complex over RR

Description

We compute the singular value decomposition either by the iterated Projections or by the Laplacian method. In case the input consists of two chain complexes 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)
 -- .0118577s elapsed

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

o4 : Complex
i5 : C.dd^2

o5 = 0

o5 : ComplexMap
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 : Complex
i7 : elapsedTime (h,U)=SVDComplex CR;
 -- .00425676s 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 : Complex
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 complex errors

o12 = {8.43769e-15, 6.39488e-14, 1.06581e-13, 9.76996e-15}

o12 : List
i13 : elapsedTime (hL,U)=SVDComplex(CR,Strategy=>Laplacian);
 -- .0643167s 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.77636e-14, 6.39488e-14, 8.52651e-14, 3.55271e-15}

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 complex errors

o18 = {2.37144e-13, 1.42109e-13, 2.63678e-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:

  • SVDComplex(Complex)
  • SVDComplex(Complex,Complex)

For the programmer

The object SVDComplex is a method function with options.


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/SVDComplexes.m2:1068:0.