Fix addition of symmetric NamedDimsArray and UniformScaling - #213
Open
mjp98 wants to merge 4 commits into
Open
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_oftypeNamedDimsArray and UniformScaling
Contributor
Author
|
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 |
oxinabox
reviewed
Nov 21, 2022
| # 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 |
Member
There was a problem hiding this comment.
Let's also (in a seperate test set) add a test for the MWE of nda + I to avoid regression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #212