# Best strategy for fastest way to extract arrays built from matrix elements and then reassemble after ifft()

**URL:** <https://discourse.julialang.org/t/best-strategy-for-fastest-way-to-extract-arrays-built-from-matrix-elements-and-then-reassemble-after-ifft/46888>\
**Category:** General Usage\
**Tags:** fftw, performance, matrices\
**Created:** [September 19, 2020, 1:48am UTC](https://discourse.julialang.org/t/best-strategy-for-fastest-way-to-extract-arrays-built-from-matrix-elements-and-then-reassemble-after-ifft/46888 "2020-09-19T01:48:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jleman](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jleman](https://discourse.julialang.org/u/jleman)\
**Post date:** [September 19, 2020, 1:48am UTC](https://discourse.julialang.org/t/best-strategy-for-fastest-way-to-extract-arrays-built-from-matrix-elements-and-then-reassemble-after-ifft/46888/1 "2020-09-19T01:48:47Z")

</div>

I have a frequency domain data set organized as shown in the attached image (set up as an array of matrices like: `[zeros(40,4000) for _ in 1:4096] `)

 ![ifft strategy question](https://global.discourse-cdn.com/julialang/original/3X/e/7/e71a4b3f474deac5a3ec382c94603c0a699ed246.jpeg)

I need to create the time domain data set at right by applying the inverse FFT to arrays consisting of elements in the same position of each of the matrices in the original array. For example, the red arrow shows the array grouping for the [1,1] matrix position of the frequency domain data set. This operation is performed for each matrix element position.

I prefer to have the data organized in this way for other reasons that call for iterating over each matrix and performing operations such as inversion. I could use the getindex function to group the arrays:

`array = getindex.(Matrix,position)`

However, it seems like this would be cumbersome since I would then have to reassemble the data set. Does anyone know of a better approach (prioritizing speed)?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 22, 2020, 12:35am UTC](https://discourse.julialang.org/t/best-strategy-for-fastest-way-to-extract-arrays-built-from-matrix-elements-and-then-reassemble-after-ifft/46888/2 "2020-09-22T00:35:50Z")

</div>

3 posts were merged into an existing topic: [Performance Help on Large Matrix Manipulation](https://discourse.julialang.org/t/performance-help-on-large-matrix-manipulation/47029)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 22, 2020, 12:35am UTC](https://discourse.julialang.org/t/best-strategy-for-fastest-way-to-extract-arrays-built-from-matrix-elements-and-then-reassemble-after-ifft/46888/3 "2020-09-22T00:35:50Z")

</div>


