Skip to content

Commit 2feea5c

Browse files
committed
added some usage docs
1 parent 392701a commit 2feea5c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,22 @@ julia> @btime $f.(qa) setup=(xa = randn(100000) .* u"km/s"; qa = QuantityArray(x
364364

365365
So we can see the `QuantityArray` version saves on both time and memory.
366366

367+
By default, DynamicQuantities will create a `QuantityArray` from an `AbstractArray`, similarly to how a `Quantity` is created from a scalar in the [Usage](@ref) examples:
368+
369+
```@repl quantity-array
370+
using DynamicQuantities # hide
371+
372+
x = [0.3, 0.4, 0.5]u"km/s"
373+
374+
y = (42:45) * u"kg"
375+
```
376+
377+
This can be overridden to produce a vector of `Quantity`s by explicitly broadcasting the unit:
378+
379+
```@repl quantity-array
380+
z = [0.3, 0.4, 0.5] .* u"km/s"
381+
```
382+
367383
### Unitful
368384

369385
DynamicQuantities allows you to convert back and forth from Unitful.jl:

0 commit comments

Comments
 (0)