Hello,
I'm just writing some code in Fortran 90 and compiling it with ifort. For some data I need arrays of size e.g. 3 x n, where n is determinded at runtime. AFAIK fortran does not allow to restrict any dimension of my allocatable array, so in fact the arrays intended to be 3 x n could be allocated as m x n, where m could be random. I thought of defining a datatype for a 3-dimensional vector, but that would slow down the intrinsic vecotr operations and I would have to rewrite some standart operations by hand (e.g. + or *). Additionally some overhead would be produced because I would use a custom type. Is there any possibility to restrict one of the dimensions for an allocatable array, without running into trouble described above? (I would need something like
real, allocatable :: A(3,).
I'm just writing some code in Fortran 90 and compiling it with ifort. For some data I need arrays of size e.g. 3 x n, where n is determinded at runtime. AFAIK fortran does not allow to restrict any dimension of my allocatable array, so in fact the arrays intended to be 3 x n could be allocated as m x n, where m could be random. I thought of defining a datatype for a 3-dimensional vector, but that would slow down the intrinsic vecotr operations and I would have to rewrite some standart operations by hand (e.g. + or *). Additionally some overhead would be produced because I would use a custom type. Is there any possibility to restrict one of the dimensions for an allocatable array, without running into trouble described above? (I would need something like
real, allocatable :: A(3,).