Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Array with variable size an iterative process

$
0
0

Hello everyone! My name is Jeferson and I have been having trouble with arrays that change their size in each iteration.

First of all I need to do this using an interface block because I plan to use an external subroutine.

Initially I need to create vectors that their sizes are definedincreased during an iterative process depending on the data and a set of conditions. For example:

Data: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Begining of iterative process: A, B and C are empty
Ending of iterative process: A = |1 3 8 10|; B = |2 4 7|; C = |5 6 9|

After a new iterative process of exchange values between A, B and C. For example: 
At the end of this new iterative process: A = |1 10|; B = |3 7 8|; C = |2 4 5 6 9| (no matter the order of the numbers in each variable)

I want to do this as efficiently as possible, because I have a huge amount of data.

I implemented this routine by setting the size of A, B and C as a fixed large number, but I do not know if it's the best alternative.

I was searching and found that it is possible to use dynamic allocation of arrays (MOVE_ALLOC) and also through the use of pointers. I have not found many materials that explain about these two possibilities.

Could anyone help me define the most efficient way and how to perform this process?


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>