Class DenseCooFieldVectorOps

java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.field_ops.DenseCooFieldVectorOps

public final class DenseCooFieldVectorOps extends Object
This class provides low level methods for computing ops between dense/sparse and sparse/dense field vectors.
  • Method Details

    • innerProduct

      public static <T extends Field<T>> T innerProduct(T[] src1, T[] src2, int[] indices, int sparseSize)
      Computes the vector inner product between a complex dense vector and a complex sparse vector.
      Parameters:
      src1 - Entries of the dense vector.
      src2 - Non-zero data of the sparse vector.
      indices - Indices of nonzero values in sparse vector.
      sparseSize - Full size of the sparse vector (i.e. total number of data including zeros).
      Returns:
      The inner product of the two vectors.
      Throws:
      IllegalArgumentException - If the number of data in the two vectors is not equivalent.
    • innerProduct

      public static <T extends Field<T>> T innerProduct(T[] src1, int[] indices, int sparseSize, T[] src2)
      Computes the vector inner product between a complex dense vector and a complex sparse vector.
      Parameters:
      src1 - Entries of the dense vector.
      indices - Indices of nonzero values in sparse vector.
      sparseSize - Full size of the sparse vector (i.e. total number of data including zeros).
      src2 - Non-zero data of the sparse vector.
      Returns:
      The inner product of the two vectors.
      Throws:
      IllegalArgumentException - If the number of data in the two vectors is not equivalent.
    • outerProduct

      public static <T extends Field<T>> void outerProduct(T[] src1, T[] src2, int[] indices, int sparseSize, T[] dest)
      Computes the vector outer product between a complex dense vector and a real sparse vector.
      Parameters:
      src1 - Entries of the dense vector.
      src2 - Non-zero data of the sparse vector.
      indices - Indices of non-zero data of sparse vector.
      sparseSize - Full size of the sparse vector including zeros.
      dest - Array to store the result of the vector outer product in. Must have length src1.length*sparseSize.
    • outerProduct

      public static <T extends Field<T>> T[] outerProduct(T[] src2, int[] indices, int sparseSize, T[] src1)
      Computes the vector outer product between a complex dense vector and a real sparse vector.
      Parameters:
      src2 - Non-zero data of the sparse vector.
      indices - Indices of non-zero data of sparse vector.
      src1 - Entries of the dense vector.
      Returns:
      The matrix resulting from the vector outer product.
    • add

      public static <T extends Field<T>> AbstractDenseFieldVector<?,?,T> add(AbstractDenseFieldVector<?,?,T> src1, AbstractCooFieldVector<?,?,?,?,T> src2)
      Computes the element-wise addition between a dense complex vector and sparse complex vectors.
      Parameters:
      src1 - Dense vector.
      src2 - Sparse vector.
      Returns:
      The result of the vector addition.
    • addEq

      public static <T extends Field<T>> void addEq(AbstractDenseFieldVector<?,?,T> src1, AbstractCooFieldVector<?,?,?,?,T> src2)
      Computes the element-wise addition between a dense complex vector and sparse complex vectors. The result is stored in the first vector.
      Parameters:
      src1 - Dense vector. Modified.
      src2 - Sparse vector.
    • sub

      public static <T extends Field<T>> AbstractDenseFieldVector<?,?,T> sub(AbstractDenseFieldVector<?,?,T> src1, AbstractCooFieldVector<?,?,?,?,T> src2)
      Subtracts a complex sparse vector from a complex dense vector.
      Parameters:
      src1 - First vector.
      src2 - Second vector.
      Returns:
      The result of the vector subtraction.
      Throws:
      IllegalArgumentException - If the vectors do not have the same shape.
    • sub

      public static <T extends Field<T>> AbstractDenseFieldVector<?,?,T> sub(AbstractCooFieldVector<?,?,?,?,T> src1, AbstractDenseFieldVector<?,?,T> src2)
      Subtracts a complex dense vector from a complex sparse vector.
      Parameters:
      src1 - Sparse vector.
      src2 - Dense vector.
      Returns:
      The result of the vector subtraction.
      Throws:
      IllegalArgumentException - If the vectors do not have the same shape.
    • subEq

      public static <T extends Field<T>> void subEq(AbstractDenseFieldVector<?,?,T> src1, AbstractCooFieldVector<?,?,?,?,T> src2)
      Computes the element-wise subtraction between a dense complex vector and sparse complex vectors. The result is stored in the first vector.
      Parameters:
      src1 - Dense vector. Modified.
      src2 - Sparse vector.
    • elemMult

      public static <T extends Field<T>> AbstractCooFieldVector<?,?,?,?,T> elemMult(AbstractDenseFieldVector<?,?,T> src1, AbstractCooFieldVector<?,?,?,?,T> src2)
      Computes the element-wise multiplication of a complex dense vector with a complex sparse vector.
      Parameters:
      src1 - Dense vector.
      src2 - Sparse vector.
      Returns:
      The result of the element-wise multiplication.
      Throws:
      IllegalArgumentException - If the two vectors are not the same size.
    • elemDiv

      public static <T extends Field<T>> AbstractCooFieldVector<?,?,?,?,T> elemDiv(AbstractCooFieldVector<?,?,?,?,T> src1, AbstractDenseFieldVector<?,?,T> src2)
      Compute the element-wise division between a complex sparse vector and a complex dense vector.
      Parameters:
      src1 - First vector in the element-wise division.
      src2 - Second vector in the element-wise division.
      Returns:
      The result of the element-wise vector division.