Class RealExactTensorSolver
java.lang.Object
org.flag4j.linalg.solvers.exact.ExactTensorSolver<Tensor,Matrix,Vector>
org.flag4j.linalg.solvers.exact.RealExactTensorSolver
- All Implemented Interfaces:
LinearSolver<Tensor>
Solver for solving a real well determined linear tensor equation \( AX = B \) in an exact sense.
All indices of \( X \) are summed over in the tensor product with the rightmost indices of
\( A \) as if by
A.tensorDot(X, M, N) where
M = new int[]{X.rank()-1, X.rank(), X.rank()+1, ..., A.rank()-1} and
N = new int[]{0, 1, ..., X.rank()-1}.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an exact tensor solver for solving a well determined linear tensor equation \( AX = B \) for \( X \) in an exact sense. -
Method Summary
Modifier and TypeMethodDescriptionprotected MatrixinitMatrix(Tensor A, int prod) Initializes matrix for equivalent linear matrix equation.protected VectorinitVector(Tensor B) Initializes vector for equivalent linear matrix equation.protected TensorWraps 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 equation \( AX = B \) for \( X \) in an exact sense.
-
-
Method Details
-
initMatrix
Initializes matrix for equivalent linear matrix equation.- Specified by:
initMatrixin classExactTensorSolver<Tensor,Matrix, Vector> - Parameters:
A- Tensor to convert to matrix.prod- Product of all axis lengths inA.- Returns:
- A matrix with the same data as tensor
Awith shape (prod, prod).
-
initVector
Initializes vector for equivalent linear matrix equation.- Specified by:
initVectorin classExactTensorSolver<Tensor,Matrix, Vector> - Parameters:
B- Tensor to convert to vector.- Returns:
- Flattens tensor
Band converts to a vector.
-
wrap
Wraps solution as a tensor and reshapes to the proper shape.- Specified by:
wrapin classExactTensorSolver<Tensor,Matrix, Vector> - Parameters:
x- Vector solution to linear matrix equation which is equivalent to the tensor equation \( AX = B \).outputShape- Shape for the solution tensor \( X \).- Returns:
- The solution \( X \) to the linear tensor equation \( AX = B \).
-