Class RealComplexDenseCooOps

java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.real_complex.RealComplexDenseCooOps

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

    • elemDiv

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

      public static void add(Shape shape1, double[] src1, Shape shape2, Complex128[] src2, int[][] indices, Complex128[] dest)
      Computes element-wise sum between a real dense tensor to a sparse COO complex tensor.
      Parameters:
      shape1 - Shape of the first tensor.
      src1 - Entries of the first tensor.
      shape2 - Shape of the COO tensor.
      src2 - Non-zero data of the COO tensor.
      indices - Non-zero indices of the COO tensor.
      dest - Array to store the dense result of the element-wise sum. Must be at least as large as src1. May be null or the same array as src1.
      Throws:
      IllegalArgumentException - If !shape1.equals(shape2).
    • sub

      public static CTensor sub(Tensor src1, CooCTensor src2)
      Subtracts a sparse complex 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
    • elemMult

      public static CooCTensor elemMult(CTensor src1, CooTensor src2)
      Computes the element-wise multiplication between a complex dense tensor and a real sparse matrix.
      Parameters:
      src1 - First tensor in the element-wise multiplication.
      src2 - Second tensor in the element-wise multiplication.
      Returns:
      The result of element-wise multiplication.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • elemMult

      public static CooCTensor elemMult(Tensor src1, CooCTensor src2)
      Computes the element-wise multiplication between a complex dense tensor and a real sparse matrix.
      Parameters:
      src1 - First tensor in the element-wise multiplication.
      src2 - Second tensor in the element-wise multiplication.
      Returns:
      The result of element-wise multiplication.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • sub

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

      public static CTensor add(CooTensor src1, Complex128 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 CTensor sub(CooTensor src1, Complex128 b)
      Subtracts a scalar from 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 CTensor sub(CooCTensor 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.
    • add

      public static CTensor add(CooCTensor 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.