StackOverflowError with rand!
3f6a opened this issue · comments
julia> X = zeros(2, 10)
2×10 Matrix{Float64}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
julia> rand!(X, MultivariateNormal([1.0, 2.0], [1.0 0.0; 0.0 1.0]))
ERROR: StackOverflowError:
Stacktrace:
[1] rand!(rng::TaskLocalRNG, A::Matrix{Float64}, X::FullNormal) (repeats 2 times)
@ Random ~/.julia/juliaup/julia-1.10.0+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Random/src/Random.jl:268
The arguments have to be provided in different order:
julia> using Distributions, Random
julia> X = zeros(2, 10)
2×10 Matrix{Float64}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
julia> rand!(MultivariateNormal([1.0, 2.0], [1.0 0.0; 0.0 1.0]), X)
2×10 Matrix{Float64}:
0.337452 0.144253 2.32285 -1.27711 … -0.530822 0.0721648 -0.624228
1.39392 2.19907 3.2094 3.96336 -1.20843 1.82541 0.828073
julia> X
2×10 Matrix{Float64}:
0.337452 0.144253 2.32285 -1.27711 … -0.530822 0.0721648 -0.624228
1.39392 2.19907 3.2094 3.96336 -1.20843 1.82541 0.828073
Ref #1316
Thanks for the response.
I think it's a bit confusing, but please feel free to close this.