binary_ops.h
Operations between two matrices.
- Author
Brian Jackson (bjack205@gmail.com)
- Copyright
Copyright (c) 2022
- Date
2023-01-30
Functions
-
sfloat slap_NormedDifference(Matrix A, Matrix B)
Return the normed difference between 2 matrices of the same size.
Returns \( \sqrt{\sum_{i=0}^{m-1} \sum_{j=0}^{n-1} (A_{ij} - B_{ij})^2 } \)
- Parameters:
A – A matrix of dimension (m,n)
B – A matrix of dimension (m,n)
- Returns:
NAN if input is invalid, normed difference otherwise
-
enum slap_ErrorCode slap_MatrixAddition(Matrix C, Matrix A, Matrix B, sfloat alpha)
Add two matrices, with scaling.
Calculates \(C = A + \alpha B\)
Matrices must all be the same size.
Any of the matrices can be aliased.
Examples
Normal matrix addition
slap_MatrixAddition(C, A, B, 1.0);
Subtract a matrix from another, in-place
slap_MatrixAddition(A, A, B, -1);
- Parameters:
C – [out] Destination matrix
A – [in] Input matrix
B – [in] Input matrix
alpha – Scaling on B