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

# commonEntries -- lists of positions, where they coincide up to threshold

- Usage:
    `(P1,P2)=commonEntries(L1,L2)`
- Inputs:
  - L1, a list,
  - L2, a list, descending lists of non-negative real numbers
- Optional inputs:
  - Threshold (missing documentation) => a real number, default value .0001, relative error allowed for equality
- Outputs:
  - P1, a list,
  - P2, a list,

## Description

Determine the positions, where the non-zero numbers in both lists which coincide up to a threshold. This is needed in the Laplacian method to compute the SVD normal form of a complex

    i1 : needsPackage "RandomComplexes"

    o1 = RandomComplexes

    o1 : Package

    i2 : setRandomSeed "a good example";
     -- setting random seed to 11076724743355249016474237734

    i3 : h={2,3,5,3}

    o3 = {2, 3, 5, 3}

    o3 : List

    i4 : r={4,3,5}

    o4 = {4, 3, 5}

    o4 : List

    i5 : elapsedTime C=randomChainComplex(h,r,Height=>100,ZeroMean=>true)
     -- .00325116s elapsed

           6       10       13       8
    o5 = ZZ  <-- ZZ   <-- ZZ   <-- ZZ

         0       1        2        3

    o5 : ChainComplex

    i6 : C.dd^2

               6          13
    o6 = 0 : ZZ  <----- ZZ   : 2
                    0

               10          8
         1 : ZZ   <----- ZZ  : 3
                     0

    o6 : ChainComplexMap

    i7 : D=disturb(C**RR_53,1e-4)

             6         10         13         8
    o7 = RR    <-- RR     <-- RR     <-- RR
           53        53         53         53

         0         1          2          3

    o7 : ChainComplex

    i8 : Delta=laplacians D;

    i9 : L0=(SVD Delta#0)_0, L1=(SVD Delta#1)_0,L2=(SVD Delta#2)_0,L3=(SVD Delta#3)_0

    o9 = ({60648900}, {28210500000}, {28210500000}, {2056900000})
          {55489200}  {9617270000 }  {9617270000 }  {1028620000}
          {29990300}  {3132530000 }  {3132530000 }  {754460000 }
          {9100710 }  {60649000   }  {2056900000 }  {484906000 }
          {.327165 }  {55489300   }  {1028620000 }  {49026600  }
          {.0102018}  {29990300   }  {754460000  }  {3.7497    }
                      {9100740    }  {484906000  }  {2.9526    }
                      {38.8744    }  {49026600   }  {1.35595   }
                      {21.2473    }  {51.0793    }
                      {5.85738    }  {29.3294    }
                                     {20.8771    }
                                     {3.48837    }
                                     {2.04772    }

    o9 : Sequence

    i10 : commonEntries(L0,L1)

    o10 = ({0, 1, 2, 3}, {3, 4, 5, 6})

    o10 : Sequence

    i11 : commonEntries(L1,L2)

    o11 = ({0, 1, 2}, {0, 1, 2})

    o11 : Sequence

    i12 : commonEntries(L2,L3)

    o12 = ({3, 4, 5, 6, 7}, {0, 1, 2, 3, 4})

    o12 : Sequence

## Caveat

## See also

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

## Ways to use commonEntries:

- `commonEntries(List,List)`

## For the programmer

The object commonEntries is a method function with options.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/SVDComplexes.m2:1413:0.