#include <math.h>
#include <string.h>
#include <stdio.h>
#include "common.h"
#include "linear_algebra.h"
Go to the source code of this file.
Defines | |
#define | MAT_PRINTF(m, _r, _c) |
#define | MATRIX_EPSILON (1e-11) |
#define | VEC_PRINTF(v, _n) |
Functions | |
static int | inv2 (const double *a, double *b) |
static int | inv3 (const double *a, double *b) |
static int | inv4 (const double *a, double *b) |
void | matrix_add_sc (u32 n, u32 m, const double *a, const double *b, double gamma, double *c) |
int | matrix_ataati (u32 n, u32 m, const double *a, double *b) |
int | matrix_ataiat (u32 n, u32 m, const double *a, double *b) |
int | matrix_atawati (u32 n, u32 m, const double *a, const double *w, double *b) |
int | matrix_atwaiat (u32 n, u32 m, const double *a, const double *w, double *b) |
void | matrix_copy (u32 n, u32 m, const double *a, double *b) |
int | matrix_inverse (u32 n, const double const *a, double *b) |
void | matrix_multiply (u32 n, u32 m, u32 p, const double *a, const double *b, double *c) |
int | matrix_pseudoinverse (u32 n, u32 m, const double *a, double *b) |
void | matrix_transpose (u32 n, u32 m, const double *a, double *b) |
s32 | qrdecomp (const double *a, u32 rows, u32 cols, double *qt, double *r) |
s32 | qrdecomp_square (const double *a, u32 rows, double *qt, double *r) |
s32 | qrsolve (const double *a, u32 rows, u32 cols, const double *b, double *x) |
void | qtmult (const double *qt, u32 n, const double *b, double *x) |
static void | row_swap (double *a, double *b, u32 size) |
static int | rref (u32 order, u32 cols, double *m) |
void | rsolve (const double *r, u32 rows, u32 cols, const double *b, double *x) |
void | vector_add (u32 n, const double *a, const double *b, double *c) |
void | vector_add_sc (u32 n, const double *a, const double *b, double gamma, double *c) |
void | vector_cross (const double a[3], const double b[3], double c[3]) |
double | vector_dot (u32 n, const double *a, const double *b) |
double | vector_mean (u32 n, const double *a) |
double | vector_norm (u32 n, const double *a) |
void | vector_normalize (u32 n, double *a) |
void | vector_subtract (u32 n, const double *a, const double *b, double *c) |
#define MAT_PRINTF | ( | m, | |
_r, | |||
_c | |||
) |
{ \ printf("%s:%u <|%s|", \ __FILE__, __LINE__, #m); \ for (u32 _i = 0; _i < _r; _i++) { \ printf(" [%lf", m[_i*_c + 0]); \ for (u32 _j = 1; _j < _c; _j++) \ printf(" %lf", m[_i*_c + _j]); \ printf("]"); \ if (_r > 2 && _i < _r - 1) printf("\n\t\t\t"); \ } \ printf(">\n"); \ }
Definition at line 28 of file linear_algebra.c.
#define VEC_PRINTF | ( | v, | |
_n | |||
) |
{ \ printf("%s:%u <|%s| %lf", \ __FILE__, __LINE__, #v, v[0]); \ for (u32 _i = 1; _i < _n; _i++) printf(", %lf", v[_i]); \ printf(">\n"); \ }
Definition at line 21 of file linear_algebra.c.