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

copyto!(Eye(4), I) #206

Closed
cossio opened this issue Jan 28, 2023 · 3 comments
Closed

copyto!(Eye(4), I) #206

cossio opened this issue Jan 28, 2023 · 3 comments

Comments

@cossio
Copy link

cossio commented Jan 28, 2023

This seems like a weird error in this context. Since Eye(4) is already an I, this could just return without erroring?

julia> copyto!(Eye(4), I)
ERROR: ArgumentError: Cannot fill! with 0.0 an AbstractFill with value 1.0.
Stacktrace:
 [1] fill!
   @ ~/.julia/packages/FillArrays/xqile/src/FillArrays.jl:54 [inlined]
 [2] fillstored!
   @ ~/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/share/julia/stdlib/v1.8/LinearAlgebra/src/special.jl:356 [inlined]
 [3] fill!(A::Diagonal{Float64, Ones{Float64, 1, Tuple{Base.OneTo{Int64}}}}, x::Int64)
   @ LinearAlgebra ~/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/share/julia/stdlib/v1.8/LinearAlgebra/src/special.jl:367
 [4] copyto!(A::Diagonal{Float64, Ones{Float64, 1, Tuple{Base.OneTo{Int64}}}}, J::UniformScaling{Bool})
   @ LinearAlgebra ~/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/share/julia/stdlib/v1.8/LinearAlgebra/src/uniformscaling.jl:376
 [5] top-level scope
   @ REPL[42]:1
@dlfivefifty
Copy link
Member

trying to write to immutable arrays isn't really supported anywhere:

julia> copyto!(1:5, 1:5)
ERROR: CanonicalIndexError: setindex! not defined for UnitRange{Int64}
Stacktrace:
 [1] error_if_canonical_setindex(#unused#::IndexLinear, A::UnitRange{Int64}, #unused#::Int64)
   @ Base ./abstractarray.jl:1352
 [2] setindex!
   @ ./abstractarray.jl:1343 [inlined]
 [3] copyto_unaliased!
   @ ./abstractarray.jl:1038 [inlined]
 [4] copyto!(dest::UnitRange{Int64}, src::UnitRange{Int64})
   @ Base ./abstractarray.jl:1018
 [5] top-level scope
   @ REPL[1]:1

@jishnub
Copy link
Member

jishnub commented Jan 29, 2023

That's not really the case for AbstractFillArrays, though

julia> Fill(2, 2) .= 2
2-element Fill{Int64}, with entries equal to 2

Nonetheless, this should be fixed in LinearAlgebra rather than in this package

@dlfivefifty
Copy link
Member

Ha interesting! I suspect I added that behaviour for Infinite arrays.....but can't remember the exact details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants