Skip to content

Commit 41f6b78

Browse files
committed
make assignment work on ustrip'ed StridedArrays
1 parent 4ce89e1 commit 41f6b78

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ julia> a[1] = 3u"m"; b
7575
2
7676
```
7777
"""
78-
@inline ustrip(A::Array{Q}) where {Q <: Quantity} = reinterpret(numtype(Q), A)
78+
@inline ustrip(A::StridedArray{Q}) where {Q <: Quantity} = reinterpret(numtype(Q), A)
7979

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

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,10 @@ end
14251425
Tridiagonal{Int}
14261426
@test typeof(ustrip(SymTridiagonal([1,2,3]u"m", [4,5]u"m"))) <:
14271427
SymTridiagonal{Int}
1428+
A = zeros(3,3)*1u"s"
1429+
V = view(A,2:3,2:3)
1430+
ustrip(V)[1,1]=1
1431+
@test A[2,2] == 1u"s"
14281432
end
14291433
@testset ">> Linear algebra" begin
14301434
@test istril(1m) === true

0 commit comments

Comments
 (0)