matrix
fn matrix<D>(D rows) -> Matrix<D>
Source: compiler/src/builtin_docs/prelude/math.hy Wraps nested fixed-length rows as a Matrix.
rows is nested numeric data such as [[int; 2]; 2] (or a tuple of
equal-length rows). There is no runtime cost: the Matrix is the same
data with a type that gives operators matrix meaning (see Matrix).
Parameters#
| Name | Type |
|---|---|
rows | D |
Returns#
Matrix<D>
Examples#
use tests::assert;
let a = matrix([[1, 2], [3, 4]]);
let sq = a * a;
assert!(sq[0][0] == 7);
assert!(sq[1][1] == 22);
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.