-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Labels
Description
I hope this isn't a duplicate; I couldn't find an issue though. Here's an example:
julia> A = @SMatrix(rand(2, 2)) + im*@SMatrix(rand(2,2))
2×2 SArray{Tuple{2,2},Complex{Float64},2,4}:
0.911161+0.30874im 0.152706+0.0236032im
0.55638+0.107542im 0.175589+0.100683im
julia> B= A*A'
2×2 SArray{Tuple{2,2},Complex{Float64},2,4}:
0.949411+0.0im 0.569345+0.0625584im
0.569345-0.0625584im 0.362093+0.0im
julia> sqrt(B)
2×2 SArray{Tuple{2,2},Complex{Float64},2,4}:
0.859886+0.0im 0.455524+0.050052im
0.455524-0.050052im 0.389982+0.0im
julia> sqrt(Hermitian(B))
ERROR: setindex!(::SArray{Tuple{2,2},Complex{Float64},2,4}, value, ::Int) is not defined.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] setindex!(::SArray{Tuple{2,2},Complex{Float64},2,4}, ::Float64, ::Int64) at /Users/eh540/.julia/packages/StaticArrays/VyRz3/src/indexing.jl:3
[3] macro expansion at /Users/eh540/.julia/packages/StaticArrays/VyRz3/src/indexing.jl:51 [inlined]
[4] _setindex!_scalar at /Users/eh540/.julia/packages/StaticArrays/VyRz3/src/indexing.jl:39 [inlined]
[5] setindex! at /Users/eh540/.julia/packages/StaticArrays/VyRz3/src/indexing.jl:35 [inlined]
[6] sqrt(::Hermitian{Complex{Float64},SArray{Tuple{2,2},Complex{Float64},2,4}}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/symmetric.jl:832
[7] top-level scope at none:0
As you can see, it works without the Hermitian
wrapper, and it also works in the real case. I will just not use the Hermitian wrapper, but I thought maybe the problem should be noted somewhere.
andyferris and fipelle