Skip to content

Commit

Permalink
make assignment work on ustrip'ed AbstractArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarthur committed Apr 14, 2023
1 parent 4ce89e1 commit 6609979
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ julia> a[1] = 3u"m"; b
2
```
"""
@inline ustrip(A::Array{Q}) where {Q <: Quantity} = reinterpret(numtype(Q), A)
@inline ustrip(A::AbstractArray{Q}) where {Q <: Quantity} = reinterpret(numtype(Q), A)

@deprecate(ustrip(A::AbstractArray{T}) where {T<:Number}, ustrip.(A))

Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,9 @@ end
Tridiagonal{Int}
@test typeof(ustrip(SymTridiagonal([1,2,3]u"m", [4,5]u"m"))) <:
SymTridiagonal{Int}
S = Symmetric(zeros(3,3))*1u"s"
ustrip(S)[1]=1
@test S[1] == 1u"s"
end
@testset ">> Linear algebra" begin
@test istril(1m) === true
Expand Down

0 comments on commit 6609979

Please sign in to comment.