From 9e2a639eb6ebc007ba5e8a724142141e82620473 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 2 Sep 2024 03:31:37 +0800 Subject: [PATCH] delete mat_mul2() --- mat.c | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/mat.c b/mat.c index c3e6ba8..e825247 100644 --- a/mat.c +++ b/mat.c @@ -173,47 +173,13 @@ void mat_mul(mat_t* m, mat_t* m0, mat_t* m1) mat_free(t1); } -void mat_mul2(mat_t* m, mat_t* m0, mat_t* m1) -{ - assert(m0->n == m1->n); - assert(m->n == m0->n); - - int i; - int j; - int k; - int n = m->n; - - mat_t* t1 = mat_alloc(0, 0, n, NULL); - - 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* d1 = t1->b->data + (j + t1->i) * t1->b->n + t1->j; - - int sum = 0; - for (k = 0; k < n; k++) { - sum += d0[k] * d1[k]; - } - - int ij = (i + m->i) * m->b->n + (j + m->j); - - m->b->data[ij] = sum; - } - } - - mat_free(t1); -} - void mat_mul_strassen(mat_t* m, mat_t* m0, mat_t* m1, int n_min) { assert(m0->n == m1->n); assert(m->n == m0->n); #if 1 if (m->n <= n_min) - return mat_mul2(m, m0, m1); + return mat_mul(m, m0, m1); #endif if (n_min < 16) printf("%s(), m->n: %d, n_min: %d\n", __func__, m->n, n_min); -- 2.25.1