Class RealDenseTensorDot

java.lang.Object
org.flag4j.linalg.ops.TensorDot<double[]>
org.flag4j.linalg.ops.dense.real.RealDenseTensorDot

public class RealDenseTensorDot extends TensorDot<double[]>
Instances of this class can be used to compute the tensor dot product between two real dense primitive double tensors.
  • Constructor Details

    • RealDenseTensorDot

      public RealDenseTensorDot(Shape shape1, double[] src1, Shape shape2, double[] src2, int[] src1Axes, int[] src2Axes)
      Constructs a tensor dot product problem for computing the tensor contraction of two tensors over the specified set of axes. That is, computes the sum of products between the two tensors along the specified set of axes.
      Parameters:
      shape1 - Shape of the first tensor in the contraction.
      src1 - Entries of the first tensor in the contraction.
      shape2 - Shape of the second tensor in the contraction.
      src2 - Entries of the second tensor in the contraction.
      src1Axes - Axes along which to compute products for src1 tensor.
      src2Axes - Axes along which to compute products for src2 tensor.
      Throws:
      IllegalArgumentException - If src1Axes and src2Axes do not match in length, or if any of the axes are out of bounds for the corresponding tensor. Or, If the two tensors shapes do not match along the specified axes pairwise in src1Axes and src2Axes.
  • Method Details

    • compute

      public void compute(double[] dest)

      Computes this tensor dot product as specified in the constructor.

      It is recommended to use compute() over this method as it will reduce excess copying.

      Specified by:
      compute in class TensorDot<double[]>
      Parameters:
      dest - The array to store the data of the tensor resulting from this tensor dot product. The size of this array should be computed using TensorDot.getOutputSize().
    • compute

      public double[] compute()
      Computes this tensor dot product as specified in the constructor.
      Returns:
      The result of the tensor dot product problem specified in the constructor.