You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
today I observed a couple of unexpected behaviours using the Unitful.jl package - I'm not sure what to make of them, since it is quite easy to work around the errors as seen in the MWE below. Nevertheless, I thought it would still be worth sharing.
I have included the stack traces below the MWE for both the DimensionError and the ArgumentError.
In the case of the DimensionError, this seems on the surface to be similar to #585.
In the case of the ArgumentError, I'm confused at this behaviour and I haven't seen anything similar in the other issues (I might have missed something, though).
Thanks for your time.
J
MWE
using Unitful
A = [1 2; 3 4]
prod(A) # 24
A[1, :] .* A[2, :] # [3, 8]
prod(A; dims = 1) # [3, 8]
B = A .* u"m"
prod(B) # 24 m⁴
B[1, :] .* B[2, :] # [3 m², 8 m²]
prod(B; dims = 1) # DimensionError: and m² are not dimensionally compatible.
C = A .* [u"m" u"m"; u"kg" u"kg"]
prod(C) # 24 kg² m²
C[1, :] .* C[2, :] # [3 kg m, 8 kg m]
prod(C; dims = 1) # ArgumentError: zero(Quantity{Int64}) not defined.
Version information
Unitful:
Status `~/.julia/environments/v1.9/Project.toml`
[1986cc42] Unitful v1.19.0
julia> versioninfo()
Julia Version 1.9.4
Commit 8e5136fa297 (2023-11-14 08:46 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (x86_64-apple-darwin22.4.0)
CPU: 4 × Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, broadwell)
Threads: 1 on 4 virtual cores
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =
Hello,
today I observed a couple of unexpected behaviours using the
Unitful.jl
package - I'm not sure what to make of them, since it is quite easy to work around the errors as seen in the MWE below. Nevertheless, I thought it would still be worth sharing.I have included the stack traces below the MWE for both the
DimensionError
and theArgumentError
.In the case of the
DimensionError
, this seems on the surface to be similar to #585.In the case of the
ArgumentError
, I'm confused at this behaviour and I haven't seen anything similar in the other issues (I might have missed something, though).Thanks for your time.
J
MWE
Version information
Unitful:
Stacktraces
DimensionError
ArgumentError
The text was updated successfully, but these errors were encountered: