Fortran Fortran: Pointer to array section with vector subscripts

AI Thread 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. :-)
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
2
Views
9K
Replies
13
Views
3K
Replies
8
Views
3K
Replies
11
Views
3K
Replies
10
Views
25K
Replies
3
Views
12K
Replies
1
Views
1K
Replies
8
Views
4K
Replies
6
Views
2K
Back
Top