From e4d20a643de1e1e404b74a8b13b76ba62125369d Mon Sep 17 00:00:00 2001 From: Jasper Date: Mon, 1 Sep 2025 20:12:18 +0200 Subject: Swap order of arguments for matrix_scale() --- matrix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'matrix.c') diff --git a/matrix.c b/matrix.c index a784308..9992bfb 100644 --- a/matrix.c +++ b/matrix.c @@ -206,7 +206,7 @@ Matrix *matrix_add(const Matrix *A, const Matrix *B) return C; } -Matrix *matrix_scale(double x, const Matrix *A) +Matrix *matrix_scale(const Matrix *A, double x) { Matrix *tmp = matrix_alloc(A->m, A->n); @@ -221,7 +221,7 @@ Matrix *matrix_scale(double x, const Matrix *A) Matrix *matrix_sub(const Matrix *A, const Matrix *B) { - return matrix_add(A, matrix_scale(-1, B)); + return matrix_add(A, matrix_scale(B, -1)); } Matrix *matrix_mult(const Matrix *A, const Matrix *B) -- cgit v1.2.3