1/*2* Licensed to the Apache Software Foundation (ASF) under one or more3* contributor license agreements. See the NOTICE file distributed with4* this work for additional information regarding copyright ownership.5* The ASF licenses this file to You under the Apache License, Version 2.06* (the "License"); you may not use this file except in compliance with7* the License. You may obtain a copy of the License at8*9* http://www.apache.org/licenses/LICENSE-2.010*11* Unless required by applicable law or agreed to in writing, software12* distributed under the License is distributed on an "AS IS" BASIS,13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14* See the License for the specific language governing permissions and15* limitations under the License.16*/17 18packageorg.apache.commons.math3.linear; 19 20 21 22/**23* Interface handling decomposition algorithms that can solve A × X = B.24* <p>Decomposition algorithms decompose an A matrix has a product of several specific25* matrices from which they can solve A × X = B in least squares sense: they find X26* such that ||A × X - B|| is minimal.</p>27* <p>Some solvers like {@link LUDecomposition} can only find the solution for28* square matrices and when the solution is an exact linear solution, i.e. when29* ||A × X - B|| is exactly 0. Other solvers can also find solutions30* with non-square matrix A and with non-null minimal norm. If an exact linear31* solution exists it is also the minimal norm solution.</p>32*33* @version $Id: DecompositionSolver.java 1416643 2012-12-03 19:37:14Z tn $34* @since 2.035*/36publicinterfaceDecompositionSolver { 37 38/**Solve the linear equation A × X = B for matrices A.39* <p>The A matrix is implicit, it is provided by the underlying40* decomposition algorithm.</p>41* @param b right-hand side of the equation A × X = B42* @return a vector X that minimizes the two norm of A × X - B43* @throws org.apache.commons.math3.exception.DimensionMismatchException44* if the matrices dimensions do not match.45* @throws SingularMatrixException46* if the decomposed matrix is singular.47*/48 RealVector solve(finalRealVector b); 49 50/**Solve the linear equation A × X = B for matrices A.51* <p>The A matrix is implicit, it is provided by the underlying52* decomposition algorithm.</p>53* @param b right-hand side of the equation A × X = B54* @return a matrix X that minimizes the two norm of A × X - B55* @throws org.apache.commons.math3.exception.DimensionMismatchException56* if the matrices dimensions do not match.57* @throws SingularMatrixException58* if the decomposed matrix is singular.59*/60 RealMatrix solve(finalRealMatrix b); 61 62/**63* Check if the decomposed matrix is non-singular.64* @return true if the decomposed matrix is non-singular.65*/66booleanisNonSingular(); 67 68/**Get the inverse (or pseudo-inverse) of the decomposed matrix.69* @return inverse matrix70* @throws SingularMatrixException71* if the decomposed matrix is singular.72*/73 RealMatrix getInverse(); 74 }