We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ustrip
dimension
1 parent 17c9348 commit 914390bCopy full SHA for 914390b
src/utils.jl
@@ -148,6 +148,7 @@ Remove the units from a quantity.
148
"""
149
ustrip(q::AbstractQuantity) = q.value
150
ustrip(::AbstractDimensions) = error("Cannot remove units from an `AbstractDimensions` object.")
151
+ustrip(aq::AbstractArray{<:AbstractQuantity}) = ustrip.(aq)
152
ustrip(q) = q
153
154
@@ -157,6 +158,7 @@ Get the dimensions of a quantity, returning an `AbstractDimensions` object.
157
158
159
dimension(q::AbstractQuantity) = q.dimensions
160
dimension(d::AbstractDimensions) = d
161
+dimension(aq::AbstractArray{<:AbstractQuantity}) = allequal(dimension.(aq)) ? dimension(first(aq)) : throw(DimensionError(aq[begin], aq[begin+1:end]))
162
163
164
ulength(q::AbstractQuantity)
0 commit comments