numl.Math.LinearAlgebra.Matrix.Zeros C# (CSharp) Method

Zeros() public static method

Initial Zero Matrix (n by n)
public static Zeros ( int n ) : Matrix
n int Size.
return Matrix
        public static Matrix Zeros(int n)
        {
            return new Matrix(n, n);
        }

Same methods

Matrix::Zeros ( int n, int d ) : Matrix

Usage Example

示例#1
0
        /// <summary>Extracts this object.</summary>
        /// <param name="m">Input Matrix.</param>
        /// <param name="x">Matrix x.</param>
        /// <param name="y">The y coordinate.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="safe">(Optional) true to safe.</param>
        /// <returns>A Matrix.</returns>
        public static Matrix Extract(Matrix m, int x, int y, int width, int height, bool safe = true)
        {
            Matrix m2 = Matrix.Zeros(height, width);

            for (int i = y; i < y + height; i++)
            {
                for (int j = x; j < x + width; j++)
                {
                    if (safe && i < m.Rows && j < m.Cols)
                    {
                        m2[i - y, j - x] = m[i, j];
                    }
                }
            }

            return(m2);
        }
All Usage Examples Of numl.Math.LinearAlgebra.Matrix::Zeros