Fortran: Pointer to array section with vector subscripts

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 3K views
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.
 
Physics news on Phys.org
I would like to resurrect this thread, I am interested in the answer. :-)