From 29bc4fb4391c421440514b2ecd075c818d4f1a43 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 2 Sep 2024 03:42:57 +0800 Subject: [PATCH] tmp --- mat.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mat.c b/mat.c index e825247..6646411 100644 --- a/mat.c +++ b/mat.c @@ -154,9 +154,10 @@ void mat_mul(mat_t* m, mat_t* m0, mat_t* m1) mat_trans(t1, m1); for (i = 0; i < n; i++) { - for (j = 0; j < n; j++) { + int* d0 = m0->b->data + (i + m0->i) * m0->b->n + m0->j; + int* d = m ->b->data + (i + m->i) * m->b->n + m->j; - int* d0 = m0->b->data + (i + m0->i) * m0->b->n + m0->j; + for (j = 0; j < n; j++) { int* d1 = t1->b->data + (j + t1->i) * t1->b->n + t1->j; int sum = 0; @@ -164,9 +165,7 @@ void mat_mul(mat_t* m, mat_t* m0, mat_t* m1) sum += d0[k] * d1[k]; } - int ij = (i + m->i) * m->b->n + (j + m->j); - - m->b->data[ij] = sum; + d[j] = sum; } } -- 2.25.1