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

DoRemainder() protected method

Computes the remainder (% operator), where the result has the sign of the dividend, for the given divisor each element of the matrix.
protected DoRemainder ( 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 DoRemainder(float divisor, Matrix<float> result)
        {
            var denseResult = result as DenseMatrix;
            if (denseResult == null)
            {
                base.DoRemainder(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] %= divisor;
                }
            });
        }