Use static arrays for eigen-calculations#182
Conversation
|
Benchmark (after b4f893a) using StableRNGs, BenchmarkTools, Random, Tensors
Base.rand(rng::AbstractRNG, ::Type{TT}) where{TT<:SymmetricTensor} = TT(ntuple((_)->rand(rng), Tensors.n_components(TT)))
rng=StableRNG(1);
for dim=1:3
a=rand(rng,SymmetricTensor{2,dim})
println("dim=$dim");
@btime eigen($a);
@btime eigvals($a);
@btime eigvecs($a);
end
So there is a 5-6 % performance hit for 3-dimensional eigenvector calculation. Note on 4th order |
|
Seems like an OK performance hit to take. |
Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #182 +/- ##
==========================================
- Coverage 97.91% 97.84% -0.07%
==========================================
Files 16 16
Lines 1341 1206 -135
==========================================
- Hits 1313 1180 -133
+ Misses 28 26 -2
Continue to review full report at Codecov.
|
|
I can remove to_smatrix(::Tensor) (not used) and add test for eigvecs before it is ready for merge! |
|
Ready from my point of view now! |
Won't directly solve any issues, but rather move the responsibility of maintaining eigenvalue calculations to StaticArrays.jl
#173 and potentially #174/#175 (provided ForwardDiff 575) could be solved by this.
Gives less code base to maintain
Benchmarks to come soon...