Fortran Fortran: Pointer to array section with vector subscripts

Click For Summary
The discussion centers on the challenge of creating a pointer to specific columns of a rank-2 array in Fortran, specifically using a method that involves targeting an array subsection with a vector subscript. The user attempts to point to specific columns of an array using a syntax that includes a vector for the second index, which is not allowed under the Fortran 2008 standard due to constraint C724. The user seeks alternative methods for achieving this goal, emphasizing the need to select non-contiguous columns without a regular stride, making traditional scalar triplet indexing impractical. The inquiry highlights a need for solutions that adhere to Fortran standards while allowing for flexible column selection in array manipulation.
seneika
Messages
4
Reaction score
0
Hi. I'm trying to make a pointer point to sections of a rank-2 array given by specific values of
it's second index. I other words: given a table I wan't a pointer to point to specific columns, making of it a "filtered" table.

The method I was trying was like

Code:
DOUBLE PRECISION, DIMENSION(M,N), TARGET :: arrA  
DOUBLE PRECISION, DIMENSION(:,:), POINTER :: ptr1  
  ...
ptr1 => arrA(1:k,(/col1,col3/))

to point to columns col1 and col3, rows 1 to k.

However, I've been told in the Intel forum that this procedure would consist in targeting an array
subsection with a vector subscript, which is forbiden in the standard by the constraint C724 of
F2008.

Is there any other way of doing this?

I'm not using a scalar triplet on the second index because, in practice, I'll select more columns without a regular stride, so a rule like col1:colN:stride doesn't seem to be of use.

Thanks.
 
Technology news on Phys.org
I would like to resurrect this thread, I am interested in the answer. :-)
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 2 ·
Replies
2
Views
9K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 10 ·
Replies
10
Views
26K
  • · Replies 3 ·
Replies
3
Views
12K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 6 ·
Replies
6
Views
2K