Interface TensorOverField<T extends TensorOverField<T,U,V,W>,U extends TensorOverField<U,U,V,W>,V,W>
- Type Parameters:
T
- Type of this tensor.U
- Type of dense tensor equivalent toT
. IfT
is dense, then this should be the same type asT
. This parameter required because some ops between two sparse tensors may result in a dense tensor.V
- Storage for data of this tensor.W
- Type (or wrapper) of an element of this tensor. Should satisfy the axioms of a field as stated.
- All Superinterfaces:
TensorOverRing<T,
,U, V, W> TensorOverSemiring<T,
U, V, W>
- All Known Subinterfaces:
FieldTensorMixin<T,
U, V>
- All Known Implementing Classes:
AbstractCooFieldMatrix
,AbstractCooFieldTensor
,AbstractCooFieldVector
,AbstractCsrFieldMatrix
,AbstractDenseDoubleTensor
,AbstractDenseFieldMatrix
,AbstractDenseFieldTensor
,AbstractDenseFieldVector
,AbstractDoubleTensor
,CMatrix
,CooCMatrix
,CooCTensor
,CooCVector
,CooFieldMatrix
,CooFieldTensor
,CooFieldVector
,CooMatrix
,CooTensor
,CooVector
,CsrCMatrix
,CsrFieldMatrix
,CsrMatrix
,CTensor
,CVector
,FieldMatrix
,FieldTensor
,FieldVector
,Matrix
,Tensor
,Vector
public interface TensorOverField<T extends TensorOverField<T,U,V,W>,U extends TensorOverField<U,U,V,W>,V,W>
extends TensorOverRing<T,U,V,W>
This interface specifies methods which any tensor whose data are elements of a field should implement.
This includes primitive values.
To allow for primitive types, the elements of this tensor do not necessarily have to implement
Field
.
Formally, a field is a set F with the binary ops addition (+) and multiplication (*) defined such that for elements a, b, c in F the following are satisfied:
- Addition and multiplication are associative: a + (b + c) = (a + b) + c and a * (b * c) = (a * b) * c.
- Addition and multiplication are commutative: a + b = b + a and a * b = b * a
- Existence of additive and multiplicative identities: There exists two distinct elements 0 and 1 in F such that a + 0 = 0 and a * 1 = 1 (called the additive and multiplicative identities respectively).
- Existence of additive inverse: There exists an element -a in F such that a + (-a) = 0.
- Existence of multiplicative inverse: There exists an element a-1 in F such that a * a-1 = 1.
- Distributivity of multiplication over addition: a * (b + c) = (a * b) + (a * c).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionadd
(double b) Adds a primitive scalar value to each entry of this tensor.void
addEq
(double b) Adds a primitive scalar value to each entry of this tensor and stores the result in this tensor.div
(double b) Divides each element of this tensor by a primitive scalar value.Computes the element-wise quotient between two tensors.Divides each element of this tensor by a scalar value.void
divEq
(double b) Divides each element of this tensor by a primitive scalar value and stores the result in this tensor.void
Divides each element of this tensor by a scalar value and stores the result in this tensor.boolean
isFinite()
Checks if this tensor only contains finite values.boolean
Checks if this tensor contains at least one infinite value.boolean
isNaN()
Checks if this tensor contains at least one NaN value.mult
(double b) Multiplies a primitive scalar value to each entry of this tensor.void
multEq
(double b) Multiplies a primitive scalar value to each entry of this tensor and stores the result in this tensor.recip()
Computes the element-wise reciprocals of this tensor.sqrt()
Computes the element-wise square root of this tensor.sub
(double b) Subtracts a primitive scalar value from each entry of this tensor.void
subEq
(double b) Subtracts a scalar primitive value from each entry of this tensor and stores the result in this tensor.
-
Method Details
-
add
Adds a primitive scalar value to each entry of this tensor. If the tensor is sparse, the scalar will only be added to the non-zero data of the tensor.- Parameters:
b
- Scalar field value in sum.- Returns:
- The sum of this tensor with the scalar
b
.
-
addEq
void addEq(double b) Adds a primitive scalar value to each entry of this tensor and stores the result in this tensor.- Parameters:
b
- Scalar field value in sum.
-
mult
Multiplies a primitive scalar value to each entry of this tensor.- Parameters:
b
- Scalar value in product.- Returns:
- The product of this tensor with
b
.
-
multEq
void multEq(double b) Multiplies a primitive scalar value to each entry of this tensor and stores the result in this tensor.- Parameters:
b
- Scalar value in product.
-
sub
Subtracts a primitive scalar value from each entry of this tensor.- Parameters:
b
- Scalar value in difference.- Returns:
- The difference of this tensor and the scalar
b
.
-
subEq
void subEq(double b) Subtracts a scalar primitive value from each entry of this tensor and stores the result in this tensor.- Parameters:
b
- Scalar value in difference.
-
div
-
divEq
Divides each element of this tensor by a scalar value and stores the result in this tensor.- Parameters:
b
- Scalar value in quotient.- See Also:
-
div
Divides each element of this tensor by a primitive scalar value.- Parameters:
b
- Scalar value in quotient.- Returns:
- The element-wise quotient of this tensor and the scalar
b
. - See Also:
-
divEq
void divEq(double b) Divides each element of this tensor by a primitive scalar value and stores the result in this tensor.- Parameters:
b
- Scalar value in quotient.- See Also:
-
div
-
sqrt
T sqrt()Computes the element-wise square root of this tensor.- Returns:
- The element-wise square root of this tensor.
-
recip
T recip()Computes the element-wise reciprocals of this tensor.- Returns:
- The element-wise reciprocals of this tensor.
-
isFinite
boolean isFinite()Checks if this tensor only contains finite values.- Returns:
true
if this tensor only contains finite values;false
otherwise.- See Also:
-
isInfinite
boolean isInfinite()Checks if this tensor contains at least one infinite value.- Returns:
true
if this tensor contains at least one infinite value;false
otherwise.- See Also:
-
isNaN
boolean isNaN()Checks if this tensor contains at least one NaN value.- Returns:
true
if this tensor contains at least one NaN value;false
otherwise.- See Also:
-