SymbolicML / DynamicQuantities.jl

Efficient and type-stable physical quantities in Julia
https://symbolicml.org/DynamicQuantities.jl/dev/
Apache License 2.0
132 stars 17 forks source link

Add `uconvert` and chemistry example #48

Closed gaurav-arya closed 11 months ago

gaurav-arya commented 1 year ago

I was doing my chemistry homework using DynamicQuantities.jl, and thought it might make for a nice docs example! This is on top of #47, making the diff a bit noisier.

Edit: This PR now also implements uconvert, see https://github.com/SymbolicML/DynamicQuantities.jl/pull/48#discussion_r1335061100.

github-actions[bot] commented 1 year ago

Benchmark Results

main 4c3476875b4412... t[main]/t[4c3476875b4412...]
Quantity/creation/Quantity(x) 3.1 ± 0.1 ns 3.4 ± 0 ns 0.912
Quantity/creation/Quantity(x, length=y) 3.4 ± 0 ns 3.7 ± 0 ns 0.919
Quantity/with_numbers/*real 3.4 ± 0 ns 3.4 ± 0 ns 1
Quantity/with_numbers/^int 11.2 ± 3.4 ns 11.5 ± 4.1 ns 0.974
Quantity/with_numbers/^int * real 11.8 ± 3.9 ns 12.1 ± 4.3 ns 0.975
Quantity/with_quantity/+y 7.7 ± 0.001 ns 6.8 ± 0.1 ns 1.13
Quantity/with_quantity//y 4 ± 0 ns 3.7 ± 0.1 ns 1.08
Quantity/with_self/dimension 1.7 ± 0 ns 1.7 ± 0 ns 1
Quantity/with_self/inv 3.4 ± 0 ns 3.7 ± 0 ns 0.919
Quantity/with_self/ustrip 1.7 ± 0 ns 1.7 ± 0 ns 1
QuantityArray/broadcasting/multi_array_of_quantities 0.226 ± 0.025 ms 0.226 ± 0.025 ms 1
QuantityArray/broadcasting/multi_normal_array 0.0782 ± 0.005 ms 0.0762 ± 0.0018 ms 1.03
QuantityArray/broadcasting/multi_quantity_array 0.255 ± 0.0014 ms 0.255 ± 0.0013 ms 0.999
QuantityArray/broadcasting/x^2_array_of_quantities 0.0421 ± 0.0035 ms 0.0434 ± 0.0031 ms 0.97
QuantityArray/broadcasting/x^2_normal_array 9.1 ± 1.8 μs 9.3 ± 1.8 μs 0.979
QuantityArray/broadcasting/x^2_quantity_array 10 ± 1.1 μs 10 ± 1.2 μs 1
QuantityArray/broadcasting/x^4_array_of_quantities 0.133 ± 0.0035 ms 0.136 ± 0.0058 ms 0.979
QuantityArray/broadcasting/x^4_normal_array 0.0688 ± 0.0008 ms 0.0692 ± 0.0014 ms 0.994
QuantityArray/broadcasting/x^4_quantity_array 0.0981 ± 0.0028 ms 0.103 ± 0.0015 ms 0.95
time_to_load 0.169 ± 0.0017 s 0.169 ± 0.0021 s 1

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).