File: matmul-ref.c

package info (click to toggle)
python-peachpy 0.0~git20211013.257881e-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,452 kB
  • sloc: python: 29,286; ansic: 54; makefile: 44; cpp: 31
file content (17 lines) | stat: -rw-r--r-- 330 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stddef.h>

void matmul_ref(
	const float a[restrict static 4*4],
	const float b[restrict static 4*4],
	float c[restrict static 4*4])
{
	for (size_t i = 0; i < 4; i++) {
		for (size_t j = 0; j < 4; j++) {
			float s = 0.0f;
			for (size_t k = 0; k < 4; k++) {
				s += a[i*4+k] * b[k*4+j];
			}
			c[i*4+j] = s;
		}
	}
}