We compute the singular value decomposition either by the iterated Projections or by the Laplacian method. In case of the projection method we record in h1 the last two nonzero singular values and first singular value expected to be really zero.
In case of the Laplacian method we record in h1 the smallest common Eigenvalues of the neighboring Laplacians, and the first Eigenvalue expected to be zero.
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} o2 = {1, 3, 5, 2} o2 : List |
i3 : r={4,3,3} o3 = {4, 3, 3} o3 : List |
i4 : elapsedTime C=randomChainComplex(h,r,Height=>5,ZeroMean=>true) -- 0.00381241 seconds elapsed 5 10 11 5 o4 = ZZ <-- ZZ <-- ZZ <-- ZZ 0 1 2 3 o4 : ChainComplex |
i5 : C.dd^2 5 11 o5 = 0 : ZZ <----- ZZ : 2 0 10 5 1 : ZZ <----- ZZ : 3 0 o5 : ChainComplexMap |
i6 : CR=(C**RR_53) 5 10 11 5 o6 = RR <-- RR <-- RR <-- RR 53 53 53 53 0 1 2 3 o6 : ChainComplex |
i7 : elapsedTime (h,h1)=SVDHomology CR -- 0.000767016 seconds elapsed o7 = (HashTable{0 => 1}, HashTable{1 => (7.87842, 1.31052, ) }) 1 => 3 2 => (37.9214, 30.3707, 7.75673e-15) 2 => 5 3 => (14.972, 8.57847, 2.36343e-15) 3 => 2 o7 : Sequence |
i8 : elapsedTime (hL,hL1)=SVDHomology(CR,Strategy=>Laplacian) -- 0.00211294 seconds elapsed o8 = (HashTable{0 => 1}, HashTable{0 => (, 1.71747, -1.85566e-14) }) 1 => 3 1 => (1.71747, 922.381, -2.54889e-14) 2 => 5 2 => (922.381, 73.5901, 7.52946e-14) 3 => 2 3 => (73.5901, , 7.45113e-14) o8 : Sequence |
i9 : hL === h o9 = true |
i10 : (h1#1_1)^2, hL1#1_0, (h1#1_1)^2-hL1#1_0 o10 = (1.71747, 1.71747, 4.27214e-13) o10 : Sequence |
i11 : (h1#2_1)^2, hL1#2_0, (h1#2_1)^2-hL1#2_0 o11 = (922.381, 922.381, -5.68434e-13) o11 : Sequence |
i12 : (h1#3_1)^2, hL1#3_0, (h1#3_1)^2-hL1#3_0 o12 = (73.5901, 73.5901, 1.42109e-14) o12 : Sequence |
i13 : D=disturb(C,1e-3,Strategy=>Discrete) 5 10 11 5 o13 = RR <-- RR <-- RR <-- RR 53 53 53 53 0 1 2 3 o13 : ChainComplex |
i14 : C.dd_1 o14 = | -1 -1 -5 -3 -4 -2 3 -3 7 -1 | | -5 -2 -1 5 -3 1 5 4 3 0 | | 1 -3 5 5 0 3 4 3 -9 -3 | | 0 -3 -4 -2 -5 -1 6 -3 4 -3 | | -1 -2 3 5 1 3 3 4 -5 0 | 5 10 o14 : Matrix ZZ <--- ZZ |
i15 : D.dd_1 o15 = | -.999 -1.001 -4.995 -2.997 -3.996 -2.002 2.997 -3.003 6.993 -.999 | -5.005 -2.002 -.999 4.995 -2.997 1.001 5.005 3.996 3.003 0 | .999 -3.003 5.005 4.995 0 3.003 4.004 3.003 -8.991 -3.003 | 0 -2.997 -3.996 -2.002 -4.995 -1.001 6.006 -3.003 4.004 -3.003 | -1.001 -2.002 2.997 5.005 1.001 2.997 3.003 3.996 -4.995 0 ----------------------------------------------------------------------- | | | | | 5 10 o15 : Matrix RR <--- RR 53 53 |
i16 : (hd,hd1)=SVDHomology(CR,D,Threshold=>1e-2) o16 = (HashTable{0 => 1}, HashTable{1 => (7.87842, 1.31052, ) }) 1 => 3 2 => (37.9214, 30.3707, 7.75673e-15) 2 => 5 3 => (14.972, 8.57847, 2.36343e-15) 3 => 2 o16 : Sequence |
i17 : hd === h o17 = true |
i18 : hd1 === h1 o18 = true |
The algorithm might fail if the condition numbers of the differential are too bad