Introduction

            This document considers matrices with a controlled amount of singularity.  This has significance for the production of matrices for inversion by the routines Sminv, Sminvqm, MPhSminv and MPSminv.

Random Vectors

            In ..\Fittery\FitData.doc .htm, equation (8) contain the second derivative matrix relevant to curve fitting.  In simplified notation, dropping the last term for N parameters in the fit this is.

                       (1.1)

This vector is symmetric and it is shown to be positive definite in CHOLESKY.doc .htm.  There are no restrictions on the partials in (1.1).  Thus for testing purposes define the set of partials at the point xi by

     (1.2)

There will be a different set of values for PFA for each value of xi.  The second derivative matrix becomes

     (1.3)

This is a symmetric array of the form that is shown to be positive definite in CHOLESKY.doc.   If Ndat is less than N, the matrix does not have an inverse.  In the case that Ndat=1, and N = 2, and wi = 1 , the array is 

                 (1.4)

The determinant of this Array is (R1R1R2R2-R2R1R1R2) = 0. 

            Code demonstrating, both that Ndat=3, N=4 does not have an inverse and that Ndat=4, N=4 does have an inverse is in MatInvSA/tsminv1.zip.  The specific results are in the file tsminvs.out.

Small wi

            In fitter applications, the last wi can become very small.  This was simulated by making the last wi = 10-25 while the rest remain 1.  With appropriate definitions this allowed sminvq to invert the matrix, while sminv could not.   Testing showed that to keep the matrix positive definite; it is necessary to make w and R quadruple and multiple precision.  The results and code are in MatInvSA/tsminvq1.zip.  This causes slight changes to all multiple precision fit routines.  There is a CHOLESKY.htm#PrecisionFlag in sminv that allows the matrix to be declared singular if there is not enough precision to proceed.  This is set to 10-12 in sminv to leave 4 digits for determining the inverse.  This flag and the w for the last set of variables are roughly in agreement.

 

Linear Dependence

            In the case that

              (3.1)

Equation (1.3) becomes

(3.2)

Linear dependence occurs when SK(xi) = SJ(xi) for some value of K ≠ J.  In the notation of (1.3),

(3.3)

A working inversion at the various precision levels, but without linear dependence is in MatInvSA\tsminvq2.zip

MatInvSA\tsminv.vfproj

            The CHOLESKY.htm#PrecisionFlag in sminv.  The linear dependence is given by

(3.4)

To reach the 10-12 flag in Sminv, e needs to be > ~10-4.  For e = 10-14, qSminv has errors in the matrix PPCCI´PPCC ~10-3.  For e = 10-15, the flag of 10-32 in qSminv causes the matrix to be declared singular.

            With e = 10-129, The inverse matrix elements were ~10259 and the last two diagonals were 0.1000732421875000E+01 and 0.9998168945312500E+00.

MPhsminv also returned an inverse, but its elements were not the same as those from MPsminv.  Code and results are in MatInvSA\tsminvq3.zip.

Speed Test

Sà SÖw, w=exp(-i)

e=10-4 all matrices invert

    10-6 sminv singular, quad inverts

    10-10 quad inverts

    10-14 quad last diagonal 0.1001953125000000E+01

    10-22 quad singular, MPhsminv and MPsminv differ in the inverse, some elements in MPh are incorrectly zero, MP inverse checks.

    10-122 last diagonal element in MPPPCC´MPPPCCI is 0.9999999999999946E+00 Code in MatInvSA\tsminvq4.zip (1.3) becomes (4.1)

This has Ndat×(N×(N-1)/2)×632 integer multiplications in the summation step

Final testing

These codes are also in MatInvSA/tsminv4.zip – uses the wpj file

e

Sminv

MPhSminv

MPSminv

10-4

Inverts AT err 0.2´10-4

Show results all agree

No detectable error

10-6

Singular

Inverse  agrees,  AT  0.875 diag

No detectable error

10-10

 

Inverse agrees      0.2E+08 diag

No detectable error

10-20

 

Precision sent elements to 0

No detectable error

10-40

 

 

No detectable error

10-60

 

 

No detectable error

10-80

 

 

No detectable error

10-120

 

 

No detectable error

10-128

 

 

Diag of 0.994E+00

10-130

 

 

Singular

 

 This last set of results also worked with the weights in double precision form MatInvSA/tsminv5.zip so that (1.3) is

(4.2)

This requires Ndat×(N×(N-1)/2)×(632+4×63) integer multiplications in the summation step, thus requiring slightly longer time.  It is included to demonstrate that only the PFA vector multiplication needs to be in multiple precision for the nearly linearly dependent inverse to be found.