Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test "matmul" {
- const T = i64;
- const M = 3;
- const N = 4;
- const P = 2;
- const A = [M][N]T{
- [_]T{ 1, 2, 1, -2 },
- [_]T{ -1, 3, 2, 4 },
- [_]T{ 0, 1, -1, 0 },
- };
- const B = [N][P]T{
- [_]T{ 1, 2 },
- [_]T{ -2, 1 },
- [_]T{ 3, 0 },
- [_]T{ 0, 1 },
- };
- const actual = matmul(A, B);
- const expected = [M][P]T{
- [_]T{ 0, 2 },
- [_]T{ -1, 5 },
- [_]T{ -5, 1 },
- };
- var m: u64 = 0;
- while (m < M) : (m += 1) {
- std.debug.assert(std.mem.eql(T, actual[m], expected[m]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment