Open
Conversation
mcabbott
reviewed
Nov 16, 2022
Comment on lines
+355
to
+357
| # Catch issue #133 | ||
| S = wrapdims(Symmetric(rand(Int8,3,3)), 'a':'c', 10:10:30) | ||
| @test LinearAlgebra.copy_oftype(S, eltype(S)) == S |
Owner
There was a problem hiding this comment.
This test passes before the PR.
It's OK to test the exact internal function, but more important I think to test the high-level behaviour which needs it.
Contributor
Author
There was a problem hiding this comment.
Agreed, I will add a test of the high level problem.
Sorry, I think I misdiagnosed the problem, which seems to be with copyto! (which my Julia version was calling) This errors on Julia 1.6
julia> versioninfo()
Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.4.0)
CPU: Apple M1 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, westmere)
julia> S = wrapdims(Symmetric(rand(Int8,3,3)), 'a':'c', 10:10:30)
2-dimensional KeyedArray(...) with keys:
↓ 3-element StepRange{Char,...}
→ 3-element StepRange{Int64,...}
And data, 3×3 Symmetric{Int8, Matrix{Int8}}:
(10) (20) (30)
('a') -37 -122 -2
('b') -122 90 -117
('c') -2 -117 -12
julia> A = copy(S)
2-dimensional KeyedArray(...) with keys:
↓ 3-element StepRange{Char,...}
→ 3-element StepRange{Int64,...}
And data, 3×3 Symmetric{Int8, Matrix{Int8}}:
(10) (20) (30)
('a') -37 -122 -2
('b') -122 90 -117
('c') -2 -117 -12
julia> copyto!(A, S)
ERROR: ArgumentError: Cannot set a non-diagonal index in a symmetric matrix
Stacktrace:
[1] setindex!
@ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/symmetric.jl:225 [inlined]
[2] setindex!
@ ~/.julia/packages/AxisKeys/DiXQB/src/struct.jl:132 [inlined]
[3] copyto_unaliased!(deststyle::IndexCartesian, dest::KeyedArray{Int8, 2, Symmetric{Int8, Matrix{Int8}}, Tuple{StepRange{Char, Int64}, StepRange{Int64, Int64}}}, srcstyle::IndexCartesian, src::KeyedArray{Int8, 2, Symmetric{Int8, Matrix{Int8}}, Tuple{StepRange{Char, Int64}, StepRange{Int64, Int64}}})
@ Base ./abstractarray.jl:984
[4] copyto!(dest::KeyedArray{Int8, 2, Symmetric{Int8, Matrix{Int8}}, Tuple{StepRange{Char, Int64}, StepRange{Int64, Int64}}}, src::KeyedArray{Int8, 2, Symmetric{Int8, Matrix{Int8}}, Tuple{StepRange{Char, Int64}, StepRange{Int64, Int64}}})
@ Base ./abstractarray.jl:950
[5] top-level scope
@ REPL[14]:1
julia> @which copyto!(A, S)
copyto!(dest::AbstractArray, src::AbstractArray) in Base at abstractarray.jl:947
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 #133