toop_project.src.Matrix.DiagonalMatrix.LLt C# (CSharp) Method

LLt() public method

public LLt ( ) : BaseMatrix
return BaseMatrix
        public override BaseMatrix LLt()
        {
            var newal = new double[al.Length][];
            for (int i = 0; i < al.Length; i++)
                newal[i] = al[i].Clone() as double[];
            var matrPrec = new DiagonalMatrix(di.Clone() as double[], newal, newal, shift_l, shift_u);
            for (int l_diags = 0; l_diags < shift_l.Length; l_diags++)
                for (int j = 0, indl = shift_l[l_diags]; indl < al.Length; j++, indl++)
                    matrPrec.al[indl][l_diags] /= matrPrec.di[j];
            for (int i = 1; i < di.Length; i++)
            {
                double sum = 0;
                for (int k = 0; k < shift_l.Length; k++)
                    sum += matrPrec.al[i][k] * matrPrec.al[i][k];
                double newdi = matrPrec.di[i] - sum;
                matrPrec.di[i] = Math.Sqrt(newdi);
            }
            return matrPrec;
        }