LSLib.LS.Matrix.ZeroMatrix C# (CSharp) Méthode

ZeroMatrix() public static méthode

public static ZeroMatrix ( int iRows, int iCols ) : Matrix
iRows int
iCols int
Résultat Matrix
        public static Matrix ZeroMatrix(int iRows, int iCols)       // Function generates the zero matrix
        {
            Matrix matrix = new Matrix(iRows, iCols);
            for (int i = 0; i < iRows; i++)
                for (int j = 0; j < iCols; j++)
                    matrix[i, j] = 0;
            return matrix;
        }

Usage Example

Exemple #1
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);
        }