예제 #1
0
        /// Answers the inverse of the receiver computed via the CRL algorithm.
        /// @return DhbMatrixAlgebra.SymmetricMatrix
        /// @exception ArithmeticException if the matrix is singular.
        private SymmetricMatrix CrlInverse()
        {
            if (this.Rows == 1)
            {
                return(Inverse1By1());
            }
            else if (this.Rows == 2)
            {
                return(Inverse2By2());
            }
            Matrix[]        splitMatrices = Split();
            SymmetricMatrix b1            = (SymmetricMatrix)splitMatrices[0].Inverse();
            Matrix          cb1           = splitMatrices[2].SecureProduct(b1);
            SymmetricMatrix cb1cT         = new SymmetricMatrix(
                cb1.ProductWithTransposedComponents(splitMatrices[2]));

            splitMatrices[1] = ((SymmetricMatrix)
                                splitMatrices[1]).SecureSubtract(cb1cT).Inverse();
            splitMatrices[2] = splitMatrices[1].SecureProduct(cb1);
            splitMatrices[0] = b1.SecureAdd(new SymmetricMatrix(
                                                cb1.TransposedProductComponents(splitMatrices[2])));
            return(SymmetricMatrix.Join(splitMatrices));
        }