# Pre-allocating output array for ArrayFire.jl function

**URL:** <https://discourse.julialang.org/t/pre-allocating-output-array-for-arrayfire-jl-function/26472>\
**Category:** General Usage\
**Created:** [July 17, 2019, 5:56pm UTC](https://discourse.julialang.org/t/pre-allocating-output-array-for-arrayfire-jl-function/26472 "2019-07-17T17:56:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josiah\_Slack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josiah_slack/32/8319_2.png) [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Post date:** [July 17, 2019, 5:56pm UTC](https://discourse.julialang.org/t/pre-allocating-output-array-for-arrayfire-jl-function/26472/1 "2019-07-17T17:56:30Z")

</div>

I have a use case where it would helpful if I could allocate a cuda array prior to calling, say cholesky(), which would then be filled by the called function. Is there a straightforward way of doing this?

---

<div class="post-metadata">

**Author:** ![anon43133060](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@anon43133060](https://discourse.julialang.org/u/anon43133060)\
**Post date:** [July 17, 2019, 6:09pm UTC](https://discourse.julialang.org/t/pre-allocating-output-array-for-arrayfire-jl-function/26472/2 "2019-07-17T18:09:57Z")

</div>

look for `*_inplace` functions in wrap.jl - for example there’s `cholesky_inplace` that would do what you want.

---

<div class="post-metadata">

**Author:** ![Josiah\_Slack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josiah_slack/32/8319_2.png) [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Post date:** [July 17, 2019, 7:04pm UTC](https://discourse.julialang.org/t/pre-allocating-output-array-for-arrayfire-jl-function/26472/3 "2019-07-17T19:04:30Z")

</div>

Perfect! Thank you!
