matmul
fn matmul<A, B, C>(A a, B b) -> C
Source: compiler/src/builtin_docs/prelude/math.hy Multiplies two matrices written as nested fixed-length arrays.
a is [[T; K]; M] and b is [[T; N]; K]; the result is the row-major
product [[T; N]; M]. A mismatched inner dimension is a compile-time
error. For * as matrix multiplication, wrap the data with matrix.
Parameters#
| Name | Type |
|---|---|
a | A |
b | B |
Returns#
C
Examples#
use tests::assert;
let p = matmul([[1, 2], [3, 4]], [[5, 6], [7, 8]]);
assert!(p[0][0] == 19);
assert!(p[0][1] == 22);
assert!(p[1][0] == 43);
assert!(p[1][1] == 50);
See also#
matrixsin: Returns the sine ofx(in radians).cos: Returns the cosine ofx(in radians).tan: Returns the tangent ofx(in radians).sqrt: Returns the square root ofx.floor: Returns the largest whole number less than or equal tox, as afloat.ceil: Returns the smallest whole number greater than or equal tox, as afloat.exp: Returnseraised to the powerx.