public static func multiply3<p>(a: Matrix<R, n, m>, b: Matrix<R, m, p>) -> Matrix<R, n, p> { assert(a.cols == b.rows, "Mismatching matrix size.") return Matrix<R, n, p>(rows: a.rows, cols: b.cols, type: (a.type == b.type) ? a.type : .Default) { (i, k) -> R in var x = R.zero for j in 0..<a.cols { x = x + a[i, j] * b[j, k] } return x } }