# NOT RUN {
x <- rray(TRUE, c(2, 2, 3))
y <- matrix(c(TRUE, FALSE))
# `TRUE` wherever `y` is broadcasted to be `TRUE`
x & y
# ---------------------------------------------------------------------------
# Behavior with edge cases
x <- rray(TRUE, c(1, 2))
# The common dim is (0, 2)
logical() & x
# You can have empty arrays with shape
# The common dim is (0, 2, 2)
y <- array(logical(), c(0, 1, 2))
x & y
# You cannot broadcast dimensions
# of 2 and 0. Following standard
# broadcasting rules, they do not
# match and neither are 1, so an
# error should be thrown
try(x & array(logical(), c(1, 0)))
# }
Run the code above in your browser using DataLab