You could try this. 

a= Array{Float64,2}[]
b= Array{Float64,2}[]

function test_qr(a,b)

  for i=1:100000
    tmp = qr(rand(3,3))
    push!(a,tmp[1])
    push!(b,tmp[2])
  end
 
end

julia> size(a,1)
100000

julia> size(b,1)
100000


On Tuesday, October 7, 2014 10:17:07 PM UTC+2, Ryan Young wrote:
>
> Hello,
>
> I am working on optimizing a code that looks at 3D deformation fields.  At 
> one point I have to take the QR decompositions at many points. My problem 
> is that regardless of how I  pre-allocate my variables to store the results 
> of the QR, they are allocated each time through the loop. I tried to use 
> the qrfact! method but found it suffered from the same problem.  Any help 
> in getting around this would be great.  A basic function that has the same 
> problem is below.  
>
> function test_qr()
>     tmp=rand(3,3)
>     a=Array(Float64,2)
>     b=Array(Float64,2)
>
>     for i=1:100000
>         a,b=qr(tmp)
>     end
>
> end
>

Reply via email to