Skip to content

Commit d2a48a3

Browse files
committed
Some more Array changes
1 parent 5b2d5c6 commit d2a48a3

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/linalg.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
function Base.ctranspose{T}(D::DArray{T,2})
22
DArray(reverse(size(D)), procs(D)) do I
3-
lp = Array(T, map(length, I))
3+
lp = Array{T}(map(length, I))
44
rp = convert(Array, D[reverse(I)...])
55
ctranspose!(lp, rp)
66
end
77
end
88

99
function Base.transpose{T}(D::DArray{T,2})
1010
DArray(reverse(size(D)), procs(D)) do I
11-
lp = Array(T, map(length, I))
11+
lp = Array{T}(map(length, I))
1212
rp = convert(Array, D[reverse(I)...])
1313
transpose!(lp, rp)
1414
end
@@ -91,7 +91,7 @@ function A_mul_B!(α::Number, A::DMatrix, x::AbstractVector, β::Number, y::DVec
9191
end
9292

9393
# Multiply on each tile of A
94-
R = Array(Future, size(A.pids)...)
94+
R = Array{Future}(size(A.pids)...)
9595
for j = 1:size(A.pids, 2)
9696
xj = x[A.cuts[2][j]:A.cuts[2][j + 1] - 1]
9797
for i = 1:size(A.pids, 1)
@@ -135,7 +135,7 @@ function Ac_mul_B!(α::Number, A::DMatrix, x::AbstractVector, β::Number, y::DVe
135135
end
136136

137137
# Multiply on each tile of A
138-
R = Array(Future, reverse(size(A.pids))...)
138+
R = Array{Future}(reverse(size(A.pids))...)
139139
for j = 1:size(A.pids, 1)
140140
xj = x[A.cuts[1][j]:A.cuts[1][j + 1] - 1]
141141
for i = 1:size(A.pids, 2)
@@ -201,9 +201,9 @@ function _matmatmul!(α::Number, A::DMatrix, B::AbstractMatrix, β::Number, C::D
201201

202202
# Multiply on each tile of A
203203
if tA == 'N'
204-
R = Array(Future, size(procs(A))..., size(procs(C), 2))
204+
R = Array{Future}(size(procs(A))..., size(procs(C), 2))
205205
else
206-
R = Array(Future, reverse(size(procs(A)))..., size(procs(C), 2))
206+
R = Array{Future}(reverse(size(procs(A)))..., size(procs(C), 2))
207207
end
208208
for j = 1:size(A.pids, Ad2)
209209
for k = 1:size(C.pids, 2)
@@ -258,12 +258,12 @@ _matmul_op = (t,s) -> t*s + t*s
258258

259259
function (*)(A::DMatrix, x::AbstractVector)
260260
T = Base.promote_op(_matmul_op, eltype(A), eltype(x))
261-
y = DArray(I -> Array(T, map(length, I)), (size(A, 1),), procs(A)[:,1], (size(procs(A), 1),))
261+
y = DArray(I -> Array{T}(map(length, I)), (size(A, 1),), procs(A)[:,1], (size(procs(A), 1),))
262262
return A_mul_B!(one(T), A, x, zero(T), y)
263263
end
264264
function (*)(A::DMatrix, B::AbstractMatrix)
265265
T = Base.promote_op(_matmul_op, eltype(A), eltype(B))
266-
C = DArray(I -> Array(T, map(length, I)),
266+
C = DArray(I -> Array{T}(map(length, I)),
267267
(size(A, 1), size(B, 2)),
268268
procs(A)[:,1:min(size(procs(A), 2), size(procs(B), 2))],
269269
(size(procs(A), 1), min(size(procs(A), 2), size(procs(B), 2))))
@@ -272,15 +272,15 @@ end
272272

273273
function Ac_mul_B(A::DMatrix, x::AbstractVector)
274274
T = Base.promote_op(_matmul_op, eltype(A), eltype(x))
275-
y = DArray(I -> Array(T, map(length, I)),
275+
y = DArray(I -> Array{T}(map(length, I)),
276276
(size(A, 2),),
277277
procs(A)[1,:],
278278
(size(procs(A), 2),))
279279
return Ac_mul_B!(one(T), A, x, zero(T), y)
280280
end
281281
function Ac_mul_B(A::DMatrix, B::AbstractMatrix)
282282
T = Base.promote_op(_matmul_op, eltype(A), eltype(B))
283-
C = DArray(I -> Array(T, map(length, I)), (size(A, 2),
283+
C = DArray(I -> Array{T}(map(length, I)), (size(A, 2),
284284
size(B, 2)),
285285
procs(A)[1:min(size(procs(A), 1), size(procs(B), 2)),:],
286286
(size(procs(A), 2), min(size(procs(A), 1), size(procs(B), 2))))

src/mapreduce.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Base.mapreducedim(f, op, R::DArray, A::DArray) = begin
131131
end
132132

133133
function nnz(A::DArray)
134-
B = Array(Any, size(A.pids))
134+
B = Array{Any}(size(A.pids))
135135
@sync begin
136136
for i in eachindex(A.pids)
137137
@async B[i...] = remotecall_fetch(x -> nnz(localpart(x)), A.pids[i...], A)
@@ -301,7 +301,7 @@ function _ppeval(f, A...; dim = map(ndims, A))
301301
push!(ridx, 1)
302302
Rsize = map(last, ridx)
303303
Rsize[end] = dimlength
304-
R = Array(eltype(R1), Rsize...)
304+
R = Array{eltype(R1)}(Rsize...)
305305

306306
for i = 1:dimlength
307307
for j = 1:narg

src/sort.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function scatter_n_sort_localparts{T}(d, myidx, refs::Array{RemoteChannel}, boun
3838
end
3939

4040
if p_till == p_sorted
41-
@async put!(r, Array(T,0))
41+
@async put!(r, Array{T}(0))
4242
else
4343
v = sorted[p_sorted:p_till-1]
4444
@async put!(r, v)
@@ -66,7 +66,7 @@ function compute_boundaries{T}(d::DVector{T}; kwargs...)
6666

6767
results = asyncmap(p -> remotecall_fetch(sample_n_setup_ref, p, d, sample_sz_on_wrkr; kwargs...), pids)
6868

69-
samples = Array(T,0)
69+
samples = Array{T}(0)
7070
for x in results
7171
append!(samples, x[1])
7272
end
@@ -128,7 +128,7 @@ function Base.sort{T}(d::DVector{T}; sample=true, kwargs...)
128128

129129
@assert lb<=ub
130130

131-
s = Array(T, np)
131+
s = Array{T}(np)
132132
part = abs(ub - lb)/np
133133
(isnan(part) || isinf(part)) && throw(ArgumentError("lower and upper bounds must not be infinities"))
134134

@@ -155,7 +155,7 @@ function Base.sort{T}(d::DVector{T}; sample=true, kwargs...)
155155
throw(ArgumentError("keyword arg `sample` must be Boolean, Tuple(Min,Max) or an actual sample of data : " * string(sample)))
156156
end
157157

158-
local_sort_results = Array(Tuple, np)
158+
local_sort_results = Array{Tuple}(np)
159159

160160
Base.asyncmap!((i,p) -> remotecall_fetch(
161161
scatter_n_sort_localparts, p, presorted ? nothing : d, i, refs, boundaries; kwargs...),

test/darray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ end
343343
check_leaks(t)
344344

345345
t=@testset "test max / min / sum" begin
346-
a = map(x -> Int(round(rand() * 100)) - 50, Array(Int, 100,1000))
346+
a = map(x -> Int(round(rand() * 100)) - 50, Array{Int}(100,1000))
347347
d = distribute(a)
348348

349349
@test sum(d) == sum(a)
@@ -359,7 +359,7 @@ end
359359
check_leaks(t)
360360

361361
t=@testset "test all / any" begin
362-
a = map(x->Int(round(rand() * 100)) - 50, Array(Int, 100,1000))
362+
a = map(x->Int(round(rand() * 100)) - 50, Array{Int}(100,1000))
363363
a = [true for i in 1:100]
364364
d = distribute(a)
365365

0 commit comments

Comments
 (0)