MathNet.Numerics.LinearAlgebra.Single.DenseMatrix.DoModulus C# (CSharp) Method

DoModulus() protected method

Computes the canonical modulus, where the result has the sign of the divisor, for the given divisor each element of the matrix.
protected DoModulus ( float divisor, Matrix result ) : void
divisor float The scalar denominator to use.
result Matrix Matrix to store the results in.
return void
        protected override void DoModulus(float divisor, Matrix<float> result)
        {
            var denseResult = result as DenseMatrix;
            if (denseResult == null)
            {
                base.DoModulus(divisor, result);
                return;
            }

            if (!ReferenceEquals(this, result))
            {
                CopyTo(result);
            }

            CommonParallel.For(0, _values.Length, (a, b) =>
            {
                var v = denseResult._values;
                for (int i = a; i < b; i++)
                {
                    v[i] = Euclid.Modulus(v[i], divisor);
                }
            });
        }