Interface VectorOperationsMixin<T,U,V,W,X extends Number,TT,UU,WW>
- Type Parameters:
T
- Vector type.U
- Dense Vector type.V
- Sparse Vector type.W
- Complex Vector type.X
- Vector entry type.TT
- Matrix type equivalent.UU
- Dense Matrix type equivalent.WW
- Complex Matrix type equivalent.
- All Known Subinterfaces:
VectorMixin<T,
U, V, W, X, TT, UU, WW>
- All Known Implementing Classes:
CooCVector
,CooVector
,CVector
,Vector
-
Method Summary
Modifier and TypeMethodDescriptionComputes the element-wise addition between this vector and the specified vector.Computes the element-wise addition between this vector and the specified vector.add
(CooCVector B) Computes the element-wise addition between this vector and the specified vector.Computes the element-wise addition between this vector and the specified vector.Computes the element-wise division (Hadamard multiplication) between this vector and a specified vector.Computes the element-wise division (Hadamard multiplication) between this vector and a specified vector.Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.Computes the inner product between two vectors.Computes the inner product between two vectors.inner
(CooCVector b) Computes the inner product between two vectors.Computes the inner product between two vectors.boolean
isParallel
(Vector b) Checks if a vector is parallel to this vector.boolean
Checks if a vector is perpendicular to this vector.Joints specified vector with this vector.Joints specified vector with this vector.join
(CooCVector b) Joints specified vector with this vector.Joints specified vector with this vector.Computes a unit vector in the same direction as this vector.Computes the outer product of two vectors.Computes the outer product of two vectors.outer
(CooCVector b) Computes the outer product of two vectors.Computes the outer product of two vectors.Stacks two vectors along columns as if they were row vectors.Stacks two vectors along specified axis.Stacks two vectors along columns as if they were row vectors.Stacks two vectors along specified axis.stack
(CooCVector b) Stacks two vectors along columns as if they were row vectors.stack
(CooCVector b, int axis) Stacks two vectors along specified axis.Stacks two vectors along columns as if they were row vectors.Stacks two vectors along specified axis.Computes the element-wise subtraction between this vector and the specified vector.Computes the element-wise subtraction between this vector and the specified vector.sub
(CooCVector B) Computes the element-wise subtraction between this vector and the specified vector.Computes the element-wise subtraction between this vector and the specified vector.toMatrix()
Converts a vector to an equivalent matrix.toMatrix
(boolean columVector) Converts a vector to an equivalent matrix representing either a row or column vector.
-
Method Details
-
join
-
join
-
join
-
join
Joints specified vector with this vector.- Parameters:
b
- Vector to join with this vector.- Returns:
- A vector resulting from joining the specified vector with this vector.
-
stack
Stacks two vectors along columns as if they were row vectors.- Parameters:
b
- Vector to stack to the bottom of this vector.- Returns:
- The result of stacking this vector and vector
b
. - Throws:
IllegalArgumentException
-
- If the number of entries in this vector is different from the number of entries in the vectorb
.
-
stack
Stacks two vectors along columns as if they were row vectors.- Parameters:
b
- Vector to stack to the bottom of this vector.- Returns:
- The result of stacking this vector and vector
b
. - Throws:
IllegalArgumentException
-
- If the number of entries in this vector is different from the number of entries in the vectorb
.
-
stack
Stacks two vectors along columns as if they were row vectors.- Parameters:
b
- Vector to stack to the bottom of this vector.- Returns:
- The result of stacking this vector and vector
b
. - Throws:
IllegalArgumentException
-
- If the number of entries in this vector is different from the number of entries in the vectorb
.
-
stack
Stacks two vectors along columns as if they were row vectors.- Parameters:
b
- Vector to stack to the bottom of this vector.- Returns:
- The result of stacking this vector and vector
b
. - Throws:
IllegalArgumentException
-
- If the number of entries in this vector is different from the number of entries in the vectorb
.
-
stack
Stacks two vectors along specified axis.
Stacking two vectors of length
n
along axis 0 stacks the vectors as if they were row vectors resulting in a2-by-n
matrix.Stacking two vectors of length
n
along axis 1 stacks the vectors as if they were column vectors resulting in an-by-2
matrix.- Parameters:
b
- Vector to stack with this vector.axis
- Axis along which to stack vectors. Ifaxis=0
, then vectors are stacked as if they are row vectors. Ifaxis=1
, then vectors are stacked as if they are column vectors.- Returns:
- The result of stacking this vector and the vector
b
. - Throws:
IllegalArgumentException
- If the number of entries in this vector is different from the number of entries in the vectorb
.IllegalArgumentException
- If axis is not either 0 or 1.
-
stack
Stacks two vectors along specified axis.
Stacking two vectors of length
n
along axis 0 stacks the vectors as if they were row vectors resulting in a2-by-n
matrix.Stacking two vectors of length
n
along axis 1 stacks the vectors as if they were column vectors resulting in an-by-2
matrix.- Parameters:
b
- Vector to stack with this vector.axis
- Axis along which to stack vectors. Ifaxis=0
, then vectors are stacked as if they are row vectors. Ifaxis=1
, then vectors are stacked as if they are column vectors.- Returns:
- The result of stacking this vector and the vector
b
. - Throws:
IllegalArgumentException
- If the number of entries in this vector is different from the number of entries in the vectorb
.IllegalArgumentException
- If axis is not either 0 or 1.
-
stack
Stacks two vectors along specified axis.
Stacking two vectors of length
n
along axis 0 stacks the vectors as if they were row vectors resulting in a2-by-n
matrix.Stacking two vectors of length
n
along axis 1 stacks the vectors as if they were column vectors resulting in an-by-2
matrix.- Parameters:
b
- Vector to stack with this vector.axis
- Axis along which to stack vectors. Ifaxis=0
, then vectors are stacked as if they are row vectors. Ifaxis=1
, then vectors are stacked as if they are column vectors.- Returns:
- The result of stacking this vector and the vector
b
. - Throws:
IllegalArgumentException
- If the number of entries in this vector is different from the number of entries in the vectorb
.IllegalArgumentException
- If axis is not either 0 or 1.
-
stack
Stacks two vectors along specified axis.
Stacking two vectors of length
n
along axis 0 stacks the vectors as if they were row vectors resulting in a2-by-n
matrix.Stacking two vectors of length
n
along axis 1 stacks the vectors as if they were column vectors resulting in an-by-2
matrix.- Parameters:
b
- Vector to stack with this vector.axis
- Axis along which to stack vectors. Ifaxis=0
, then vectors are stacked as if they are row vectors. Ifaxis=1
, then vectors are stacked as if they are column vectors.- Returns:
- The result of stacking this vector and the vector
b
. - Throws:
IllegalArgumentException
- If the number of entries in this vector is different from the number of entries in the vectorb
.IllegalArgumentException
- If axis is not either 0 or 1.
-
add
Computes the element-wise addition between this vector and the specified vector.- Parameters:
B
- Vector to add to this vector.- Returns:
- The result of the element-wise vector addition.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
add
Computes the element-wise addition between this vector and the specified vector.- Parameters:
B
- Vector to add to this vector.- Returns:
- The result of the element-wise vector addition.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
add
Computes the element-wise addition between this vector and the specified vector.- Parameters:
B
- Vector to add to this vector.- Returns:
- The result of the element-wise vector addition.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
add
Computes the element-wise addition between this vector and the specified vector.- Parameters:
B
- Vector to add to this vector.- Returns:
- The result of the element-wise vector addition.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
sub
Computes the element-wise subtraction between this vector and the specified vector.- Parameters:
B
- Vector to subtract from this vector.- Returns:
- The result of the element-wise vector subtraction.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
sub
Computes the element-wise subtraction between this vector and the specified vector.- Parameters:
B
- Vector to subtract from this vector.- Returns:
- The result of the element-wise vector subtraction.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
sub
Computes the element-wise subtraction between this vector and the specified vector.- Parameters:
B
- Vector to subtract from this vector.- Returns:
- The result of the element-wise vector subtraction.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
sub
Computes the element-wise subtraction between this vector and the specified vector.- Parameters:
B
- Vector to subtract from this vector.- Returns:
- The result of the element-wise vector subtraction.
- Throws:
IllegalArgumentException
- If this vector and the specified vector have different lengths.
-
elemMult
Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.- Parameters:
B
- Vector to element-wise multiply to this vector.- Returns:
- The vector resulting from the element-wise multiplication.
- Throws:
IllegalArgumentException
- If this vector andB
do not have the same size.
-
elemMult
Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.- Parameters:
B
- Vector to element-wise multiply to this vector.- Returns:
- The vector resulting from the element-wise multiplication.
- Throws:
IllegalArgumentException
- If this vector andB
do not have the same size.
-
elemMult
Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.- Parameters:
B
- Vector to element-wise multiply to this vector.- Returns:
- The vector resulting from the element-wise multiplication.
- Throws:
IllegalArgumentException
- If this vector andB
do not have the same size.
-
elemMult
Computes the element-wise multiplication (Hadamard multiplication) between this vector and a specified vector.- Parameters:
B
- Vector to element-wise multiply to this vector.- Returns:
- The vector resulting from the element-wise multiplication.
- Throws:
IllegalArgumentException
- If this vector andB
do not have the same size.
-
elemDiv
Computes the element-wise division (Hadamard multiplication) between this vector and a specified vector.- Parameters:
B
- Vector to element-wise divide this vector by.- Returns:
- The vector resulting from the element-wise division.
- Throws:
IllegalArgumentException
- If this vector andB
do not have the same size.
-
elemDiv
Computes the element-wise division (Hadamard multiplication) between this vector and a specified vector.- Parameters:
B
- Vector to element-wise divide this vector by.- Returns:
- The vector resulting from the element-wise division.
- Throws:
IllegalArgumentException
- If this vector andB
do not have the same size.
-
inner
Computes the inner product between two vectors.- Parameters:
b
- Second vector in the inner product.- Returns:
- The inner product between this vector and the vector b.
- Throws:
IllegalArgumentException
- If this vector and vector b do not have the same number of entries.
-
inner
Computes the inner product between two vectors.- Parameters:
b
- Second vector in the inner product.- Returns:
- The inner product between this vector and the vector b.
- Throws:
IllegalArgumentException
- If this vector and vector b do not have the same number of entries.
-
normalize
T normalize()Computes a unit vector in the same direction as this vector.- Returns:
- A unit vector with the same direction as this vector. If this vector is zeros, then an equivalently sized zero vector will be returned.
-
inner
Computes the inner product between two vectors.- Parameters:
b
- Second vector in the inner product.- Returns:
- The inner product between this vector and the vector b.
- Throws:
IllegalArgumentException
- If this vector and vector b do not have the same number of entries.
-
inner
Computes the inner product between two vectors.- Parameters:
b
- Second vector in the inner product.- Returns:
- The inner product between this vector and the vector b.
- Throws:
IllegalArgumentException
- If this vector and vector b do not have the same number of entries.
-
outer
Computes the outer product of two vectors.- Parameters:
b
- Second vector in the outer product.- Returns:
- The result of the vector outer product between this vector and b.
- Throws:
IllegalArgumentException
- If the two vectors do not have the same number of entries.
-
outer
Computes the outer product of two vectors.- Parameters:
b
- Second vector in the outer product.- Returns:
- The result of the vector outer product between this vector and b.
- Throws:
IllegalArgumentException
- If the two vectors do not have the same number of entries.
-
outer
Computes the outer product of two vectors.- Parameters:
b
- Second vector in the outer product.- Returns:
- The result of the vector outer product between this vector and b.
- Throws:
IllegalArgumentException
- If the two vectors do not have the same number of entries.
-
outer
Computes the outer product of two vectors.- Parameters:
b
- Second vector in the outer product.- Returns:
- The result of the vector outer product between this vector and b.
- Throws:
IllegalArgumentException
- If the two vectors do not have the same number of entries.
-
isParallel
Checks if a vector is parallel to this vector.- Parameters:
b
- Vector to compare to this vector.- Returns:
- True if the vector
b
is parallel to this vector and the same size. Otherwise, returns false.
-
isPerp
Checks if a vector is perpendicular to this vector.- Parameters:
b
- Vector to compare to this vector.- Returns:
- True if the vector
b
is perpendicular to this vector and the same size. Otherwise, returns false.
-
toMatrix
TT toMatrix()Converts a vector to an equivalent matrix.- Returns:
- A matrix equivalent to this vector where the vector is treated as a column vector.
-
toMatrix
Converts a vector to an equivalent matrix representing either a row or column vector.- Parameters:
columVector
- Flag for choosing whether to convert this vector to a matrix representing a row or column vector.If true, the vector will be converted to a matrix representing a column vector.
If false, The vector will be converted to a matrix representing a row vector.
- Returns:
- A matrix equivalent to this vector.
-