- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to use the numerical recipe of fft for three-dimensional. My subroutine is from F77 and all of my friends are using it with other versions of FORTRAN but when I try to use the example mentioned inside the book I recieve a problem:
"The type of the actual argument differs from the type of the dummy argument"
according to the example of page 524 of numerical recipies in fortran 77 I should define the variables inside the main budy as:
Can you please help me on this?
I would be glad if I can use a more straighforward FFT subroutine that be free to use for students btw.
"The type of the actual argument differs from the type of the dummy argument"
according to the example of page 524 of numerical recipies in fortran 77 I should define the variables inside the main budy as:
[bash]INTEGER,PARAMETER::N=4but when I try to compile it it gives me the error I mentioned. I really don't know what to do? when I change the data to complex, returened data don't make any sence.
REAL ::DATA(N,N)
COMPLEX ::SPEC(N/2,N),SPEQ(N)
EQUIVALENCE(DATA,SPEC)
.....
call rlft3(DATA,SPEQ,N,N,1,1)
SUBROUTINE rlft3(data,speq,nn1,nn2,nn3,isign)
INTEGER isign,nn1,nn2,nn3
COMPLEX data(nn1/2,nn2,nn3),speq(nn2,nn3)[/bash]
Can you please help me on this?
I would be glad if I can use a more straighforward FFT subroutine that be free to use for students btw.
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are using a book that is more than a decade old, which assumes that the Fortran compiler does not check arguments. Your choices are
(i) use compiler switches to ignore mismatched arguments
(ii) use an older F77 compiler
(iii) fix the Numerical Recipes code to make it conform with the Fortran 77 standard.
Gratuitously changing variable types without considering the implications is something to avoid.
(i) use compiler switches to ignore mismatched arguments
(ii) use an older F77 compiler
(iii) fix the Numerical Recipes code to make it conform with the Fortran 77 standard.
Gratuitously changing variable types without considering the implications is something to avoid.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you know another free library which has multi-dimensional FFT?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Intel Math Kernel Library, included with the compiler, has FFT routines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Somehow I found the solution, when data type of a argument that you want to enter is different with the actual you should use equivalence command. but you should be carefull with that how it manages to share the memory between them.
I have now another question, when I want to use a derived type in an EQUIVALENCE statement i get this error:
Syntax error, found ',' when expecting one of: ( )
code is like:
and I don`t understand what is wronge? I used EQUIVALENCE between for a real and a complex variable and that was right. I'm sure the problem is with the derived type but how? I don't know?
I have now another question, when I want to use a derived type in an EQUIVALENCE statement i get this error:
Syntax error, found ',' when expecting one of: ( )
code is like:
[bash]TYPE ND !INFORMATION OF A NODE SEQUENCE ..... REAL(8)::U,V !FLUID VARIABLES ..... END TYPE COMPLEX ::SPEC(IM/2,JM,3) TYPE(ND) ::GN0(IM,JM) EQUIVALENCE(SPEC(:,:,1),GN0%U)[/bash]
and I don`t understand what is wronge? I used EQUIVALENCE between for a real and a complex variable and that was right. I'm sure the problem is with the derived type but how? I don't know?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"..when data type of a argument that you want to enter is different with the actual you should use equivalence command"
-- bad decision. You may find that this approach silences the compiler for now, but your future life will become 'more interesting', as they say. Minor comment: EQUIVALENCE is not even an executable statement, let alone a 'command'.
EQUIVALENCE is deprecated and has several restrictions placed on it. In particular, objects being declared equivalent must be variables, array elements or substrings: this restriction excludes array sections and structuree components.
This modification of your code will be acceptable to the compiler. Whether it follows your intentions or not is for you to decide.
-- bad decision. You may find that this approach silences the compiler for now, but your future life will become 'more interesting', as they say. Minor comment: EQUIVALENCE is not even an executable statement, let alone a 'command'.
EQUIVALENCE is deprecated and has several restrictions placed on it. In particular, objects being declared equivalent must be variables, array elements or substrings: this restriction excludes array sections and structuree components.
This modification of your code will be acceptable to the compiler. Whether it follows your intentions or not is for you to decide.
[fortran]module bad
INTEGER,PARAMETER :: IM=12,JM=4
TYPE ND
SEQUENCE
REAL(8)::U,V !FLUID VARIABLES
END TYPE
COMPLEX ::SPEC(IM/2,JM,3)
TYPE(ND) ::GN0(IM,JM)
EQUIVALENCE(SPEC(1,1,2),GN0(1,1))
end module bad
[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can totally understand what you are saying, can you just explain me how is the fft of MKL? should I pay for it or no? and where can I see the data structure of it?
or best of all is that if I know it gives the output like matlab or not?
or best of all is that if I know it gives the output like matlab or not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to use the MKL but I have some problems. I have added the path and library(thought they are there but in case I added them again) when I try to compile I receive an error that the file MKL_DFTI cannot be opened.
BTW when I tried to see how fft of MKL should be used I found this:
https://wiki.hpcc.msu.edu/display/faq/Compiling+and+running+Fortran+MKL+FFT+example
where you still see EQUIVALENCE, is that an old example? or a wronge implementation?
BTW when I tried to see how fft of MKL should be used I found this:
https://wiki.hpcc.msu.edu/display/faq/Compiling+and+running+Fortran+MKL+FFT+example
where you still see EQUIVALENCE, is that an old example? or a wronge implementation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The source code for building the modules mkldft_type and mkl_dfti is in the .../mkl/include/mkl_dfti.f90 file. Just compile that file and put the resulting modules where the compiler will find them.
As to fourth-party sources of information: you should contact them with your comments and questions about content that they provide.
As to fourth-party sources of information: you should contact them with your comments and questions about content that they provide.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page