Class RealComplexSparseVectorOps

java.lang.Object
org.flag4j.linalg.ops.sparse.coo.real_complex.RealComplexSparseVectorOps

public final class RealComplexSparseVectorOps extends Object
This class contains low level implementations of ops on a real sparse tensor and a complex sparse tensor.
  • Method Details

    • add

      public static CVector add(CooVector src, Complex128 a)
      Adds a real number to each entry of a sparse vector, including the zero data.
      Parameters:
      src - Sparse vector to add value to.
      a - Value to add to the src sparse vector.
      Returns:
      The result of adding the specified value to the sparse vector.
    • add

      public static CVector add(CooCVector src, double a)
      Adds a real number to each entry of a sparse vector, including the zero data.
      Parameters:
      src - Sparse vector to add value to.
      a - Value to add to the src sparse vector.
      Returns:
      The result of adding the specified value to the sparse vector.
    • sub

      public static CVector sub(CooVector src, Complex128 a)
      Subtracts a real number from each entry of a sparse vector, including the zero data.
      Parameters:
      src - Sparse vector to subtract value from.
      a - Value to subtract from the src sparse vector.
      Returns:
      The result of subtracting the specified value from the sparse vector.
    • add

      public static CooCVector add(CooCVector src1, CooVector src2)
      Computes the element-wise vector addition between a real sparse vector and a complex sparse vector. Both sparse vectors are assumed to have their indices sorted lexicographically.
      Parameters:
      src1 - First sparse vector in the addition. Indices assumed to be sorted lexicographically.
      src2 - Second sparse vector in the addition. Indices assumed to be sorted lexicographically.
      Returns:
      The result of the vector addition.
      Throws:
      IllegalArgumentException - If the two vectors do not have the same size (full size including zeros).
    • sub

      public static CooCVector sub(CooCVector src1, CooVector src2)
      Computes the element-wise vector subtraction between a real sparse vector and a complex sparse vector. Both sparse vectors are assumed to have their indices sorted lexicographically.
      Parameters:
      src1 - First sparse vector in the subtraction. Indices assumed to be sorted lexicographically.
      src2 - Second sparse vector in the subtraction. Indices assumed to be sorted lexicographically.
      Returns:
      The result of the vector subtraction.
      Throws:
      IllegalArgumentException - If the two vectors do not have the same size (full size including zeros).
    • sub

      public static CooCVector sub(CooVector src1, CooCVector src2)
      Computes the element-wise vector subtraction between a real sparse vector and a complex sparse vector. Both sparse vectors are assumed to have their indices sorted lexicographically.
      Parameters:
      src1 - First sparse vector in the subtraction. Indices assumed to be sorted lexicographically.
      src2 - Second sparse vector in the subtraction. Indices assumed to be sorted lexicographically.
      Returns:
      The result of the vector subtraction.
      Throws:
      IllegalArgumentException - If the two vectors do not have the same size (full size including zeros).
    • elemMult

      public static CooCVector elemMult(CooCVector src1, CooVector src2)
      Computes the element-wise vector multiplication between two real sparse vectors. Both sparse vectors are assumed to have their indices sorted lexicographically.
      Parameters:
      src1 - First sparse vector in the multiplication. Indices assumed to be sorted lexicographically.
      src2 - Second sparse vector in the multiplication. Indices assumed to be sorted lexicographically.
      Returns:
      The result of the vector multiplication.
      Throws:
      IllegalArgumentException - If the two vectors do not have the same size (full size including zeros).
    • inner

      public static Complex128 inner(CooCVector src1, CooVector src2)
      Computes the inner product of a real and complex sparse vector. Both sparse vectors are assumed to have their indices sorted lexicographically.
      Parameters:
      src1 - First sparse vector in the inner product. Indices assumed to be sorted lexicographically.
      src2 - Second sparse vector in the inner product. Indices assumed to be sorted lexicographically.
      Returns:
      The result of the vector inner product.
      Throws:
      IllegalArgumentException - If the two vectors do not have the same size (full size including zeros).
    • inner

      public static Complex128 inner(CooVector src1, CooCVector src2)
      Computes the inner product of a real and complex sparse vector. Both sparse vectors are assumed to have their indices sorted lexicographically.
      Parameters:
      src1 - First sparse vector in the inner product. Indices assumed to be sorted lexicographically.
      src2 - Second sparse vector in the inner product. Indices assumed to be sorted lexicographically.
      Returns:
      The result of the vector inner product.
      Throws:
      IllegalArgumentException - If the two vectors do not have the same size (full size including zeros).
    • outerProduct

      public static CMatrix outerProduct(CooCVector src1, CooVector src2)
      Computes the vector outer product between a complex sparse vector and a real sparse vector.
      Parameters:
      src1 - Entries of the first sparse vector in the outer product.
      src2 - Second sparse vector in the outer product.
      Returns:
      The matrix resulting from the vector outer product.
    • outerProduct

      public static CMatrix outerProduct(CooVector src1, CooCVector src2)
      Computes the vector outer product between a complex sparse vector and a real sparse vector.
      Parameters:
      src1 - Entries of the first sparse vector in the outer product.
      src2 - Second sparse vector in the outer product.
      Returns:
      The matrix resulting from the vector outer product.