summaryrefslogtreecommitdiff
path: root/matrix.h
diff options
context:
space:
mode:
authorJasper2025-09-01 20:10:12 +0200
committerJasper2025-09-01 20:10:12 +0200
commitbc4215edfd34590c8078b3bb459005807d36c5cf (patch)
treeb94cf727dbdb86e5ef0a03d20dbf1cc4ea57c0ee /matrix.h
parentb780a32d53e718328ab496c37cbb2710254da6d2 (diff)
Merge row-swap and col-swap
Diffstat (limited to 'matrix.h')
-rw-r--r--matrix.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/matrix.h b/matrix.h
index 63f1441..aa95771 100644
--- a/matrix.h
+++ b/matrix.h
@@ -16,6 +16,11 @@ typedef enum {
MATRIX_NONE
} MatrixType;
+typedef enum {
+ MATRIX_SWAP_ROWS,
+ MATRIX_SWAP_COLS
+} MatrixSwapType;
+
typedef struct {
double *xs;
size_t m;
@@ -32,10 +37,8 @@ char *matrix_to_str(const Matrix *mat);
Matrix *matrix_id(size_t n);
Matrix *matrix_const(size_t m, size_t n, double x);
Matrix *matrix_copy (const Matrix *mat);
-Matrix *matrix_swap_rows(const Matrix *mat, size_t i, size_t j);
-void matrix_swap_rows1(Matrix *mat, size_t i, size_t j);
-Matrix *matrix_swap_cols(const Matrix *mat, size_t i, size_t j);
-void matrix_swap_cols1(const Matrix *mat, size_t i, size_t j);
+Matrix *matrix_swap(const Matrix *mat, MatrixSwapType t, size_t i, size_t j);
+void matrix_swap1(Matrix *mat, MatrixSwapType t, size_t i, size_t j);
double matrix_trace(const Matrix *mat);
Matrix *matrix_transpose(const Matrix *mat);
Matrix *matrix_add(const Matrix *A, const Matrix *B);