Class RealDenseCooTensorOps

java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.real.RealDenseCooTensorOps

public class RealDenseCooTensorOps extends Object
This class contains methods to apply common binary ops to a real dense matrix and to a real sparse matrix.
  • Method Details

    • add

      public static Tensor add(Tensor src1, CooTensor src2)
      Adds a real dense tensor to a real sparse tensor.
      Parameters:
      src1 - First tensor in sum.
      src2 - Second tensor in sum.
      Returns:
      The result of the tensor addition.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • elemMult

      public static CooTensor elemMult(Tensor src1, CooTensor src2)
      Computes the element-wise multiplication between a real dense tensor and a real sparse tensor.
      Parameters:
      src1 - Real dense tensor.
      src2 - Real sparse tensor.
      Returns:
      The result of element-wise multiplication.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • elemDiv

      public static CooTensor elemDiv(CooTensor 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.
    • sub

      public static Tensor sub(Tensor src1, CooTensor src2)
      Subtracts a real sparse tensor from a real dense 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
    • sub

      public static Tensor sub(CooTensor src1, Tensor src2)
      Subtracts a real 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
    • addEq

      public static void addEq(Tensor src1, CooTensor src2)
      Adds a real dense tensor to a real sparse tensor and stores the result in the first tensor.
      Parameters:
      src1 - First tensor in sum. Also, storage of result.
      src2 - Second tensor in sum.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • subEq

      public static void subEq(Tensor src1, CooTensor src2)
      Subtracts a real sparse tensor from a real dense tensor and stores the result in the dense tensor.
      Parameters:
      src1 - First tensor in difference. Also, storage of result.
      src2 - Second tensor in difference.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • add

      public static Tensor add(CooTensor src1, double b)
      Adds a scalar to a real sparse COO tensor.
      Parameters:
      src1 - Sparse tensor in sum.
      b - Scalar in sum.
      Returns:
      A dense tensor which is the sum of src1 and b such that b is added to each element of src1.
    • sub

      public static Tensor sub(CooTensor src1, double b)
      Subtracts a scalar from each entry of a real sparse COO tensor.
      Parameters:
      src1 - Sparse tensor in difference.
      b - Scalar in difference.
      Returns:
      A dense tensor which is the difference of src1 and b such that b is subtracted from each element of src1.