projects
/
mat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9e2a639
)
tmp
master
author
yu.dongliang
<18588496441@163.com>
Sun, 1 Sep 2024 19:42:57 +0000
(
03:42
+0800)
committer
yu.dongliang
<18588496441@163.com>
Sun, 1 Sep 2024 19:42:57 +0000
(
03:42
+0800)
mat.c
patch
|
blob
|
blame
|
history
diff --git
a/mat.c
b/mat.c
index e825247261bbf6eefd0be9fa8071c23a391a316c..664641142e6d872875cea8e302181e32b5f094aa 100644
(file)
--- 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++) {
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;
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];
}
sum += d0[k] * d1[k];
}
- int ij = (i + m->i) * m->b->n + (j + m->j);
-
- m->b->data[ij] = sum;
+ d[j] = sum;
}
}
}
}