Ferrite-FEM / Ferrite-FEM/Tensors.jl

Implement the Cholesky decomposition

Aperta
#232 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
182
Fork
40
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Doing the Cholesky decomposition with `Tensors.jl` is significantly slower than using `StaticArrays.jl`, presumably because there is no specific code and everything is converted into a standard `Matrix`:

```julia-repl
julia> using Tensors, StaticArrays, LinearAlgebra, BenchmarkTools

julia> A = SymmetricTensor{2,2,Float64}((1.0, 2.0, 5.0))
2×2 SymmetricTensor{2, 2, Float64, 3}:
1.0 2.0
2.0 5.0

julia> B = SMatrix{2,2}(1.0, 2.0, 2.0, 5.0)
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
1.0 2.0
2.0 5.0

julia> @benchmark cholesky($A)
BenchmarkTools.Trial: 10000 samples with 992 evaluations per sample.
Range (min … max): 38.306 ns … 3.228 μs ┊ GC (min … max): 0.00% … 98.18%
Time (median): 43.557 ns ┊ GC (median): 0.00%
Time (mean ± σ): 46.372 ns ± 71.473 ns ┊ GC (mean ± σ): 6.35% ± 4.48%

▇█▆▂▂
▁▅█▇▇▇▅▄▃▃▃▄▃▃▃▄▅█████▆▄▃▃▃▃▃▃▂▂▂▂▃▃▃▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▃
38.3 ns Histogram: frequency by time 55.4 ns <

Memory estimate: 112 bytes, allocs estimate: 2.

julia> @benchmark cholesky($B)
BenchmarkTools.Trial: 10000 samples with 1000 evaluations per sample.
Range (min … max): 1.708 ns … 13.750 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.792 ns ┊ GC (median): 0.00%
Time (mean ± σ): 1.864 ns ± 0.199 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

▅ █ ▁ ▁ ▂ ▄ ▇ ▁
▅▁▁▁▁█▁▁▁▁▁█▁▁▁▁▁█▁▁▁▁▁█▁▁▁▁██▁▁▁▁█▁▁▁▁▁█▁▁▁▁▁█▁▁▁▁▁█▁▁▁▁█ █
1.71 ns Histogram: log(frequency) by time 2.12 ns <

Memory estimate: 0 bytes, allocs estimate: 0.
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.