Skip to content

Commit

Permalink
Take adjoint of Q rather than transpose
Browse files Browse the repository at this point in the history
This came up in a nanosoldier run in JuliaLang/julia#46196. Transposes of Q's don't have specialized functions and fall back to `AbstractMatrix` methods, in particular in multiplication. Generic multiplication, however, is defined in terms of elementwise `getindex`, which is expensive and very slow in contrast to dense or structured matrices.
  • Loading branch information
dkarrasch authored Jul 29, 2022
1 parent cff5da0 commit 129e4df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function random_point(
) where {N}
D = Diagonal(1 .+ rand(N)) # random diagonal matrix
s = qr* randn(N, N)) # random q
return Matrix(Symmetric(s.Q * D * transpose(s.Q)))
return Matrix(Symmetric(s.Q * D * s.Q'))
end

@doc raw"""
Expand Down

0 comments on commit 129e4df

Please sign in to comment.