Class SemiringOps
java.lang.Object
org.flag4j.linalg.ops.common.semiring_ops.SemiringOps
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Semiring<T>>
voidadd
(T[] src, T summand, T[] dest) Sums a value to each entry of tensor.static <T extends Semiring<T>>
voidscalMult
(T[] src, T factor, T[] dest) Computes the scalar multiplication of a tensor.static <T extends Semiring<T>>
voidscalMult
(T[] src, T factor, T[] dest, int start, int stop) Computes the scalar multiplication of a tensor.
-
Method Details
-
scalMult
Computes the scalar multiplication of a tensor.- Parameters:
src
- Entries of the tensor.factor
- Scalar value to multiply.dest
- Array to store result in.- Throws:
ArrayIndexOutOfBoundsException
- Ifdest
is not at least the size ofsrc
.
-
scalMult
public static <T extends Semiring<T>> void scalMult(T[] src, T factor, T[] dest, int start, int stop) Computes the scalar multiplication of a tensor.- Parameters:
src
- Entries of the tensor.factor
- Scalar value to multiply.dest
- Array to store result in.start
- Starting index of scalar multiplication.stop
- Stopping index of scalar multiplication.- Throws:
ArrayIndexOutOfBoundsException
- Ifdest
is not the size ofsrc
.
-
add
Sums a value to each entry of tensor.- Parameters:
src
- Entries of the tensor (non-zero data if tensor is sparse).summand
- Value to sum to each entry of the tensor.dest
- Array to store result in.
-