Skip to content

Commit a4763ef

Browse files
committed
Add additional operators for QuantityArray
1 parent f8771e2 commit a4763ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/arrays.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ Base.showarg(io::IO, v::QuantityArray, _) = _print_array_type(io, typeof(v))
182182
Base.show(io::IO, ::MIME"text/plain", ::Type{QA}) where {QA<:QuantityArray} = _print_array_type(io, QA)
183183

184184
# Other array operations:
185+
Base.resize!(A::QuantityArray, n) = (resize!(ustrip(A), n); A)
186+
Base.empty!(A::QuantityArray) = (empty!(ustrip(A)); A)
187+
Base.empty(A::QuantityArray) = QuantityArray(empty(ustrip(A)), copy(dimension(A)), quantity_type(A))
188+
Base.zero(A::QuantityArray) = QuantityArray(zero(ustrip(A)), copy(dimension(A)), quantity_type(A))
185189
Base.copy(A::QuantityArray) = QuantityArray(copy(ustrip(A)), copy(dimension(A)), quantity_type(A))
186190
for f in (:cat, :hcat, :vcat)
187191
preamble = quote

0 commit comments

Comments
 (0)