diff options
| author | 2026-11-07 03:20:46 +0000 | |
|---|---|---|
| committer | 2026-11-07 04:21:37 +0000 | |
| commit | 556fea05affe6fe8866557d42b6c1ef6559d7880 (patch) | |
| tree | f8de5473f16e65fcbe10f280b4cf54ee7e32b5b7 /src/utils.h | |
| download | lab-01-05-556fea05affe6fe8866557d42b6c1ef6559d7880.tar.gz | |
Diffstat (limited to 'src/utils.h')
| -rw-r--r-- | src/utils.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h new file mode 100644 index 0000000..6883a16 --- /dev/null +++ b/src/utils.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #ifndef INCLUDED_UTILS_H | ||
| 2 | #define INCLUDED_UTILS_H | ||
| 3 | |||
| 4 | #include <stdlib.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | #include <gsl/gsl_spmatrix.h> | ||
| 7 | #include <assert.h> | ||
| 8 | |||
| 9 | #define MALLOC malloc | ||
| 10 | #define REALLOC realloc | ||
| 11 | #define FREE free | ||
| 12 | #define ASSERT assert | ||
| 13 | |||
| 14 | #define MIN(A, B) ({ \ | ||
| 15 | A < B ? A : B; \ | ||
| 16 | }) | ||
| 17 | |||
| 18 | #define SWAP(A, B) ({ \ | ||
| 19 | typeof (A) tmp = (A); \ | ||
| 20 | (A) = (B); \ | ||
| 21 | (B) = tmp; \ | ||
| 22 | }) | ||
| 23 | |||
| 24 | #define PRINT_EXP(EXP, FMT) printf (#EXP" = "FMT"\n", EXP) | ||
| 25 | |||
| 26 | extern void print_gsl_matrix (const gsl_matrix *); | ||
| 27 | extern void prompt (char *label, char *fmt, void *where); | ||
| 28 | extern int log10sz (size_t sz); | ||
| 29 | |||
| 30 | double gsl_matrix_determinant (const gsl_matrix *); | ||
| 31 | double gsl_matrix_cofactor (const gsl_matrix *, size_t i, size_t j); | ||
| 32 | |||
| 33 | #endif | ||
