Skip to content

Commit ec964ef

Browse files
authored
Take adjoint of Q rather than transpose (#142)
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.
1 parent cff5da0 commit ec964ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/helpers/random.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function random_point(
135135
) where {N}
136136
D = Diagonal(1 .+ rand(N)) # random diagonal matrix
137137
s = qr* randn(N, N)) # random q
138-
return Matrix(Symmetric(s.Q * D * transpose(s.Q)))
138+
return Matrix(Symmetric(s.Q * D * s.Q'))
139139
end
140140

141141
@doc raw"""

0 commit comments

Comments
 (0)