@@ -32,7 +32,7 @@ are so many unit symbols).
3232
3333You can convert a quantity using `SymbolicDimensions` as its dimensions
3434to one which uses `Dimensions` as its dimensions (i.e., base SI units)
35- `expand_units `.
35+ `uexpand `.
3636"""
3737struct SymbolicDimensions{R} <: AbstractDimensions{R}
3838 nzdims:: Vector{INDEX_TYPE}
@@ -94,37 +94,37 @@ function Base.convert(::Type{Quantity{T,D}}, q::Quantity{<:Any,<:SymbolicDimensi
9494end
9595
9696"""
97- expand_units (q::Quantity{<:Any,<:SymbolicDimensions})
97+ uexpand (q::Quantity{<:Any,<:SymbolicDimensions})
9898
9999Expand the symbolic units in a quantity to their base SI form.
100100In other words, this converts a `Quantity` with `SymbolicDimensions`
101101to one with `Dimensions`. The opposite of this function is `uconvert`,
102102for converting to specific symbolic units, or `convert(Quantity{<:Any,<:SymbolicDimensions}, q)`,
103103for assuming SI units as the output symbols.
104104"""
105- function expand_units (q:: Q ) where {T,R,D<: SymbolicDimensions{R} ,Q<: AbstractQuantity{T,D} }
105+ function uexpand (q:: Q ) where {T,R,D<: SymbolicDimensions{R} ,Q<: AbstractQuantity{T,D} }
106106 return convert (constructor_of (Q){T,Dimensions{R}}, q)
107107end
108- expand_units (q:: QuantityArray ) = expand_units .(q)
108+ uexpand (q:: QuantityArray ) = uexpand .(q)
109109# TODO : Make the array-based one more efficient
110110
111111"""
112112 uconvert(qout::AbstractQuantity{<:Any, <:SymbolicDimensions}, q::AbstractQuantity{<:Any, <:Dimensions})
113113
114114Convert a quantity `q` with base SI units to the symbolic units of `qout`, for `q` and `qout` with compatible units.
115- Mathematically, the result has value `q / expand_units (qout)` and units `dimension(qout)`.
115+ Mathematically, the result has value `q / uexpand (qout)` and units `dimension(qout)`.
116116"""
117117function uconvert (qout:: AbstractQuantity{<:Any, <:SymbolicDimensions} , q:: AbstractQuantity{<:Any, <:Dimensions} )
118118 @assert isone (ustrip (qout)) " You passed a quantity with a non-unit value to uconvert."
119- qout_expanded = expand_units (qout)
119+ qout_expanded = uexpand (qout)
120120 dimension (q) == dimension (qout_expanded) || throw (DimensionError (q, qout_expanded))
121121 new_val = ustrip (q) / ustrip (qout_expanded)
122122 new_dim = dimension (qout)
123123 return new_quantity (typeof (q), new_val, new_dim)
124124end
125125function uconvert (qout:: AbstractQuantity{<:Any,<:SymbolicDimensions} , q:: QuantityArray{<:Any,<:Any,<:Dimensions} )
126126 @assert isone (ustrip (qout)) " You passed a quantity with a non-unit value to uconvert."
127- qout_expanded = expand_units (qout)
127+ qout_expanded = uexpand (qout)
128128 dimension (q) == dimension (qout_expanded) || throw (DimensionError (q, qout_expanded))
129129 new_array = ustrip (q) ./ ustrip (qout_expanded)
130130 new_dim = dimension (qout)
0 commit comments