diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2021-01-14 11:09:03 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2021-01-14 11:09:03 +0100 |
commit | 7c2020e9b3347cd61250fb0dadae12c6413a748d (patch) | |
tree | 782fc4673b58a91ab654486d0b1a9a4bf30e3979 /test | |
parent | 1d265f0dd60797748d310ad84b2c4aef5ac22d3f (diff) | |
download | compcert-kvx-7c2020e9b3347cd61250fb0dadae12c6413a748d.tar.gz compcert-kvx-7c2020e9b3347cd61250fb0dadae12c6413a748d.zip |
a slightly different matrix product
Diffstat (limited to 'test')
-rw-r--r-- | test/monniaux/many_temporaries/matrix_product2.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/monniaux/many_temporaries/matrix_product2.py b/test/monniaux/many_temporaries/matrix_product2.py new file mode 100644 index 00000000..7baeb09b --- /dev/null +++ b/test/monniaux/many_temporaries/matrix_product2.py @@ -0,0 +1,24 @@ +m=4 +n=5 +p=6 +number_type='double' +with open('matrix_product2.c', 'w') as cfile: + cfile.write(f'void matrix_product({number_type} c[{m}][{p}], const {number_type} a[{m}][{n}], const {number_type} b[{n}][{p}]) {{\n') + for i in range(m): + for j in range(n): + for k in range(p): + cfile.write(f' const {number_type} p_{i}_{j}_{k} = a[{i}][{j}] * b[{j}][{k}];\n') + for i in range(m): + for k in range(p): + cfile.write(f' const {number_type} r_{i}_{k} = ') + for j in range(n): + if j>0: + cfile.write(' + ') + cfile.write(f'p_{i}_{j}_{k}') + cfile.write(';\n') + for i in range(m): + for k in range(p): + cfile.write(f' c[{i}][{k}] = r_{i}_{k};\n') + + cfile.write('}\n') + |