Class RealFieldDenseCooVectorOps

java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.real_field_ops.RealFieldDenseCooVectorOps

public final class RealFieldDenseCooVectorOps extends Object
This class provides low level methods for computing ops between a real/field dense/sparse vector and a field/real sparse/dense vector.
  • Method Details

    • inner

      public static <T extends Field<T>> T inner(double[] src1, T[] src2, int[] indices, int sparseSize)
      Computes the vector inner product between a real 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 non-zero data in the sparse vector.
      sparseSize - The size of the sparse vector (including zero data).
      Returns:
      The inner product of the two vectors.
      Throws:
      IllegalArgumentException - If the number of data in the two vectors is not equivalent.
    • inner

      public static <T extends Field<T>> T inner(T[] src1, double[] src2, int[] indices, int sparseSize)
      Computes the vector inner 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 in the sparse vector.
      sparseSize - The size of the sparse vector (including zero data).
      Returns:
      The inner product of the two vectors.
      Throws:
      IllegalArgumentException - If the number of data in the two vectors is not equivalent.
    • inner

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

      public static <T extends Field<T>> void outerProduct(T[] src1, double[] 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 zero data.
      dest - Array to store the result of the vector outer product (modified). Must have length sparseSize*src1.length.
    • outerProduct

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

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

      public static <T extends Field<T>> AbstractDenseFieldVector<?,?,T> add(AbstractDenseFieldVector<?,?,T> src1, CooVector src2)
      Adds a complex dense matrix to a real sparse matrix.
      Parameters:
      src1 - First matrix.
      src2 - Second matrix.
      Returns:
      The result of the vector addition.
      Throws:
      IllegalArgumentException - If the vectors do not have the same shape.
    • sub

      public static <T extends Field<T>> AbstractDenseFieldVector<?,?,T> sub(CooVector 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.
    • elemMult

      public static <T extends Field<T>> AbstractCooFieldVector<?,?,?,?,T> elemMult(Vector src1, AbstractCooFieldVector<?,?,?,?,T> src2)
      Computes the element-wise multiplication of a real 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.
    • elemMult

      public static <T extends Field<T>> T[] elemMult(AbstractDenseFieldVector<?,?,T> src1, CooVector src2)
      Computes the element-wise product between a dense Field vector and a real COO vector.
      Parameters:
      src1 - Dense Field vector in element-wise product.
      src2 - Real COO vector in element-wise product.
      Returns:
      The non-zero data of the element-wise product of src1 and src2.
      Throws:
      TensorShapeException - If !src1.shape.equals(src2.shape)
    • sub

      public static <T extends Field<T>> AbstractDenseFieldVector<?,?,T> sub(AbstractDenseFieldVector<?,?,T> src1, CooVector src2)
      Subtracts a real 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.
    • addEq

      public static <T extends Field<T>> void addEq(AbstractDenseFieldVector<?,?,T> src1, CooVector src2)
      Computes the vector addition between a dense complex vector and a sparse real vector. The result is stored in the first vector.
      Parameters:
      src1 - First vector to add. Also, where the result is stored.
      src2 - Second vector to add.
      Throws:
      IllegalArgumentException - If the vectors do not have the same size.
    • subEq

      public static <T extends Field<T>> void subEq(AbstractDenseFieldVector<?,?,T> src1, CooVector src2)
      Computes the vector subtraction between a dense complex vector and a real sparse vector. The result is stored in the first vector.
      Parameters:
      src1 - First vector in subtraction.
      src2 - Second vector in subtraction.
    • elemDiv

      public static <T extends Field<T>> AbstractCooFieldVector<?,?,?,?,T> elemDiv(AbstractCooFieldVector<?,?,?,?,T> src1, Vector src2)
      Compute the element-wise division between a sparse vector and a 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.