#include <math.h>#include <stdlib.h>#include <check.h>#include <stdio.h>#include "check_utils.h"#include <linear_algebra.h>
Go to the source code of this file.
Defines | |
| #define | LINALG_NUM 222 |
| #define | LINALG_TOL 1e-10 |
| #define | MAT_PRINTF(m, _r, _c) |
| #define | MATRIX_MAX 1e22 |
| #define | MATRIX_MIN -1e22 |
| #define | mrand frand(MATRIX_MIN, MATRIX_MAX) |
| #define | MSIZE_MAX 64 |
| #define | VEC_PRINTF(v, _n) |
Functions | |
| END_TEST Suite * | linear_algebra_suite (void) |
| START_TEST (test_matrix_inverse_2x2) | |
| END_TEST | START_TEST (test_matrix_inverse_3x3) |
| END_TEST | START_TEST (test_matrix_inverse_4x4) |
| END_TEST | START_TEST (test_matrix_inverse_5x5) |
| END_TEST | START_TEST (test_matrix_add_sc) |
| END_TEST | START_TEST (test_matrix_copy) |
| END_TEST | START_TEST (test_matrix_transpose) |
| END_TEST | START_TEST (test_vector_dot) |
| END_TEST | START_TEST (test_vector_mean) |
| END_TEST | START_TEST (test_vector_norm) |
| END_TEST | START_TEST (test_vector_normalize) |
| END_TEST | START_TEST (test_vector_add_sc) |
| END_TEST | START_TEST (test_vector_add) |
| END_TEST | START_TEST (test_vector_subtract) |
| END_TEST | START_TEST (test_vector_cross) |
| END_TEST | START_TEST (test_vector_three) |
| #define LINALG_NUM 222 |
Definition at line 11 of file check_linear_algebra.c.
| #define LINALG_TOL 1e-10 |
Definition at line 10 of file check_linear_algebra.c.
| #define MAT_PRINTF | ( | m, | |
| _r, | |||
| _c | |||
| ) |
{ \
printf("%s:%u <|%s|", \
__FILE__, __LINE__, #m); \
for (int _i = 0; _i < _r; _i++) { \
printf(" [%lf", m[_i*_c + 0]); \
for (int _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 24 of file check_linear_algebra.c.
| #define MATRIX_MAX 1e22 |
Definition at line 13 of file check_linear_algebra.c.
| #define MATRIX_MIN -1e22 |
Definition at line 12 of file check_linear_algebra.c.
| #define mrand frand(MATRIX_MIN, MATRIX_MAX) |
Definition at line 14 of file check_linear_algebra.c.
| #define MSIZE_MAX 64 |
Definition at line 15 of file check_linear_algebra.c.
| #define VEC_PRINTF | ( | v, | |
| _n | |||
| ) |
{ \
printf("%s:%u <|%s| %lf", \
__FILE__, __LINE__, #v, v[0]); \
for (int _i = 1; _i < _n; _i++) printf(", %lf", v[_i]); \
printf(">\n"); \
}
Definition at line 17 of file check_linear_algebra.c.
| END_TEST Suite* linear_algebra_suite | ( | void | ) |
Definition at line 508 of file check_linear_algebra.c.
| START_TEST | ( | test_matrix_inverse_2x2 | ) |
Definition at line 39 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_matrix_inverse_3x3 | ) |
Definition at line 70 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_matrix_inverse_4x4 | ) |
Definition at line 103 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_matrix_inverse_5x5 | ) |
Definition at line 138 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_matrix_add_sc | ) |
Definition at line 175 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_matrix_copy | ) |
Definition at line 197 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_matrix_transpose | ) |
Definition at line 221 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_dot | ) |
Definition at line 245 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_mean | ) |
Definition at line 278 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_norm | ) |
Definition at line 298 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_normalize | ) |
Definition at line 317 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_add_sc | ) |
Definition at line 335 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_add | ) |
Definition at line 353 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_subtract | ) |
Definition at line 373 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_cross | ) |
Definition at line 393 of file check_linear_algebra.c.
| END_TEST START_TEST | ( | test_vector_three | ) |
Definition at line 423 of file check_linear_algebra.c.