- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a real (8) array A(0:m,0:n,0:p) where
m, n and p are positive integers.
I also have a subroutine or function f(x) where
x is a real(8) array x(0:m,0:p).
I need to call f(A(0:m,i,0:p)) where i
is an integer between 0 and n.
When m and p are large, the program crashes.
Are there other ways to let f knows that what
goes into array x is the section
A(0:m,i,0:p) of array A?
m, n and p are positive integers.
I also have a subroutine or function f(x) where
x is a real(8) array x(0:m,0:p).
I need to call f(A(0:m,i,0:p)) where i
is an integer between 0 and n.
When m and p are large, the program crashes.
Are there other ways to let f knows that what
goes into array x is the section
A(0:m,i,0:p) of array A?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are asking your program to allocate an (m+1) by (p+1) matrix at run time. Are you allowing for the necessary stack space (if on Windows, /link /stack:nnnnnnn ) ? You could declare this array yourself and assign the section to it, then pass the array to the subroutine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I actually have declared the array x
inside subroutine f.
Is there a way to just pass the address of
the array (as in the C language) so that
the program does not have to haul large
chunks of data?
inside subroutine f.
Is there a way to just pass the address of
the array (as in the C language) so that
the program does not have to haul large
chunks of data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I am reading your description correctly, the array section you are trying to pass is not contiguous, so just passing the address wouldn't do what you want. If you don't want the compiler to generate a contiguous copy of the section and pass that, you could declare the argument in the called routine as (:,:,:) and supply an explicit interface. Note that this would be a rank 3 array, though the second rank would be 1:1. You'd have to adjust the code for that.
Steve
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page