Skip to content

Commit 6c30651

Browse files
committed
disable make(t::AbstractFloat, X, dims)
1 parent 6a97782 commit 6c30651

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/containers.jl

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,30 @@ end
7676

7777
macro make_array_container(Cont)
7878
definitions =
79-
[ :(rand(rng::AbstractRNG, $Cont, dims::Dims) = rand(rng, make(t, dims))),
80-
:(rand( $Cont, dims::Dims) = rand(GLOBAL_RNG, make(t, dims))),
81-
:(rand(rng::AbstractRNG, $Cont, dims::Integer...) = rand(rng, make(t, Dims(dims)))),
82-
:(rand( $Cont, dims::Integer...) = rand(GLOBAL_RNG, make(t, Dims(dims)))),
83-
84-
:(rand(rng::AbstractRNG, X, $Cont, dims::Dims) = rand(rng, make(t, X, dims))),
85-
:(rand( X, $Cont, dims::Dims) = rand(GLOBAL_RNG, make(t, X, dims))),
86-
:(rand(rng::AbstractRNG, X, $Cont, dims::Integer...) = rand(rng, make(t, X, Dims(dims)))),
87-
:(rand( X, $Cont, dims::Integer...) = rand(GLOBAL_RNG, make(t, X, Dims(dims)))),
88-
89-
:(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Dims) where {X} = rand(rng, make(t, X, dims))),
90-
:(rand( ::Type{X}, $Cont, dims::Dims) where {X} = rand(GLOBAL_RNG, make(t, X, dims))),
91-
:(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Integer...) where {X} = rand(rng, make(t, X, Dims(dims)))),
92-
:(rand( ::Type{X}, $Cont, dims::Integer...) where {X} = rand(GLOBAL_RNG, make(t, X, Dims(dims)))),
79+
[ :(rand(rng::AbstractRNG, $Cont, dims::Dims) = rand(rng, _make_cont(t, dims))),
80+
:(rand( $Cont, dims::Dims) = rand(GLOBAL_RNG, _make_cont(t, dims))),
81+
:(rand(rng::AbstractRNG, $Cont, dims::Integer...) = rand(rng, _make_cont(t, Dims(dims)))),
82+
:(rand( $Cont, dims::Integer...) = rand(GLOBAL_RNG, _make_cont(t, Dims(dims)))),
83+
84+
:(rand(rng::AbstractRNG, X, $Cont, dims::Dims) = rand(rng, _make_cont(t, X, dims))),
85+
:(rand( X, $Cont, dims::Dims) = rand(GLOBAL_RNG, _make_cont(t, X, dims))),
86+
:(rand(rng::AbstractRNG, X, $Cont, dims::Integer...) = rand(rng, _make_cont(t, X, Dims(dims)))),
87+
:(rand( X, $Cont, dims::Integer...) = rand(GLOBAL_RNG, _make_cont(t, X, Dims(dims)))),
88+
89+
:(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Dims) where {X} = rand(rng, _make_cont(t, X, dims))),
90+
:(rand( ::Type{X}, $Cont, dims::Dims) where {X} = rand(GLOBAL_RNG, _make_cont(t, X, dims))),
91+
:(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Integer...) where {X} = rand(rng, _make_cont(t, X, Dims(dims)))),
92+
:(rand( ::Type{X}, $Cont, dims::Integer...) where {X} = rand(GLOBAL_RNG, _make_cont(t, X, Dims(dims)))),
9393
]
9494
esc(Expr(:block, definitions...))
9595
end
9696

97+
_make_cont(args...) = make(args...)
98+
9799
@make_array_container(t::Type{<:Array})
98100
@make_array_container(t::Type{<:BitArray})
99101
@make_array_container(t::AbstractFloat)
100-
102+
_make_cont(t::AbstractFloat, x, dims::Dims) = make(x, t, dims)
101103

102104
## sets/dicts
103105

src/sampling.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,6 @@ make(::Type{X}, p::AbstractFloat, dims::Integer...) where {X} = make(X,
447447
make( p::AbstractFloat, dims::Dims) = make(default_sampling(AbstractArray), p, dims)
448448
make( p::AbstractFloat, dims::Integer...) = make(default_sampling(AbstractArray), p, Dims(dims))
449449

450-
# to make @make_array_container work:
451-
make(p::AbstractFloat, X, dims::Dims) = make(X, p, dims)
452450

453451
Sampler(RNG::Type{<:AbstractRNG}, c::Make3{A}, n::Repetition) where {A<:AbstractSparseArray} =
454452
SamplerTag{A}((sp = sampler(RNG, c.x, n),

0 commit comments

Comments
 (0)