vector_products.h
Functions
-
sfloat slap_InnerProduct(Matrix x, Matrix y)
Calculate the inner (dot) product of two vectors.
If the vectors are of unequal length, the inner product is taken up to the shortest length.
Header File:
vector_products.h- Parameters:
x – A vector of length n
y – A vector of length n
- Returns:
Dot product of x,y. NAN if invalid.
-
sfloat slap_QuadraticForm(Matrix y, Matrix Q, Matrix x)
Calculate the scaled inner product \( y^T A x \).
Header File:
vector_products.h- Parameters:
x – A vector of length n
A – A matrix of size (n,m)
y – A vector of length m
- Returns:
The dot product, or NAN if invalid.
-
enum slap_ErrorCode slap_OuterProduct(Matrix C, Matrix x, Matrix y)
Take the outer product of two vectors.
Calculates x * y’
Header File:
vector_products.h- Parameters:
C – [out] An n x m matrix holding the result of the outer product. If either dimension is larger than the corresponding vector, the rest will be untouched.
x – [in] An n-dimensional vector
y – [in] An m-dimensional vector
- Returns:
slap return code indicating any errors
-
enum slap_ErrorCode slap_CrossProduct(Matrix z, Matrix x, Matrix y)
take the 3D cross product of 2 vectors
The vectors must all have at least length 3. If the the length is greater than three, only the first 3 elements are used.
Header File:
vector_products.h- Parameters:
z – [out] cross product vector
x – [in] first input vector
y – [in] second input vector (order matters)
- Returns:
slap return code indicating any errors