numl.Math.LinearAlgebra.Matrix.Round C# (CSharp) Метод

Round() публичный статический Метод

Matrix Roundoff.
public static Round ( Matrix m, int decimals ) : Matrix
m Matrix Input Matrix.
decimals int (Optional) Max number of decimals (default 0 - integral members)
Результат Matrix
        public static Matrix Round(Matrix m, int decimals = 0)
        {
            for (int i = 0; i < m.Rows; i++)
                for (int j = 0; j < m.Cols; j++)
                    m[i, j] = System.Math.Round(m[i, j], decimals);
            return m;
        }

Usage Example

Пример #1
0
 /// <summary>A Matrix extension method that rounds.</summary>
 /// <param name="m">Matrix.</param>
 /// <param name="decimals">(Optional) the decimals.</param>
 /// <returns>A Matrix.</returns>
 public static Matrix Round(this Matrix m, int decimals = 0)
 {
     return(Matrix.Round(m, decimals));
 }