Class AbstractDenseFieldTensor<T extends AbstractDenseFieldTensor<T,V>,V extends Field<V>>
java.lang.Object
org.flag4j.arrays.backend.AbstractTensor<T,V[],V>
org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringTensor<T,V>
org.flag4j.arrays.backend.ring_arrays.AbstractDenseRingTensor<T,V>
org.flag4j.arrays.backend.field_arrays.AbstractDenseFieldTensor<T,V>
- Type Parameters:
T- The type of this dense field tensor.V- The type of theFieldwhich this tensor's data belong to.U- Type of sparse tensor equivalent toT. This type parameter is required because some ops (e.g.AbstractDenseSemiringTensor.toCoo()) may result in a sparse tensor.
- All Implemented Interfaces:
Serializable,FieldTensorMixin<T,,T, V> TensorOverField<T,,T, V[], V> RingTensorMixin<T,,T, V> TensorOverRing<T,,T, V[], V> SemiringTensorMixin<T,,T, V> TensorOverSemiring<T,T, V[], V>
- Direct Known Subclasses:
CTensor,FieldTensor
public abstract class AbstractDenseFieldTensor<T extends AbstractDenseFieldTensor<T,V>,V extends Field<V>>
extends AbstractDenseRingTensor<T,V>
implements FieldTensorMixin<T,T,V>
The base class for all dense Field tensors.
The AbstractTensor.data of an AbstractDenseFieldTensor are mutable but the AbstractTensor.shape is fixed.
- See Also:
-
Field Summary
Fields inherited from class org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringTensor
zeroElementFields inherited from class org.flag4j.arrays.backend.AbstractTensor
data, rank, shape -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDenseFieldTensor(Shape shape, V[] entries) Creates a tensor with the specified data and shape. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if all data of this matrix are 'close' as defined below.booleanChecks if all data of this matrix are 'close' as defined below.Computes the element-wise quotient between two tensors.H(int... axes) Computes the conjugate transpose of this tensor.booleanisFinite()Checks if this tensor only contains finite values.booleanChecks if this tensor contains at least one infinite value.booleanisNaN()Checks if this tensor contains at least one NaN value.sqrt()Computes the element-wise square root of this tensor.Methods inherited from class org.flag4j.arrays.backend.ring_arrays.AbstractDenseRingTensor
argmaxAbs, argminAbs, H, maxAbs, minAbs, sub, subEqMethods inherited from class org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringTensor
add, addEq, argmax, argmin, copy, dataLength, elemMult, flatten, flatten, get, getZeroElement, makeLikeCooTensor, max, min, reshape, set, setZeroElement, T, T, tensorDot, tensorTr, toCoo, toCooMethods inherited from class org.flag4j.arrays.backend.AbstractTensor
getData, getRank, getShape, makeLikeTensor, reshape, sameShape, T, totalEntriesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.flag4j.arrays.backend.field_arrays.FieldTensorMixin
add, add, addEq, addEq, argmax, argmaxAbs, argmin, argminAbs, conj, div, div, divEq, divEq, isOnes, isZeros, makeEmptyDataArray, max, maxAbs, min, minAbs, mult, mult, multEq, multEq, norm, norm, prod, recip, sub, sub, subEq, subEq, sumMethods inherited from interface org.flag4j.arrays.backend.ring_arrays.TensorOverRing
abs, H, H, sub
-
Constructor Details
-
AbstractDenseFieldTensor
Creates a tensor with the specified data and shape.- Parameters:
shape- Shape of this tensor.entries- Entries of this tensor. If this tensor is dense, this specifies all data within the tensor. If this tensor is sparse, this specifies only the non-zero data of the tensor.
-
-
Method Details
-
H
Computes the conjugate transpose of this tensor. That is, conjugates and permutes the axes of this tensor so that it matches the permutation specified byaxes.- Specified by:
Hin interfaceTensorOverRing<T extends AbstractDenseFieldTensor<T,V>, T extends AbstractDenseFieldTensor<T, V>, V extends Field<V>[], V extends Field<V>> - Overrides:
Hin classAbstractDenseRingTensor<T extends AbstractDenseFieldTensor<T,V>, V extends Field<V>> - Parameters:
axes- Permutation of tensor axis. If the tensor has rankN, then this must be an array of lengthNwhich is a permutation of{0, 1, 2, ..., N-1}.- Returns:
- The conjugate transpose of this tensor with its axes permuted by the
axesarray. - Throws:
IndexOutOfBoundsException- If any element ofaxesis out of bounds for the rank of this tensor.IllegalArgumentException- Ifaxesis not a permutation of{1, 2, 3, ... N-1}.- See Also:
-
div
Computes the element-wise quotient between two tensors. -
sqrt
-
isFinite
public boolean isFinite()Checks if this tensor only contains finite values. -
isInfinite
public boolean isInfinite()Checks if this tensor contains at least one infinite value.- Specified by:
isInfinitein interfaceTensorOverField<T extends AbstractDenseFieldTensor<T,V>, T extends AbstractDenseFieldTensor<T, V>, V extends Field<V>[], V extends Field<V>> - Returns:
trueif this tensor contains at least one infinite value;falseotherwise.- See Also:
-
isNaN
public boolean isNaN()Checks if this tensor contains at least one NaN value. -
allClose
Checks if all data of this matrix are 'close' as defined below. Custom tolerances may be specified usingallClose(AbstractDenseFieldTensor, double, double).- Parameters:
b- Second tensor in the comparison.- Returns:
- True if both tensors have the same shape and all data are 'close' element-wise, i.e.
elements
xandyat the same positions in the two tensors respectively and satisfy|x-y| <= (1E-08 + 1E-05*|y|). Otherwise, returns false. - See Also:
-
allClose
Checks if all data of this matrix are 'close' as defined below.- Parameters:
b- Second tensor in the comparison.- Returns:
- True if both tensors have the same length and all data are 'close' element-wise, i.e.
elements
xandyat the same positions in the two tensors respectively and satisfy|x-y| <= (absTol + relTol*|y|). Otherwise, returns false. - See Also:
-