SymbolicML / DynamicQuantities.jl

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

Add `webers`, `henry`, and `siemens` #115

Closed ven-k closed 4 months ago

ven-k commented 4 months ago

These are quite commonly used units and will be useful to house them in here.

I didn't see any testset for derived units. LMK if & how I should add tests for these four.

github-actions[bot] commented 4 months ago

Benchmark Results

main 7de3150917a61c... t[main]/t[7de3150917a61c...]
Quantity/creation/Quantity(x) 2.79 ± 0.009 ns 3.72 ± 0.86 ns 0.752
Quantity/creation/Quantity(x, length=y) 3.42 ± 0.01 ns 3.42 ± 0.01 ns 1
Quantity/with_numbers/*real 3.1 ± 0.01 ns 3.11 ± 0.01 ns 1
Quantity/with_numbers/^int 8.05 ± 1.8 ns 8.36 ± 2.2 ns 0.964
Quantity/with_numbers/^int * real 8.36 ± 1.9 ns 8.05 ± 1.9 ns 1.04
Quantity/with_quantity/+y 4.04 ± 0.001 ns 4.04 ± 0.001 ns 1
Quantity/with_quantity//y 3.11 ± 0.001 ns 3.11 ± 0.009 ns 1
Quantity/with_self/dimension 3.1 ± 0.01 ns 2.79 ± 0.009 ns 1.11
Quantity/with_self/inv 3.11 ± 0.001 ns 3.11 ± 0.001 ns 1
Quantity/with_self/ustrip 2.79 ± 0 ns 2.79 ± 0.01 ns 1
QuantityArray/broadcasting/multi_array_of_quantities 0.145 ± 0.00094 ms 0.15 ± 0.0011 ms 0.965
QuantityArray/broadcasting/multi_normal_array 0.0528 ± 0.00016 ms 0.0498 ± 0.00016 ms 1.06
QuantityArray/broadcasting/multi_quantity_array 0.158 ± 0.00037 ms 0.155 ± 0.00067 ms 1.02
QuantityArray/broadcasting/x^2_array_of_quantities 22.4 ± 1.5 μs 22.8 ± 1.5 μs 0.982
QuantityArray/broadcasting/x^2_normal_array 3.95 ± 1 μs 4.21 ± 0.86 μs 0.938
QuantityArray/broadcasting/x^2_quantity_array 6.92 ± 0.22 μs 6.92 ± 0.22 μs 1
QuantityArray/broadcasting/x^4_array_of_quantities 0.0786 ± 0.00045 ms 0.0783 ± 0.00035 ms 1
QuantityArray/broadcasting/x^4_normal_array 0.0498 ± 0.00015 ms 0.0497 ± 0.00015 ms 1
QuantityArray/broadcasting/x^4_quantity_array 0.0499 ± 0.00013 ms 0.0499 ± 0.00013 ms 1
time_to_load 0.132 ± 0.0003 s 0.133 ± 0.00085 s 0.998

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).

MilesCranmer commented 4 months ago

I'm happy with the others but radians are really tricky and are probably best left for later.

MilesCranmer commented 4 months ago

For example, what should sind(1u"rad") do? Right now with this PR it would evaluate as the sinusoid of 1 degree, even though it was clearly written as 1u"rad"... So basically needs a lot of work to get right.

MilesCranmer commented 4 months ago

Thanks for the PR!! 🚀