Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.5 KB

README.md

File metadata and controls

45 lines (33 loc) · 1.5 KB

NullBroadcasts.jl

Docs Build docs build
Documentation dev
GHA CI gha ci
Code Coverage codecov

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.

Example

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