Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot mutate rows / columns in isolation #68

Open
glennmoy opened this issue Mar 30, 2021 · 1 comment
Open

Cannot mutate rows / columns in isolation #68

glennmoy opened this issue Mar 30, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@glennmoy
Copy link
Member

MWE

julia> M = reshape(1:9, 3, 3);

julia> p = Power(3);

julia> FeatureTransforms.apply(M, p; dims=1, inds=1)
3-element Vector{Int64}:
   1
  64
 343

julia> FeatureTransforms.apply!(M, p; dims=1, inds=1)
ERROR: indexed assignment fails for a reshaped range; consider calling collect
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] _rs_setindex!_err()
    @ Base ./reshapedarray.jl:279
  [3] setindex!(A::Base.ReshapedArray{Int64, 2, UnitRange{Int64}, Tuple{}}, val::Int64, index::Int64)
    @ Base ./reshapedarray.jl:275
  [4] setindex!
    @ ./subarray.jl:335 [inlined]
  [5] macro expansion
    @ ./multidimensional.jl:903 [inlined]
  [6] macro expansion
    @ ./cartesian.jl:64 [inlined]
  [7] _unsafe_setindex!
    @ ./multidimensional.jl:898 [inlined]
  [8] _setindex!
    @ ./multidimensional.jl:887 [inlined]
  [9] setindex!(A::SubArray{Int64, 1, Base.ReshapedArray{Int64, 2, UnitRange{Int64}, Tuple{}}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}}, true}, v::Vector{Int64}, I::Function)
    @ Base ./abstractarray.jl:1267
 [10] apply!(A::Base.ReshapedArray{Int64, 2, UnitRange{Int64}, Tuple{}}, t::Power; dims::Int64, inds::Int64, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FeatureTransforms ~/.julia/dev/FeatureTransforms/src/apply.jl:60
 [11] top-level scope
    @ REPL[23]:1
@bencottier
Copy link
Contributor

I wonder should FeatureTransforms.apply(M, p; dims=1, inds=1) return the full array in the first place? I think that would solve it.

@glennmoy glennmoy added the bug Something isn't working label Jun 18, 2021
@glennmoy glennmoy self-assigned this Jun 18, 2021
@glennmoy glennmoy removed their assignment Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants