static ref BlockMatrix <M, N, double> Mul <M, K, N>(BlockMatrix <M, K, double> A, BlockMatrix <K, N, double> B, ref BlockMatrix <M, N, double> X) where M : ITypeNat, new() where K : ITypeNat, new() where N : ITypeNat, new() { var m = nati <M>(); var n = nati <N>(); for (var i = 0; i < m; i++) { var row = A.GetRow(i); for (var j = 0; j < n; j++) { var col = B.GetCol(j); X[i, j] = Dot(row, col); } } return(ref X); }