Class RealFieldDenseOps
java.lang.Object
org.flag4j.linalg.ops.dense.real_field_ops.RealFieldDenseOps
This class provides low level methods for computing ops with at least one real tensor
and at least one field tensor.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Field<T>>
voidadd
(double[] src, T a, T[] dest) Adds a scalar value to all data of a tensor.static <T extends Field<T>>
voidComputes the element-wise addition of two tensors.static <T extends Field<T>>
voidadd
(T[] src, double a, T[] dest) Adds a scalar value to all data of a tensor.static <T extends Field<T>>
voidComputes the element-wise division between two dense tensors.static <T extends Field<T>>
voidComputes the element-wise division between two dense tensors.static <T extends Field<T>>
voidComputes the element-wise multiplication between two dense tensors.static <T extends Field<T>>
voidscalDiv
(double[] src, T divisor, T[] dest) Computes the scalar multiplication of a tensor.static <T extends Field<T>>
voidscalDiv
(T[] src, double divisor, T[] dest) Computes the scalar division of a tensor.static <T extends Field<T>>
voidsub
(double[] src, T a, T[] dest) Subtracts a scalar value from all data of a tensor.static <T extends Field<T>>
voidComputes the element-wise subtraction of two tensors.static <T extends Field<T>>
voidComputes the element-wise subtraction of two tensors.static <T extends Field<T>>
voidsub
(T[] src, double a, T[] dest) Subtracts a scalar value from all data of a tensor.
-
Method Details
-
add
public static <T extends Field<T>> void add(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest) Computes the element-wise addition of two tensors.- Parameters:
shape1
- Shape of first tensor.src1
- Entries of first tensor.shape2
- Shape of second tensor.src2
- Entries of second tensor.Array
- to store the result of the element-wise sum in. Must be at least as long assrc1
. May be the same array assrc1
.- Throws:
TensorShapeException
- If!shape1.equals(shape2)
.
-
sub
public static <T extends Field<T>> void sub(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest) Computes the element-wise subtraction of two tensors.- Parameters:
shape1
- Shape of first tensor.src1
- Entries of first tensor.shape2
- Shape of second tensor.src2
- Entries of second tensor.dest
- Array to store the resulting element-wise difference in. Must be at lease as large assrc1
. May be the same array assrc1
.- Throws:
TensorShapeException
- If!shape1.equals(shape2)
.ArrayIndexOutOfBoundsException
- Ifsrc1.length != src2.length
-
sub
public static <T extends Field<T>> void sub(Shape shape1, double[] src1, Shape shape2, T[] src2, T[] dest) Computes the element-wise subtraction of two tensors.- Parameters:
shape1
- Shape of first tensor.src1
- Entries of first tensor.shape2
- Shape of second tensor.src2
- Entries of second tensor.dest
- Array to store the resulting element-wise difference in. Must be at lease as large assrc1
. May be the same array assrc1
.- Throws:
TensorShapeException
- If!shape1.equals(shape2)
.
-
scalDiv
Computes the scalar multiplication of a tensor.- Parameters:
src
- Entries of the tensor.divisor
- Scalar value to multiply.dest
- Array to store the result of the scalar division in. Must be at least as large assrc
. May be the same array asdest
.
-
add
Adds a scalar value to all data of a tensor.- Parameters:
src
- Entries of first tensor.a
- Scalar to add to all data of this tensor.dest
- Array to store the result of adding the scalara
tosrc
. Must be at least as large assrc
. May be the same array asdest
.
-
add
Adds a scalar value to all data of a tensor.- Parameters:
src
- Entries of first tensor.a
- Scalar to add to all data of this tensor.dest
- Array to store the result of adding the scalara
tosrc
. Must be at least as large assrc
. May be the same array asdest
.
-
sub
Subtracts a scalar value from all data of a tensor.- Parameters:
src
- Entries of first tensor.a
- Scalar to add to all data of this tensor.dest
- Array to store the result of subtracting the scalara
fromsrc
. Must be at least as large assrc
. May be the same array asdest
.
-
sub
Subtracts a scalar value from all data of a tensor.- Parameters:
src
- Entries of first tensor.a
- Scalar to add to all data of this tensor.dest
- Array to store the result of subtracting the scalara
from all data ofsrc
. Must be at least as large assrc
. May be the same array assrc
.
-
scalDiv
Computes the scalar division of a tensor.- Parameters:
src
- Entries of the tensor.divisor
- Scalar value to divide tensor by.dest
- Array to store the result of the scalar division in. Must be at least as large assrc
. May be the same array assrc
.
-
elemMult
public static <T extends Field<T>> void elemMult(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest) Computes the element-wise multiplication between two dense tensors.- Parameters:
shape1
- Shape of the first tensor in the element-wise product.src1
- Entries of the first tensor in the element-wise product.shape2
- Shape of the second tensor in the element-wise product.src2
- Entries of the second tensor in the element-wise product.dest
- Array to store the result of the element-wise product in. Must be at least as large assrc1
. May be the same arrays assrc1
.- Throws:
TensorShapeException
- If!shape1.equals(shape1)
.
-
elemDiv
public static <T extends Field<T>> void elemDiv(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest) Computes the element-wise division between two dense tensors.- Parameters:
shape1
- Shape of the first tensor in the element-wise quotient.src1
- Entries of the first tensor in the element-wise quotient.shape2
- Shape of the second tensor in the element-wise quotient.src2
- Entries of the second tensor in the element-wise quotient.dest
- Array to store the result of the element-wise quotient in.- Throws:
TensorShapeException
- If!shape1.equals(shape1)
.
-
elemDiv
public static <T extends Field<T>> void elemDiv(Shape shape1, double[] src1, Shape shape2, T[] src2, T[] dest) Computes the element-wise division between two dense tensors.- Parameters:
shape1
- Shape of the first tensor in the element-wise quotient.src1
- Entries of the first tensor in the element-wise quotient.shape2
- Shape of the second tensor in the element-wise quotient.src2
- Entries of the second tensor in the element-wise quotient.dest
- Array to store the result of the element-wise quotient in.- Throws:
TensorShapeException
- If!shape1.equals(shape1)
.
-