MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / mul

Function mul

test/matrix_multiply.cpp:11–30  ·  view source on GitHub ↗

Naively computes dst = a * b, where a is a matrix of size YxI, and b is a matrix of size IxX. The output matrix dst will be of size YxX.

Source from the content-addressed store, hash-verified

9
10// Naively computes dst = a * b, where a is a matrix of size YxI, and b is a matrix of size IxX. The output matrix dst will be of size YxX.
11void mul(float *dst, float *a, float *b, int Y, int I, int X)
12{
13 for(int y = 0; y < Y; ++y)
14 {
15 for(int x = 0; x < X; ++x)
16 {
17 float *A = a;
18 float *AEnd = a + I;
19 float *B = b + x;
20 float acc = 0.f;
21 while(A < AEnd)
22 {
23 acc += *A++ * *B;
24 B += X;
25 }
26 *dst++ = acc;
27 }
28 a += I;
29 }
30}
31
32float Sum(float *m, int A, int B)
33{

Callers 1

BenchmarkFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected