diff options
author | Jasper | 2025-09-08 15:47:52 +0200 |
---|---|---|
committer | Jasper | 2025-09-08 15:47:52 +0200 |
commit | e99c921808989b0b242ccfa1aa6edd74871bc213 (patch) | |
tree | 55ccde8d441f556e8859febf44fe5717d22351ae | |
parent | f8d2ae65bba18ae79695111960a74507cdda0132 (diff) |
Used forward declaration in vector.h
Also added tag 'Matrix' to struct 'Matrix'. Makes forwards declaration
available for 'Matrix'.
Avoids having to import matrix.h in vector.h (and the other way around),
when accessing matrix functionality.
-rw-r--r-- | matrix.h | 2 | ||||
-rw-r--r-- | vector.c | 1 | ||||
-rw-r--r-- | vector.h | 6 |
3 files changed, 5 insertions, 4 deletions
@@ -33,7 +33,7 @@ typedef enum { MATRIX_SWAP_COLS } MatrixSwapType; -typedef struct { +typedef struct Matrix { double *xs; size_t m; size_t n; @@ -1,5 +1,6 @@ #include "vector.h" +#include "matrix.h" #include "utils.h" #include <math.h> @@ -3,8 +3,6 @@ #include <stddef.h> -#include "matrix.h" - #define vector_at(v, i) ((v)->xs[(i)]) #define vector_loop(v, i) matrix_loop((v)->mat, i) @@ -15,7 +13,9 @@ #define VECTOR_DIM_MATCH(v1, v2) ((v1)->m == (v2)->m) -typedef struct { +typedef struct Matrix Matrix; + +typedef struct Vector { double *xs; size_t m; Matrix *mat; |