Skip to content

Instantly share code, notes, and snippets.

View svaniksharma's full-sized avatar

Svanik Sharma svaniksharma

View GitHub Profile
@svaniksharma
svaniksharma / matrix.zig
Created May 7, 2023 05:42
Optimizing Matrix Multiplication in Zig
const std = @import("std");
const mem = std.mem;
const meta = std.meta;
const math = std.math;
const Vector = meta.Vector;
const expect = std.testing.expect;
fn generateSquareMatrix(N: usize, allocator: mem.Allocator, gen_rand: bool) ![][]f64 {
var matrix: [][]f64 = undefined;
matrix = try allocator.alloc([]f64, N);