Package org.flag4j.linalg.solvers.exact
Class RealExactTensorSolver
java.lang.Object
org.flag4j.linalg.solvers.exact.ExactTensorSolver<Tensor,Matrix,Vector>
org.flag4j.linalg.solvers.exact.RealExactTensorSolver
- All Implemented Interfaces:
LinearTensorSolver<Tensor>
Solver for solving a real well determined linear tensor equation
A*X=B
in an exact sense.-
Constructor Summary
ConstructorDescriptionCreates an exact tensor solver for solving a well determined linear tensor equationA*X=B
forX
in an exact sense. -
Method Summary
Modifier and TypeMethodDescriptionprotected Matrix
initMatrix
(Tensor A, int prod) Initializes matrix for equivalent linear matrix equation.protected Vector
initVector
(Tensor B) Initializes vector for equivalent linear matrix equation.protected Tensor
Wraps solution as a tensor and reshapes to the proper shape.Methods inherited from class org.flag4j.linalg.solvers.exact.ExactTensorSolver
checkSize, getOutputShape, solve
-
Constructor Details
-
RealExactTensorSolver
public RealExactTensorSolver()Creates an exact tensor solver for solving a well determined linear tensor equationA*X=B
forX
in an exact sense.
-
-
Method Details
-
initMatrix
Initializes matrix for equivalent linear matrix equation.- Specified by:
initMatrix
in classExactTensorSolver<Tensor,
Matrix, Vector> - Parameters:
A
- Tensor to convert to matrix.prod
- Product of all axis lengths inA
.- Returns:
- A matrix with the same entries as tensor
A
with shape (prod, prod).
-
initVector
Initializes vector for equivalent linear matrix equation.- Specified by:
initVector
in classExactTensorSolver<Tensor,
Matrix, Vector> - Parameters:
B
- Tensor to convert to vector.- Returns:
- Flattens tensor
B
and converts to a vector.
-
wrap
Wraps solution as a tensor and reshapes to the proper shape.- Specified by:
wrap
in classExactTensorSolver<Tensor,
Matrix, Vector> - Parameters:
x
- Vector solution to matrix linear equation which is equivalent to the tensor equationA*X=B
.outputShape
- Shape for the solution tensorX
.- Returns:
- The solution
X
to the linear tensor equationA*X=B
.
-