Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Let me restate your problem, just to make sure I understand it correctly; please correct me if I'm wrong. </p> <ol> <li>You have a subroutine that calculates 1000 values in two separate arrays: array_1 and array_2. </li> <li>From your main program you would like to call this subroutine many times, each time generating a unique sets of 1000 values. </li> </ol> <p>Let's say you want to call your subroutine N times, do you want to compare the N sets of numbers out side of the subroutine, ie in your main program, or do you want to do the comparison inside the subroutine?</p> <p>Either way, I declare the arrays like so:</p> <pre><code>real, dimension(N,1000) :: array_1, array_2 </code></pre> <p>If you would like to do the comparison outside the subroutine, you will make the above declaration in the main program. Then you will call the subroutine N times, and after each i'th time copy the values into the main's array_1(i,*) and array_2(i,*). In this, the subroutine will only have the arrays defined like so:</p> <pre><code>real, dimension(1000) :: array_1, array_2 </code></pre> <p>Each time the subroutine is called, it will reuse these arrays, overwriting the previous values. This should be OK if you recorded the previous values in the main's arrays. </p> <p>If you are doing this in f90, you can dynamically allocate array_1 and array_2 and let N be variable length. Alternatively, you can allocate the arrays initially with enough space to store all possible calls to the subroutine. Lets say you are not going to run more than 100 calls to the subroutine:</p> <pre><code>real array_1(100,1000), array_2(100,1000) </code></pre> <p>I'm sorry if this is not what you are looking for, but please clarify if I miss understood your question. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload