Accord.Math.Matrix.Decompose C# (CSharp) Method

Decompose() public static method

Creates a matrix decomposition that be used to compute the solution matrix if the matrix is square or the least squares solution otherwise.
public static Decompose ( this matrix, bool leastSquares = false ) : ISolverArrayDecomposition
matrix this
leastSquares bool
return ISolverArrayDecomposition
        public static ISolverArrayDecomposition<decimal> Decompose(this decimal[][] matrix, bool leastSquares = false)
        {
            int rows = matrix.Rows();
            int cols = matrix.Columns();

            if (leastSquares)
            {
                return new JaggedSingularValueDecompositionD(matrix,
                      computeLeftSingularVectors: true,
                      computeRightSingularVectors: true,
                      autoTranspose: true);
            }

            if (rows == cols)
            {
                // Solve by LU Decomposition if matrix is square.
                return new JaggedLuDecompositionD(matrix);
            }
            else
            {
                if (cols < rows)
                {
                    // Solve by QR Decomposition if not.
                    return new JaggedQrDecompositionD(matrix);
                }
                else
                {
                    return new JaggedSingularValueDecompositionD(matrix,
                        computeLeftSingularVectors: true,
                        computeRightSingularVectors: true,
                        autoTranspose: true);
                }
            }
        }

Same methods

Matrix::Decompose ( this matrix, bool leastSquares = false ) : ISolverArrayDecomposition
Matrix::Decompose ( this matrix, bool leastSquares = false ) : ISolverArrayDecomposition
Matrix::Decompose ( this matrix, bool leastSquares = false ) : ISolverMatrixDecomposition
Matrix::Decompose ( this matrix, bool leastSquares = false ) : ISolverMatrixDecomposition
Matrix::Decompose ( this matrix, bool leastSquares = false ) : ISolverMatrixDecomposition