How to declare a complex type array in fortran 90

user3763284

I need some help to initialize a complex type 1-D array in Fortran on linux

complex(kind=dp),dimension(8),public:: zc = (/(0.0_dp,0.0_dp) ,(-3.496991526333D001,0.0_dp) ,
( -3.944481647220D+000 , 0.0_dp ) , (-4.294180799072D+000 , 0.0_dp ) , 
(-4.294180799072D+000, -1.0_dp) , ( -3.944481647220D+000,-1.0_dp ) , 
(-3.496991526333D-           001,-1.0_dp ) , (0.0_dp,-1.0_dp)/) ! z computational 

Above statement works in Fortran Power Station( for Windows ) but not on Linux. It gives the following error

Missing ')' in statement at or before (1) 

NOTE : The '1' is the comma b/w 3rd and 4th complex no. The extension of the program is .f90

Vladimir F

You must use the correct way of continuing lines. If you use fixed form (usually .f,.form) place any character on the sixth column of the new line and then your statement. You probably use this, otherwise -3.496991526333D- 001 coudn't work, because spaces are important in the free form. But ! denotes comments in the free form. If you use the free form, correct the number. Be sure to not go past column 72 in the fixed form.

For example:

      complex(kind=dp),dimension(8),public:: zc = (/(0.0_dp,0.0_dp) ,(-3.496991526333D001,0.0_dp) ,
     *  ( -3.944481647220D+000 , 0.0_dp ) , (-4.294180799072D+000 , 0.0_dp ) , 
     *  (-4.294180799072D+000, -1.0_dp) , ( -3.944481647220D+000,-1.0_dp ) , 
     *  (-3.496991526333D-001,-1.0_dp ) , (0.0_dp,-1.0_dp)/) 
C z computational 

In the free form (usually .f90) use & at the of the line to continue on the next one.

complex(kind=dp),dimension(8),public:: zc = (/(0.0_dp,0.0_dp) ,(-3.496991526333D001,0.0_dp) , &
( -3.944481647220D+000 , 0.0_dp ) , (-4.294180799072D+000 , 0.0_dp ) , &
(-4.294180799072D+000, -1.0_dp) , ( -3.944481647220D+000,-1.0_dp ) , &
(-3.496991526333D-001,-1.0_dp ) , (0.0_dp,-1.0_dp)/) !z computational

You should read more about the correct soource form in any Fortran tutorial.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to declare the type of a function that returns an array in Fortran?

From Dev

Fortran 90, how to use array defined in derived type in a subroutine

From Dev

Real data type fortran 90

From Dev

How to declare the array type in swift

From Dev

How to declare an array with type constraints?

From Dev

How to declare the array type in swift

From Dev

How to add new element to dynamical array in Fortran 90

From Dev

How to add new element to dynamical array in Fortran 90

From Dev

Decrease size of array in Fortran 90

From Dev

How do you pass Fortran's complex type to C#?

From Dev

How to flush stdout in Fortran 90?

From Dev

How to flush stdout in Fortran 90?

From Dev

Creating interface for abstract type in Fortran 90

From Dev

Send custom type using MPI and Fortran 90

From Dev

Send custom type using MPI and Fortran 90

From Dev

How to declare array of specific type in javascript

From Dev

Broadcast array multiplication in Fortran 90/95

From Dev

Fortran 90 Differences in declaring allocatable array

From Dev

Fortran 90 Differences in declaring allocatable array

From Dev

How to Compare Member of Array of Complex Type to a SELECT?

From Dev

How to avoid global variables in Fortran 90 or higher?

From Dev

C: declare type in <complex.h>

From Dev

How to declare an array type that can contain either a string or other array?

From Dev

How to define a type that define an array of complex type in SOAP

From Dev

MPI send derived data type with pointer in Fortran 90

From Dev

Using MPI_Type_Create_Subarray in FORTRAN 90

From Dev

MPI send derived data type with pointer in Fortran 90

From Dev

How to declare a variable mid-routine in Fortran

From Dev

How to declare a variable mid-routine in Fortran

Related Related

  1. 1

    How to declare the type of a function that returns an array in Fortran?

  2. 2

    Fortran 90, how to use array defined in derived type in a subroutine

  3. 3

    Real data type fortran 90

  4. 4

    How to declare the array type in swift

  5. 5

    How to declare an array with type constraints?

  6. 6

    How to declare the array type in swift

  7. 7

    How to add new element to dynamical array in Fortran 90

  8. 8

    How to add new element to dynamical array in Fortran 90

  9. 9

    Decrease size of array in Fortran 90

  10. 10

    How do you pass Fortran's complex type to C#?

  11. 11

    How to flush stdout in Fortran 90?

  12. 12

    How to flush stdout in Fortran 90?

  13. 13

    Creating interface for abstract type in Fortran 90

  14. 14

    Send custom type using MPI and Fortran 90

  15. 15

    Send custom type using MPI and Fortran 90

  16. 16

    How to declare array of specific type in javascript

  17. 17

    Broadcast array multiplication in Fortran 90/95

  18. 18

    Fortran 90 Differences in declaring allocatable array

  19. 19

    Fortran 90 Differences in declaring allocatable array

  20. 20

    How to Compare Member of Array of Complex Type to a SELECT?

  21. 21

    How to avoid global variables in Fortran 90 or higher?

  22. 22

    C: declare type in <complex.h>

  23. 23

    How to declare an array type that can contain either a string or other array?

  24. 24

    How to define a type that define an array of complex type in SOAP

  25. 25

    MPI send derived data type with pointer in Fortran 90

  26. 26

    Using MPI_Type_Create_Subarray in FORTRAN 90

  27. 27

    MPI send derived data type with pointer in Fortran 90

  28. 28

    How to declare a variable mid-routine in Fortran

  29. 29

    How to declare a variable mid-routine in Fortran

HotTag

Archive