Skip to content

Error when broadcasting across singleton dimension #75

@johnbcoughlin

Description

@johnbcoughlin

Using the latest version, I get garbage when broadcasting across a singleton dimension:

pkg> st StrideArrays
...
  [d1fa6d79] StrideArrays v0.1.25
julia> f = @StrideArray rand(3, 3);

julia> v = LinRange(-5, 0, 3) |> collect;

julia> ^C

julia> f .* reshape(v, (1, :))
3×3 StrideArraysCore.StaticStrideArray{Float64, 2, (1, 2), Tuple{StaticInt{3}, StaticInt{3}}, Tuple{Nothing, Nothing}, Tuple{StaticInt{1}, StaticInt{1}}, 9} with indices static(1):static(3)×static(1):static(3):
 -0.416778  -0.925133      0.0
 -0.864525   0.0           6.65141e-315
  0.0        1.05309e-314  6.31801e-314

julia> f .* reshape(v, (1, :)) == Array(f) .* reshape(v, (1, :))
false

Note the numerical garbage in the trailing rows, which seems to come from uninitialized memory.
This also occurs when broadcasting in-place; the destination will end up with stuff from uninitialized memory.

I think I have enabled boundschecking, via

StrideArraysCore.boundscheck() = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions