Class RealSparseVectorOperations
java.lang.Object
org.flag4j.operations.sparse.coo.real.RealSparseVectorOperations
This class contains low level implementations of operations on two real sparse tensors.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Vector
Adds a real number to each entry of a sparse vector, including the zero entries.static CooVector
Computes the element-wise vector addition between two real sparse vectors.static CooVector
Computes the element-wise vector multiplication between two real sparse vectors.static double
Computes the inner product of two real sparse vectors.static Matrix
outerProduct
(CooVector src1, CooVector src2) Computes the vector outer product between two real sparse vectors.static Vector
Subtracts a real number from each entry of a sparse vector, including the zero entries.static CooVector
Computes the element-wise vector subtraction between two real sparse vectors.
-
Constructor Details
-
RealSparseVectorOperations
private RealSparseVectorOperations()
-
-
Method Details
-
add
-
sub
Subtracts a real number from each entry of a sparse vector, including the zero entries.- Parameters:
src
- Sparse vector to subtract value from.a
- Value to subtract from thesrc
sparse vector.- Returns:
- The result of subtracting the specified value from the sparse vector.
-
add
Computes the element-wise vector addition between two real sparse vectors. 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
Computes the element-wise vector subtraction between two real sparse vectors. 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
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
Computes the inner product of two real sparse vectors. 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
Computes the vector outer product between two real sparse vectors.- 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.
-