-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix addition of symmetric NamedDimsArray
and UniformScaling
#213
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #213 +/- ##
==========================================
+ Coverage 94.76% 94.78% +0.01%
==========================================
Files 14 14
Lines 688 690 +2
==========================================
+ Hits 652 654 +2
Misses 36 36
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
LinearAlgebra.copy_oftype
NamedDimsArray
and UniformScaling
Underlying error appears to be with julia> S = NamedDimsArray(Symmetric(rand(2,2));cols =[:A,:B], rows=[:C, :D])
2-dimensional NamedDimsArray(KeyedArray(...)) with keys:
↓ cols ∈ 2-element Vector{Symbol}
→ rows ∈ 2-element Vector{Symbol}
And data, 2×2 Symmetric{Float64, Matrix{Float64}}:
(:C) (:D)
(:A) 0.224083 0.84936
(:B) 0.84936 0.335228
julia> copyto!(S,copy(S))
ERROR: ArgumentError: Cannot set a non-diagonal index in a symmetric matrix
Stacktrace:
[1] setindex!
@ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/LinearAlgebra/src/symmetric.jl:227 [inlined]
[2] setindex!
@ ~/.julia/packages/AxisKeys/DiXQB/src/struct.jl:132 [inlined]
[3] setindex!
@ ~/.julia/packages/NamedDims/pu9Bn/src/wrapper_array.jl:185 [inlined]
[4] copyto_unaliased!(deststyle::IndexCartesian, dest::NamedDimsArray{(:cols, :rows), Float64, 2, KeyedArray{Float64, 2, Symmetric{Float64, Matrix{Float64}}, Tuple{Vector{Symbol}, Vector{Symbol}}}}, srcstyle::IndexCartesian, src::NamedDimsArray{(:cols, :rows), Float64, 2, KeyedArray{Float64, 2, Symmetric{Float64, Matrix{Float64}}, Tuple{Vector{Symbol}, Vector{Symbol}}}})
@ Base ./abstractarray.jl:1052
[5] copyto!(dest::NamedDimsArray{(:cols, :rows), Float64, 2, KeyedArray{Float64, 2, Symmetric{Float64, Matrix{Float64}}, Tuple{Vector{Symbol}, Vector{Symbol}}}}, src::NamedDimsArray{(:cols, :rows), Float64, 2, KeyedArray{Float64, 2, Symmetric{Float64, Matrix{Float64}}, Tuple{Vector{Symbol}, Vector{Symbol}}}})
@ Base ./abstractarray.jl:1018
[6] top-level scope
@ REPL[19]:1 |
# https://github.com/invenia/NamedDims.jl/issues/212 | ||
nda = NamedDimsArray{(:foo, :bar)}(Symmetric([1 2 3; 4 5 4; 3 2 1])) # Int eltype | ||
@test LinearAlgebra.copy_oftype(nda, Float64) == nda | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also (in a seperate test set) add a test for the MWE of nda + I
to avoid regression
Closes #212