public Matrix Invert()                                           // Function returns the inverted matrix
        {
            if (L == null)
            {
                MakeLU();
            }

            Matrix inv = new Matrix(rows, cols);

            for (int i = 0; i < rows; i++)
            {
                Matrix Ei = Matrix.ZeroMatrix(rows, 1);
                Ei[i, 0] = 1;
                Matrix col = SolveWith(Ei);
                inv.SetCol(col, i);
            }
            return(inv);
        }
示例#2
0
		public Matrix Invert()                                   // Function returns the inverted matrix
		{
			if (L == null) MakeLU();
			
			Matrix inv = new Matrix(rows, cols);
			
			for (int i = 0; i < rows; i++)
			{
				Matrix Ei = Matrix.ZeroMatrix(rows, 1);
				Ei[i, 0] = 1;
				Matrix col = SolveWith(Ei);
				inv.SetCol(col, i);
			}
			return inv;
		}