Skip to content

Commit 3dd3fbb

Browse files
authored
Jh/copytotocopy (#36)
* Only overload `copy!`, not `copyto!`. * Update othertests.jl * Update macros.jl * Some more changes to othertests.jl
1 parent f8a0514 commit 3dd3fbb

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/macros.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ macro unsafe_strided(args...)
5353

5454
ex = Expr(:let, Expr(:block, [:($s = Strided.StridedView($s)) for s in syms]...), ex)
5555
warnex = :(Base.depwarn("`@unsafe_strided A B C ... ex` is deprecated, use `@strided ex` instead.",
56-
Core.Typeof(var"@unsafe_strided").name.mt.name))
56+
Symbol("@unsafe_strided"); force=true))
5757
return esc(Expr(:block, warnex, ex))
5858
end
5959

src/mapreduce.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Methods based on map!
2-
function Base.copyto!(dst::StridedView{<:Any,N}, src::StridedView{<:Any,N}) where {N}
2+
function Base.copy!(dst::StridedView{<:Any,N}, src::StridedView{<:Any,N}) where {N}
33
return map!(identity, dst, src)
44
end
55
Base.conj!(a::StridedView{<:Real}) = a

test/othertests.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ end
115115
@test minimum(real, R1) minimum(real, StridedView(R1))
116116
@test sum(x -> real(x) < 0, R1) == sum(x -> real(x) < 0, StridedView(R1))
117117

118-
R1 = PermutedDimsArray(R1, (randperm(6)...,))
118+
R2 = PermutedDimsArray(R1, (randperm(6)...,))
119119

120-
@test sum(R1) sum(StridedView(R1))
121-
@test maximum(abs, R1) maximum(abs, StridedView(R1))
122-
@test minimum(real, R1) minimum(real, StridedView(R1))
123-
@test sum(x -> real(x) < 0, R1) == sum(x -> real(x) < 0, StridedView(R1))
120+
@test sum(R2) sum(StridedView(R2))
121+
@test maximum(abs, R2) maximum(abs, StridedView(R2))
122+
@test minimum(real, R2) minimum(real, StridedView(R2))
123+
@test sum(x -> real(x) < 0, R1) == sum(x -> real(x) < 0, StridedView(R2))
124124

125-
R2 = rand(T, (5, 5, 5))
126-
@test prod(exp, StridedView(R2)) exp(sum(StridedView(R2)))
125+
R3 = rand(T, (5, 5, 5))
126+
@test prod(exp, StridedView(R3)) exp(sum(StridedView(R3)))
127127
end
128128
end
129129

@@ -272,13 +272,13 @@ end
272272
for op3 in (identity, conj, transpose, adjoint)
273273
α = 2 + im
274274
β = 3 - im
275-
copyto!(B3, B4)
275+
copy!(B3, B4)
276276
mul!(op3(B3), op1(B1), op2(B2), α, β)
277277
@test B3 op3(β) * A4 + op3* op1(A1) * op2(A2)) # op3 is its own inverse
278-
copyto!(B3, B4)
278+
copy!(B3, B4)
279279
mul!(op3(B3), op1(B1), op2(B2), α, 0)
280280
@test B3 op3* op1(A1) * op2(A2)) # op3 is its own inverse
281-
copyto!(B3, B4)
281+
copy!(B3, B4)
282282
mul!(op3(B3), op1(B1), op2(B2))
283283
@test B3 op3(op1(A1) * op2(A2)) # op3 is its own inverse
284284
end
@@ -318,13 +318,13 @@ end
318318
for op3 in (identity, conj, transpose, adjoint)
319319
α = 1 // 2
320320
β = 3 // 2
321-
copyto!(B3, B4)
321+
copy!(B3, B4)
322322
mul!(op3(B3), op1(B1), op2(B2), α, β)
323323
@test B3 op3(β) * A4 + op3* op1(A1) * op2(A2)) # op3 is its own inverse
324-
copyto!(B3, B4)
324+
copy!(B3, B4)
325325
mul!(op3(B3), op1(B1), op2(B2), α, 1)
326326
@test B3 A4 + op3* op1(A1) * op2(A2)) # op3 is its own inverse
327-
copyto!(B3, B4)
327+
copy!(B3, B4)
328328
mul!(op3(B3), op1(B1), op2(B2), 1, 1)
329329
@test B3 A4 + op3(op1(A1) * op2(A2)) # op3 is its own inverse
330330
end

0 commit comments

Comments
 (0)