Package org.flag4j.core.dense_base
Class DenseTensorBase<T,W,Y,D extends Serializable,X extends Number>
java.lang.Object
org.flag4j.core.TensorBase<T,T,W,W,Y,D,X>
org.flag4j.core.dense_base.DenseTensorBase<T,W,Y,D,X>
- Type Parameters:
T
- Type of this tensor.W
- Complex Tensor type.Y
- Real Tensor type.D
- Type of the storage data structure for the tensor. The common use case will be an array or list-like data structure.X
- The type of individual entry within theD
data structure
- All Implemented Interfaces:
Serializable
,DenseMixin<X>
,TensorComparisonsMixin
,TensorManipulationsMixin<T>
,TensorOperationsMixin<T,
,T, W, W, Y, X> TensorPropertiesMixin
- Direct Known Subclasses:
ComplexDenseTensorBase
,RealDenseTensorBase
public abstract class DenseTensorBase<T,W,Y,D extends Serializable,X extends Number>
extends TensorBase<T,T,W,W,Y,D,X>
implements DenseMixin<X>
This is the base class for all dense tensors.
- See Also:
-
Field Summary
Fields inherited from class org.flag4j.core.TensorBase
DEFAULT_ROUND_TO_ZERO_THRESHOLD, entries, shape
-
Constructor Summary
ModifierConstructorDescriptionprotected
DenseTensorBase
(Shape shape, D entries) Creates a dense tensor with specified entries and shape. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Computes the element-wise subtraction of two tensors of the same rank and stores the result in this tensor.protected abstract T
makeTensor
(Shape shape, D entries) Factory to create a tensor with the specified shape and size.abstract void
Computes the element-wise subtraction of two tensors of the same rank and stores the result in this tensor.abstract SparseTensorBase
<?, ?, ?, ?, ?, ?, ?> toCoo()
Converts this dense tensor to an equivalent sparse COO tensor.Methods inherited from class org.flag4j.core.TensorBase
allClose, allClose, getEntries, getRank, getSelf, getShape, sameLength, sameShape, tensorEquals, totalEntries
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.flag4j.core.dense_base.DenseMixin
addEq, addEq, subEq, subEq
Methods inherited from interface org.flag4j.core.TensorComparisonsMixin
equals, isOnes, isZeros
Methods inherited from interface org.flag4j.core.TensorManipulationsMixin
flatten, flatten, reshape, reshape, round, round, roundToZero, roundToZero, set
-
Constructor Details
-
DenseTensorBase
-
-
Method Details
-
makeTensor
-
addEq
Computes the element-wise subtraction of two tensors of the same rank and stores the result in this tensor.- Parameters:
B
- Second tensor in the subtraction.- Throws:
IllegalArgumentException
- If this tensor and B have different shapes.
-
subEq
Computes the element-wise subtraction of two tensors of the same rank and stores the result in this tensor.- Parameters:
B
- Second tensor in the subtraction.- Throws:
IllegalArgumentException
- If this tensor and B have different shapes.
-
toCoo
Converts this dense tensor to an equivalent sparse COO tensor.- Returns:
- A sparse COO tensor which is equivalent to this dense tensor.
-