diff
fn diff<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 a has a non-zero cell and b has 0.
Same shape rules as intersect. The result is a Matrix of byte
cells.
Parameters#
| Name | Type |
|---|---|
a | Matrix<D> |
b | Matrix<D> |
Returns#
Matrix<M>
Examples#
use tests::assert;
let a = matrix([[1, 2], [3, 0]]);
let b = matrix([[1, 0], [0, 0]]);
let d = diff(a, b);
assert!(d[0][0] == 0 as byte);
assert!(d[0][1] == 1 as byte);
assert!(d[1][0] == 1 as byte);
assert!(d[1][1] == 0 as byte);