@@ -31,29 +31,23 @@ function stage(ctx, a::AllocateArray)
31
31
end
32
32
33
33
function Base. rand (p:: Blocks , eltype:: Type , dims)
34
- s = rand (UInt)
35
- f = function (idx, x... )
36
- rand (MersenneTwister (s+ idx), x... )
37
- end
38
34
d = ArrayDomain (map (x-> 1 : x, dims))
39
- a = AllocateArray (eltype, f , d, partition (p, d), p)
35
+ a = AllocateArray (eltype, (_, x ... ) -> rand (x ... ) , d, partition (p, d), p)
40
36
return _to_darray (a)
41
37
end
42
38
43
39
Base. rand (p:: Blocks , t:: Type , dims:: Integer... ) = rand (p, t, dims)
44
40
Base. rand (p:: Blocks , dims:: Integer... ) = rand (p, Float64, dims)
45
41
Base. rand (p:: Blocks , dims:: Tuple ) = rand (p, Float64, dims)
46
42
47
- function Base. randn (p:: Blocks , dims)
48
- s = rand (UInt)
49
- f = function (idx, x... )
50
- randn (MersenneTwister (s+ idx), x... )
51
- end
43
+ function Base. randn (p:: Blocks , eltype:: Type , dims)
52
44
d = ArrayDomain (map (x-> 1 : x, dims))
53
- a = AllocateArray (Float64, f , d, partition (p, d), p)
45
+ a = AllocateArray (Float64, (_, x ... ) -> randn (x ... ) , d, partition (p, d), p)
54
46
return _to_darray (a)
55
47
end
48
+ Base. randn (p:: Blocks , t:: Type , dims:: Integer... ) = randn (p, t, dims)
56
49
Base. randn (p:: Blocks , dims:: Integer... ) = randn (p, dims)
50
+ Base. randn (p:: Blocks , dims:: Tuple ) = randn (p, Float64, dims)
57
51
58
52
function Base. ones (p:: Blocks , eltype:: Type , dims)
59
53
d = ArrayDomain (map (x-> 1 : x, dims))
0 commit comments