org.jblas

## Class Solve

• ```public class Solve
extends Object```
Solving linear equations.
• ### Constructor Summary

Constructors
Constructor and Description
`Solve()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static DoubleMatrix` `pinv(DoubleMatrix A)`
Computes the pseudo-inverse.
`static FloatMatrix` `pinv(FloatMatrix A)`
Computes the pseudo-inverse.
`static DoubleMatrix` ```solve(DoubleMatrix A, DoubleMatrix B)```
Solves the linear equation A*X = B.
`static FloatMatrix` ```solve(FloatMatrix A, FloatMatrix B)```
Solves the linear equation A*X = B.
`static DoubleMatrix` ```solveLeastSquares(DoubleMatrix A, DoubleMatrix B)```
Computes the Least Squares solution for over or underdetermined linear equations A*X = B In the overdetermined case, when m > n, that is, there are more equations than variables, it computes the least squares solution of X -> ||A*X - B ||_2.
`static FloatMatrix` ```solveLeastSquares(FloatMatrix A, FloatMatrix B)```
Computes the Least Squares solution for over or underdetermined linear equations A*X = B In the overdetermined case, when m > n, that is, there are more equations than variables, it computes the least squares solution of X -> ||A*X - B ||_2.
`static DoubleMatrix` ```solvePositive(DoubleMatrix A, DoubleMatrix B)```
Solves the linear equation A*X = B for symmetric and positive definite A.
`static FloatMatrix` ```solvePositive(FloatMatrix A, FloatMatrix B)```
Solves the linear equation A*X = B for symmetric and positive definite A.
`static DoubleMatrix` ```solveSymmetric(DoubleMatrix A, DoubleMatrix B)```
Solves the linear equation A*X = B for symmetric A.
`static FloatMatrix` ```solveSymmetric(FloatMatrix A, FloatMatrix B)```
Solves the linear equation A*X = B for symmetric A.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### Solve

`public Solve()`
• ### Method Detail

• #### solve

```public static DoubleMatrix solve(DoubleMatrix A,
DoubleMatrix B)```
Solves the linear equation A*X = B.
• #### solveSymmetric

```public static DoubleMatrix solveSymmetric(DoubleMatrix A,
DoubleMatrix B)```
Solves the linear equation A*X = B for symmetric A.
• #### solvePositive

```public static DoubleMatrix solvePositive(DoubleMatrix A,
DoubleMatrix B)```
Solves the linear equation A*X = B for symmetric and positive definite A.
• #### solveLeastSquares

```public static DoubleMatrix solveLeastSquares(DoubleMatrix A,
DoubleMatrix B)```
Computes the Least Squares solution for over or underdetermined linear equations A*X = B In the overdetermined case, when m > n, that is, there are more equations than variables, it computes the least squares solution of X -> ||A*X - B ||_2. In the underdetermined case, when m < n (less equations than variables), there are infinitely many solutions and it computes the minimum norm solution.
Parameters:
`A` - an (m,n) matrix
`B` - a (m,k) matrix
Returns:
either the minimum norm or least squares solution.
• #### pinv

`public static DoubleMatrix pinv(DoubleMatrix A)`
Computes the pseudo-inverse. Note, this function uses the solveLeastSquares and might produce different numerical solutions for the underdetermined case than matlab.
Parameters:
`A` - rectangular matrix
Returns:
matrix P such that A*P*A = A and P*A*P = P.
• #### solve

```public static FloatMatrix solve(FloatMatrix A,
FloatMatrix B)```
Solves the linear equation A*X = B.
• #### solveSymmetric

```public static FloatMatrix solveSymmetric(FloatMatrix A,
FloatMatrix B)```
Solves the linear equation A*X = B for symmetric A.
• #### solvePositive

```public static FloatMatrix solvePositive(FloatMatrix A,
FloatMatrix B)```
Solves the linear equation A*X = B for symmetric and positive definite A.
• #### solveLeastSquares

```public static FloatMatrix solveLeastSquares(FloatMatrix A,
FloatMatrix B)```
Computes the Least Squares solution for over or underdetermined linear equations A*X = B In the overdetermined case, when m > n, that is, there are more equations than variables, it computes the least squares solution of X -> ||A*X - B ||_2. In the underdetermined case, when m < n (less equations than variables), there are infinitely many solutions and it computes the minimum norm solution.
Parameters:
`A` - an (m,n) matrix
`B` - a (m,k) matrix
Returns:
either the minimum norm or least squares solution.
• #### pinv

`public static FloatMatrix pinv(FloatMatrix A)`
Computes the pseudo-inverse. Note, this function uses the solveLeastSquares and might produce different numerical solutions for the underdetermined case than matlab.
Parameters:
`A` - rectangular matrix
Returns:
matrix P such that A*P*A = A and P*A*P = P.