aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-11-07 03:20:46 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-07 04:21:37 +0000
commit556fea05affe6fe8866557d42b6c1ef6559d7880 (patch)
treef8de5473f16e65fcbe10f280b4cf54ee7e32b5b7 /src/utils.h
downloadlab-01-05-556fea05affe6fe8866557d42b6c1ef6559d7880.tar.gz
publishHEADmaster
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h33
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
26extern void print_gsl_matrix (const gsl_matrix *);
27extern void prompt (char *label, char *fmt, void *where);
28extern int log10sz (size_t sz);
29
30double gsl_matrix_determinant (const gsl_matrix *);
31double gsl_matrix_cofactor (const gsl_matrix *, size_t i, size_t j);
32
33#endif