Accord.Math.Matrix.Divide C# (CSharp) Метод

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

Divides two matrices by multiplying A by the inverse of B.
public static Divide ( this a, decimal b, bool leastSquares = false ) : ].decimal[
a this The first matrix.
b decimal The second matrix (which will be inverted).
leastSquares bool True to produce a solution even if the /// is singular; false otherwise. Default is false.
Результат ].decimal[
        public static decimal[,] Divide(this decimal[,] a, decimal[,] b, bool leastSquares = false)
        {
            int rows = b.Rows();
            int cols = b.Columns();

            if (leastSquares)
            {
                return new SingularValueDecompositionD(b.Transpose(),
                       computeLeftSingularVectors: true,
                       computeRightSingularVectors: true,
                       autoTranspose: true).Solve(a.Transpose()).Transpose();
            }


            if (rows == cols && cols == a.Rows())
            {
                // Solve by LU Decomposition if matrix is square.
                return new LuDecompositionD(b, true).SolveTranspose(a);
            }
            else
            {
                if (rows <= cols)
                {
                    // Solve by QR Decomposition if not.
                    return new QrDecompositionD(b, true).SolveTranspose(a);
                }
                else
                {
                    return new SingularValueDecompositionD(b.Transpose(),
                        computeLeftSingularVectors: true,
                        computeRightSingularVectors: true,
                        autoTranspose: true).Solve(a.Transpose()).Transpose();
                }
            }
        }

Same methods

Matrix::Divide ( this a, decimal b, bool leastSquares = false ) : decimal[][]
Matrix::Divide ( this a, double b, bool leastSquares = false ) : ].double[
Matrix::Divide ( this a, double b, bool leastSquares = false ) : double[][]
Matrix::Divide ( this a, float b, bool leastSquares = false ) : ].float[
Matrix::Divide ( this a, float b, bool leastSquares = false ) : float[][]