|
|
Up |
|
|
  |
Author: mforetsmforets Date: Jul 13, 2008 19:36
Hello. I have a problem on trying to define an array with eight
dimensions. I tried the following:
integer :: N=10
complex,dimension(-N:N,-N:N,0:1,0:1,-N:N,-N:N,0:1,0:1) :: P
, but i get an error when compiling that the array cannot have more
than seven dimensions.
I'm working under gfortran version 4.3.0 .
Thank you for any recommendation on what to do, or suggestion about an
alternate solution.
|
| |
|
| | 5 Comments |
|
  |
Author: nospamnospam Date: Jul 13, 2008 21:03
hotmail.com> wrote:
> Hello. I have a problem on trying to define an array with eight
> dimensions. I tried the following:
> integer :: N=10
> complex,dimension(-N:N,-N:N,0:1,0:1,-N:N,-N:N,0:1,0:1) :: P
>
> , but i get an error when compiling that the array cannot have more
> than seven dimensions.
That's true. That is a limitation of the current Fortran standard.
> Thank you for any recommendation on what to do, or suggestion about an
> alternate solution.
I can think of 3 off the top of my head.
1. As several of your dimensions are hardwired to have only 2 elements,
you might be able to get by with something like 2 7-dimensional arrays.
2. You can have an array of derived-type, where the type consists of a
single component that is in turn an array. There is some awkwardness in
this in that you can't directly reference some slices (because of the
restriction against arrays of arrays), but it does get it all in one
object.
|
| Show full article (1.74Kb) |
|
| | no comments |
|
  |
Author: DamianDamian Date: Jul 14, 2008 06:11
On Jul 13, 9:03 pm, nos...@see.signature (Richard Maine) wrote:
> hotmail.com> wrote:
>> Hello. I have a problem on trying to define an array with eight
>> dimensions. I tried the following:
>> integer :: N=10
>> complex,dimension(-N:N,-N:N,0:1,0:1,-N:N,-N:N,0:1,0:1) :: P
>
>> , but i get an error when compiling that the array cannot have more
>> than seven dimensions.
>
> That's true. That is a limitation of the current Fortran standard.
>
>> Thank you for any recommendation on what to do, or suggestion about an
>> alternate solution.
>
> I can think of 3 off the top of my head.
>
> 1. As several of your dimensions are hardwired to have only 2 elements,
> you might be able to get by with something like 2 7-dimensional arrays.
> ...
|
| Show full article (2.93Kb) |
| no comments |
|
  |
Author: Tobias BurnusTobias Burnus Date: Jul 14, 2008 08:20
> I have a problem on trying to define an array with eight
> dimensions. [...]
> , but i get an error when compiling that the array cannot have more
> than seven dimensions.
> I'm working under gfortran version 4.3.0 .
Another possibility than the suggestions by Richard and Damian is to
use gfortran 4.4, which supports 15 dimensions (in line with the
Fortran 2008 candidate draft). However, this limits the compatibility
of your program to very few compilers. Additionally, you need to use a
developers version of gfortran (as 4.4 has not been released yet); the
developer versions are usually quite stable, but still a snapshot of a
given day might be not working correctly, if you are unlucky.
For gfortran 4.4, see:
http://gcc.gnu.org/wiki/GFortranBinaries
Tobias
|
| |
| no comments |
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: Jul 18, 2008 16:05
> Hello. I have a problem on trying to define an array with eight
> dimensions. I tried the following:
> integer :: N=10
> complex,dimension(-N:N,-N:N,0:1,0:1,-N:N,-N:N,0:1,0:1) :: P
Easiest is to make the last and 0:3 and then reference
it with 2*(I)+(J) where (I) and (J) are the value of the
next to last and last desired subscript.
That generalizes a little. Also, you can use the C preprocessor
to do some of the conversion for you.
-- glen
|
| |
| no comments |
|
  |
|
|
  |
Author: Eugene A. PallatEugene A. Pallat Date: Jul 20, 2008 17:27
> Hello. I have a problem on trying to define an array with eight
> dimensions. I tried the following:
> integer :: N=10
> complex,dimension(-N:N,-N:N,0:1,0:1,-N:N,-N:N,0:1,0:1) :: P
>
> , but i get an error when compiling that the array cannot have more
> than seven dimensions.
> I'm working under gfortran version 4.3.0 .
> Thank you for any recommendation on what to do, or suggestion about an
> alternate solution.
Use equivalence statements to get the added dimensions. It's a little more
work, but it's a workaround.
I ran into a problem where I needed a 4 dimensional matrix in COBOL. The
Univac reps said no one could understand more than 3 dimensions. I told
them, "I could understand 10. Too bad about you guys."
I just redefined the matrices which was the COBOL version of equivalence and
had no problem with a 4 dimensional matrix.
|
| Show full article (1.16Kb) |
| no comments |
|
RELATED THREADS |
  |
|
|
|