intersect
fn intersect<D, M>(Matrix<D> a, Matrix<D> b) -> Matrix<M>
Source: compiler/src/builtin_docs/prelude/math.hy Returns a byte mask that is 1 where both matrices have a non-zero cell.
a and b must have the same shape. A cell counts as present when it is
not 0 (NaN counts as present). The result is a Matrix of byte
cells with the same shape; there is no scalar broadcast.
Parameters#
| Name | Type |
|---|---|
a | Matrix<D> |
b | Matrix<D> |
Returns#
Matrix<M>
Examples#
use tests::assert;
let a = matrix([[1, 0], [2, 3]]);
let b = matrix([[5, 6], [0, 7]]);
let m = intersect(a, b);
assert!(m[0][0] == 1 as byte);
assert!(m[0][1] == 0 as byte);
assert!(m[1][0] == 0 as byte);
assert!(m[1][1] == 1 as byte);
See also#
byteMatrixsin: 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.