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>

public class RealExactTensorSolver extends ExactTensorSolver<Tensor,Matrix,Vector>

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 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

      protected Matrix initMatrix(Tensor A, int prod)
      Initializes matrix for equivalent linear matrix equation.
      Specified by:
      initMatrix in class ExactTensorSolver<Tensor,Matrix,Vector>
      Parameters:
      A - Tensor to convert to matrix.
      prod - Product of all axis lengths in A.
      Returns:
      A matrix with the same data as tensor A with shape (prod, prod).
    • initVector

      protected Vector initVector(Tensor B)
      Initializes vector for equivalent linear matrix equation.
      Specified by:
      initVector in class ExactTensorSolver<Tensor,Matrix,Vector>
      Parameters:
      B - Tensor to convert to vector.
      Returns:
      Flattens tensor B and converts to a vector.
    • wrap

      protected Tensor wrap(Vector x, Shape outputShape)
      Wraps solution as a tensor and reshapes to the proper shape.
      Specified by:
      wrap in class ExactTensorSolver<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 \).