Docs Build | |
Documentation | |
GHA CI | |
Code Coverage |
This package defines NullBroadcasted()
, which can be added to, subtracted
from, or multiplied by any value in a broadcast expression without incurring a
runtime performance penalty.
using NullBroadcasts: NullBroadcasted
using Test
x = [1]; y = [1]
a = NullBroadcasted()
@. x = x + a + y
@test x[1] == 2 # passes
x = [1]; y = [1]
@. x = x - a + y
@test x[1] == 2 # passes
@. x = x + (x * a) # equivalent to @. x = x
@. x = x * a # not allowed, errors
@. x = a # not allowed, errors