Computes the solution, x, to the linear system
Ax = b.
Namespace:
CenterSpace.NMath.CoreAssembly: NMath (in NMath.dll) Version: 5.1.0.0
Syntax
| C# |
|---|
public static FloatVector Solve( FloatMatrix A, FloatVector b ) |
| Visual Basic (Declaration) |
|---|
Public Shared Function Solve ( _ A As FloatMatrix, _ b As FloatVector _ ) As FloatVector |
| Visual C++ |
|---|
public: static FloatVector^ Solve( FloatMatrix^ A, FloatVector^ b ) |
Parameters
- A
- Type: CenterSpace.NMath.Core..::.FloatMatrix
A matrix of coefficients.
- b
- Type: CenterSpace.NMath.Core..::.FloatVector
A vector to solve for. Must have the same length as the number of rows of the matrix A.
Return Value
Vector x that is the solution to Ax = b.
Remarks
Note that a FloatLUFact instance is created with each call. If you are calling
Solve() repeatedly (inside a loop, for example), and the coefficient matrix A
is not changing between calls, this is more efficient:
Examples
FloatLUFact fact = new FloatLUFact( A, false );
...
fact.Solve( b );
Exceptions
| Exception | Condition |
|---|---|
| CenterSpace.NMath.Core..::.MatrixNotSquareException | Thrown if the matrix is not square. |
| CenterSpace.NMath.Core..::.SingularMatrixException | Thrown if the matrix is singular. |
| CenterSpace.NMath.Core..::.MismatchedSizeException | Thrown if the length of b is different than the number of rows in the matrix A. |