We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ede817 commit f4c1ce2Copy full SHA for f4c1ce2
src/core_types.jl
@@ -235,7 +235,7 @@ See [Wahba's problem](https://en.wikipedia.org/wiki/Wahba%27s_problem) for more
235
function nearest_rotation(M::StaticMatrix{N,N}) where N
236
u, _, v = svd(M)
237
s = sign(det(u * v'))
238
- d = @SVector ones(N-1)
+ d = @SVector ones(eltype(M), N-1)
239
R = u * Diagonal(push(d,s)) * v'
240
return RotMatrix{N}(R)
241
end
test/nearest_rotation.jl
@@ -32,4 +32,11 @@
32
@test all(sort(eigvals(Symmetric(V)))[2:end] .≥ 0)
33
34
35
+ @testset "return eltype" begin
36
+ for T in (Float16, Float32, Float64)
37
+ M = @SMatrix randn(T, 3, 3)
38
+ R = nearest_rotation(M)
39
+ @test eltype(M) == eltype(R)
40
+ end
41
42
0 commit comments