If you use qrfact! then the factorization is done in place except for the
"loadings" to the householder reflectors because they have to be stored in
another array. We have considered to introduce an update method for
factorizations such that you can reuse the allocation in a factorization,
but it hasn't been written yet. I think that you can call the functions in
the LAPACK module without any new allocation though.

Med venlig hilsen

Andreas Noack

2014-10-07 18:29 GMT-04:00 Max Suster <[email protected]>:

>
> 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