Fortran multidimensional array syntax -


two quick syntax question

would

real(4), allocatable:: thing1(:,:) 

create 2d array 2 columns, of yet undefined number of rows, each element array of 4 reals?

secondly, would

real(4) box(3,3),versions,revert 

create 2 arrays of length 4, , 2d array of size 3x3 each element array of length 4.

the short answer no both.

real(4) not create array of reals, determines kind of real. refer question: fortran 90 kind parameter explain this.

secondly, thing1(:,:) not declare 2 columns, declares 2 dimensions. first being rows, second being columns.

your second create 3x3 array "box" of reals of kind == 4, typically precision "float" in c language.

i'm not sure versions,revert supposed be.

also, when creating array, typical, , little more explicit, use dimension parameter such:

real(4),allocatable,dimension(:,:,:) :: thing1

which can allocated later on as:

allocate(thing1(x,2,4)) assuming still wanted 2 columns, x rows, , array of 4 in each location.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -