diff --git a/src/Arrays/Arrays.jl b/src/Arrays/Arrays.jl index e8c2ef783..69d3e66a5 100644 --- a/src/Arrays/Arrays.jl +++ b/src/Arrays/Arrays.jl @@ -24,6 +24,7 @@ import Base: size import Base: getindex, setindex! import Base: similar import Base: IndexStyle +import Base: unaliascopy # CachedArray diff --git a/src/Arrays/SubVectors.jl b/src/Arrays/SubVectors.jl index 78774cef1..e8c94f791 100644 --- a/src/Arrays/SubVectors.jl +++ b/src/Arrays/SubVectors.jl @@ -24,3 +24,4 @@ end Base.IndexStyle(::Type{SubVector{T,A}}) where {T,A} = IndexLinear() +Base.unaliascopy(A::SubVector) = typeof(A)(unaliascopy(A.vector), A.pini, A.pend) diff --git a/test/ArraysTests/SubVectorsTests.jl b/test/ArraysTests/SubVectorsTests.jl index 34c498ded..3a9e34726 100644 --- a/test/ArraysTests/SubVectorsTests.jl +++ b/test/ArraysTests/SubVectorsTests.jl @@ -1,5 +1,5 @@ module SubVectorsTests - +using Gridap using Gridap.Arrays a = collect(1:10) @@ -13,4 +13,15 @@ pend = 9 b = SubVector(a,pini,pend) test_array(b,collect(pini:pend)) +inds = Int32[1,4,3] +a = rand(10) +sa = Gridap.Arrays.SubVector(a,1,5) +vsa = view(sa,inds) + +b = rand(10) +vb = view(b,inds) + +x = Base.broadcasted(+,vb,vsa) +Base.materialize!(vb,x) + end # module