Class RealFieldDenseCooOps
java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.real_field_ops.RealFieldDenseCooOps
This class contains methods to apply common binary ops to a real/field dense matrix and to a field/real sparse matrix.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Field<T>>
AbstractDenseFieldTensor<?, T> add
(AbstractDenseFieldTensor<?, T> src1, CooTensor src2) Adds a dense complex tensor to a real sparse tensor.static <T extends Field<T>>
voidaddEq
(AbstractDenseFieldTensor<?, T> src1, CooTensor src2) Computes element-wise addition between a complex dense tensor and a real sparse tensor.static <T extends Field<T>>
AbstractCooFieldTensor<?, ?, T> elemDiv
(AbstractCooFieldTensor<?, ?, T> src1, Tensor src2) Computes the element-wise division between a real dense tensor and a real sparse tensor.static <T extends Field<T>>
voidelemMult
(AbstractDenseFieldTensor<?, T> src1, CooTensor src2, T[] destEntries, int[][] destIndices) Computes the element-wise multiplication between a real dense tensor and a complex sparse tensor.static <T extends Field<T>>
AbstractCooFieldTensor<?, ?, T> elemMult
(Tensor src1, AbstractCooFieldTensor<?, ?, T> src2) Computes the element-wise multiplication between a real dense tensor and a complex sparse tensor.static <T extends Field<T>>
AbstractDenseFieldTensor<?, T> sub
(AbstractDenseFieldTensor<?, T> src1, CooTensor src2) Adds a dense complex tensor to a real sparse tensor.static <T extends Field<T>>
AbstractDenseFieldTensor<?, T> sub
(CooTensor src1, AbstractDenseFieldTensor<?, T> src2) Subtracts a complex dense tensor from a real sparse tensor.static <T extends Field<T>>
voidsubEq
(AbstractDenseFieldTensor<?, T> src1, CooTensor src2) Computes element-wise subtraction between a complex dense tensor and a real sparse tensor.
-
Method Details
-
elemMult
public static <T extends Field<T>> AbstractCooFieldTensor<?,?, elemMultT> (Tensor src1, AbstractCooFieldTensor<?, ?, T> src2) Computes the element-wise multiplication between a real dense tensor and a complex sparse tensor.- Parameters:
src1
- Real dense tensor.src2
- Complex sparse tensor.- Returns:
- The result of element-wise multiplication between the two tensors.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
elemMult
public static <T extends Field<T>> void elemMult(AbstractDenseFieldTensor<?, T> src1, CooTensor src2, T[] destEntries, int[][] destIndices) Computes the element-wise multiplication between a real dense tensor and a complex sparse tensor.- Parameters:
src1
- Real dense tensor.src2
- Complex sparse tensor.destEntries
- Array to store non-zero data resulting from the element-wise product. Assumed to have lengthsrc2.nnz
.destIndices
- Array to store non-zero indices resulting from the element-wise product. Assumed to have sizesrc2.nnz
-by-src2.getRank()
.- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
elemDiv
public static <T extends Field<T>> AbstractCooFieldTensor<?,?, elemDivT> (AbstractCooFieldTensor<?, ?, T> src1, Tensor src2) Computes the element-wise division between a real dense tensor and a real sparse tensor.- Parameters:
src1
- Real sparse tensor.src2
- Real dense tensor.- Returns:
- The result of element-wise division.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
add
public static <T extends Field<T>> AbstractDenseFieldTensor<?,T> add(AbstractDenseFieldTensor<?, T> src1, CooTensor src2) Adds a dense complex tensor to a real sparse tensor.- Parameters:
src1
- Complex dense tensor.src2
- Real sparse tensor.- Returns:
- The result of the tensor addition.
-
sub
public static <T extends Field<T>> AbstractDenseFieldTensor<?,T> sub(AbstractDenseFieldTensor<?, T> src1, CooTensor src2) Adds a dense complex tensor to a real sparse tensor.- Parameters:
src1
- Complex dense tensor.src2
- Real sparse tensor.- Returns:
- The result of the tensor addition.
-
addEq
Computes element-wise addition between a complex dense tensor and a real sparse tensor. The result is stored in the complex dense tensor.- Parameters:
src1
- The complex dense tensor. Also, the storage for the computation.src2
- The real sparse tensor.
-
subEq
Computes element-wise subtraction between a complex dense tensor and a real sparse tensor. The result is stored in the complex dense tensor.- Parameters:
src1
- The complex dense tensor. Also, the storage for the computation.src2
- The real sparse tensor.
-
sub
public static <T extends Field<T>> AbstractDenseFieldTensor<?,T> sub(CooTensor src1, AbstractDenseFieldTensor<?, T> src2) Subtracts a complex dense tensor from a real sparse tensor.- Parameters:
src1
- First tensor in the sum.src2
- Second tensor in the sum.- Returns:
- The result of the tensor addition.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.t
-