Working with matrices

Does anyone have any thoughts/advice on working with matrices in Zig? I’d be surprised if there’s a Zig implementation of a matrix library at this point, but perhaps using a C lib would be a good option? If so, there are some suggested libs at, has anyone tried any of these?

I’ve previously used Python for matrix stuff (numpy/SageMath) and Matlab back at uni, but looking to have a go in Zig.


The one big thing I wish Zig had is built in support for Vector, Matrix and Tensor data structure.
With an operator defined for Matrix Multiplication.

Then, once someone hooks BLAS / LAPCAK it will be a great language for Scientific Programming.

Namely, take some reference from FORTRAN, not only C :-).

1 Like

I’m one of those people who likes to write their own linear maths library. I’ll be sticking it on GitHub when it’s a little further along and might be of use.

Caveat: Like C, with no operator overloading, Zig code can be a little verbose for some tastes when it comes to working with vectors and matrices.

1 Like