From: yu.dongliang <18588496441@163.com> Date: Sun, 1 Sep 2024 19:42:57 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;ds=sidebyside;p=mat.git tmp --- 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; } }