source: doc/theses/mike_brooks_MMath/content/array/mdim/matmul.cfa @ 8e819a9

ADTast-experimentalenumpthread-emulationqualifiedEnum
Last change on this file since 8e819a9 was 8e819a9, checked in by Michael Brooks <mlbrooks@…>, 2 years ago

Mike MMath initial

  • Property mode set to 100644
File size: 669 bytes
Line 
1#include "array.hfa"
2
3
4// TODO: can I mini-sweeten the type overloads of -[[-,-,-]] beyond ptrdiff_t
5// so that it works with for(i; z(-))
6
7// PARK: refining the feature idea of equationally-defined operators, to include
8// declaration:  foo a = b * c;
9// meaning construct a to be b times c
10
11forall( ztype(R), ztype(C), ztype(Mid) )
12void mul( array( float, R, Mid) & srcL,
13          array( float, Mid, C) & srcR,
14          array( float, R, C ) & dst ) {
15    for (ptrdiff_t r = 0; r < z(R); r++) for (ptrdiff_t c = 0; c < z(C); c++) {
16        dst[[r,c]] = 0;
17        for (ptrdiff_t i = 0; i < z(Mid); i++)
18            dst[[r,c]] += srcL[[r,i]] * srcR[[i,c]];
19    }
20}
21
22
Note: See TracBrowser for help on using the repository browser.