WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
linalg.h
Go to the documentation of this file.
1
10
11/******************************************************************************
12 * SYSTEM INCLUDE FILES
13 ******************************************************************************/
14
15/******************************************************************************
16 * PROJECT INCLUDE FILES
17 ******************************************************************************/
18#include "types.h"
19
20/******************************************************************************
21 * DEFINES
22 ******************************************************************************/
23
24#define MAT_ELEM(M, row, col, numrows, numcols) (M[row + col * numrows])
25#define SQRTF(x) sqrtf(x)
26
27/******************************************************************************
28 * TYPEDEFS
29 ******************************************************************************/
30
31/******************************************************************************
32 * LOCAL DATA DEFINITIONS
33 ******************************************************************************/
34
35/******************************************************************************
36 * LOCAL FUNCTION PROTOTYPES
37 ******************************************************************************/
38
39/******************************************************************************
40 * FUNCTION PROTOTYPES
41 ******************************************************************************/
42#ifndef GNCUTILS_EKF_KFCORE_LINALG_H
43#define GNCUTILS_EKF_KFCORE_LINALG_H
44
45namespace warpos {
46
47 // Constant var definitions
48 extern char CHAR_N;
49 extern char CHAR_U;
50 extern char CHAR_L;
51 extern char CHAR_R;
52 extern char CHAR_T;
53
54 /*** @brief matrix multiply C = alpha*A*B + beta*C
55 * BLAS: ?gemm
56 *
57 * @param[in] ta Supply &CHAR_T (transpose A) or &CHAR_N (don't transpose A)
58 * @param[in] tb Supply &CHAR_T (transpose B) or &CHAR_N (don't transpose B)
59 * @param[in] n Dimension n (rows of A) (dimension after transpose)
60 * @param[in] k Dimension k (cols of B) (dimension after transpose)
61 * @param[in] m Dimension m (rows of B) (dimension after transpose)
62 * @param[in] alpha Factor alpha
63 * @param[in] A Input matrix A (n x m)
64 * @param[in] B Input matrix B (m x k)
65 * @param[in] beta Factor beta
66 * @param[in/out] C Output matrix (n x k)
67 */
68 void matmul(const char* ta, const char* tb, int n, int k, int m, floating_point alpha, const floating_point* A,
69 const floating_point* B, floating_point beta, floating_point* C);
70
79 void matmulsym(const floating_point* A_sym, const floating_point* B, int n, int m, floating_point* C);
80
84 void mateye(floating_point* A, int n);
85
102 int cholesky(floating_point* A, const int n, int onlyWriteLowerPart);
103
115 void trisolve(const floating_point* A, floating_point* B, int n, int m, const char* tp);
116
128 void trisolveright(const floating_point* L, floating_point* A, int n, int m, const char* tp);
129
135 void symmetricrankupdate(floating_point* P, const floating_point* E, int n, int m);
136
149 int udu(const floating_point* A, floating_point* U, floating_point* d, const int n);
150
151}
152#endif
153
154/* @} */
Definition DeadReckon.cpp:20
void trisolve(const floating_point *A, floating_point *B, int n, int m, const char *tp)
Triangular solve BLAS: ?trsm.
Definition linalg.cpp:123
void mateye(floating_point *A, int n)
Fill array with an identity matrix.
Definition linalg.cpp:72
int udu(const floating_point *A, floating_point *U, floating_point *d, const int m)
UDU decomposition of a symmetrical n x n matrix so that A = U*D*U'.
Definition linalg.cpp:152
char CHAR_R
Definition linalg.cpp:47
void symmetricrankupdate(floating_point *P, const floating_point *E, int n, int m)
Symmetric rank update. P = P - E*E'.
Definition linalg.cpp:143
void matmul(const char *ta, const char *tb, int n, int k, int m, floating_point alpha, const floating_point *A, const floating_point *B, floating_point beta, floating_point *C)
Definition linalg.cpp:51
char CHAR_N
Definition linalg.cpp:45
void matmulsym(const floating_point *A_sym, const floating_point *B, int n, int m, floating_point *C)
Multiplication of symmetric matrix A with B: C = A*B.
Definition linalg.cpp:61
char CHAR_U
Definition linalg.cpp:46
void trisolveright(const floating_point *L, floating_point *A, int n, int m, const char *tp)
Triangular solve (right hand side). BLAS: ?trsm.
Definition linalg.cpp:133
char CHAR_L
Definition linalg.cpp:48
char CHAR_T
Definition linalg.cpp:49
int cholesky(floating_point *A, const int n, int onlyWriteLowerPart)
Calculate the lower triangular matrix L, so that L*L' = A. Operation count: n^3/6 with n square roots...
Definition linalg.cpp:81
double alpha[9]
Definition nrlmsise-00.cpp:77