Add assertion for matrix multiplication
@@ -3276,6 +3276,7 @@ pub fn inv_u(u: Matrix) -> Matrix {
/// Matrix multiply back-ends
fn matmul(a: &Matrix, b: &Matrix) -> Matrix {
+ assert_eq!(a.col, b.row);
let mut c = matrix(vec![0f64; a.row * b.col], a.row, b.col, a.shape);
gemm(1f64, a, b, 0f64, &mut c);
c
