Class RealDenseTensorDot
java.lang.Object
org.flag4j.linalg.ops.TensorDot<double[]>
org.flag4j.linalg.ops.dense.real.RealDenseTensorDot
Instances of this class can be used to compute the tensor dot product between two real dense primitive double tensors.
-
Field Summary
Fields inherited from class org.flag4j.linalg.ops.TensorDot
destLength, destShape, newShape1, newShape2, shape1, shape2, src1, src1Axes, src1Dims, src1NewAxes, src2, src2Axes, src2Dims, src2NewAxes
-
Constructor Summary
ConstructorsConstructorDescriptionRealDenseTensorDot
(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. -
Method Summary
Methods inherited from class org.flag4j.linalg.ops.TensorDot
getOutputShape, getOutputSize
-
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 forsrc1
tensor.src2Axes
- Axes along which to compute products forsrc2
tensor.- Throws:
IllegalArgumentException
- Ifsrc1Axes
andsrc2Axes
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 insrc1Axes
andsrc2Axes
.
-
-
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 classTensorDot<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 usingTensorDot.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.
-