Skip to content

Unary broadcasting identity.(a) and ComplexF64.(a) don't preserve Ones and Zeros #416

Description

@mtfishman

For example:

julia> identity.(Zeros(2))
2-element Fill{Float64}, with entries equal to 0.0

julia> identity.(Ones(2))
2-element Fill{Float64}, with entries equal to 1.0

julia> ComplexF64.(Zeros(2))
2-element Fill{ComplexF64}, with entries equal to 0.0 + 0.0im

julia> ComplexF64.(Ones(2))
2-element Fill{ComplexF64}, with entries equal to 1.0 + 0.0im

julia> complex.(Zeros(2))
2-element Fill{ComplexF64}, with entries equal to 0.0 + 0.0im

julia> complex.(Ones(2))
2-element Fill{ComplexF64}, with entries equal to 1.0 + 0.0im

julia> pkgversion(FillArrays)
v"1.13.0"

julia> versioninfo()
Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_EDITOR = code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions