PDA

View Full Version : Interpolation with CSIEZ



oglok
03-31-2011, 05:55 AM
Hello everybody,

I'm freaking out with this routine coz I don't understand what I'm doing wrong.

The help says this:

CALL CSIEZ (NDATA, XDATA, FDATA, N, XVEC, VALUE)

I have an array with 300 angles (from 0 to 90 degrees). Another array with the power related to each angle. What I need, it is the angle, when the value of the power is X, ok?

So, according to the routine, NDATA would be 300 (length of the array), XDATA my angles array and FDATA the power array. N=1 because I just want ONE VALUE!! XVEC would be the value (X) and VALUE the result....

So like this is not working... my fortran program crashes... Did I understand correctly the routine???


Thanks!

omega
03-31-2011, 06:30 AM
Consider first running the document example for CSIEZ to be sure you are compiling/linking correctly, then edit the example to use your data.

oglok
03-31-2011, 06:43 AM
Ok, right now it's not crashing...It is not compiling!!

This is the error...

C:\Documents and Settings\oglok\Mis documentos\Codigos fuente\LeerFichero.f90(174) : Error: The type of the actual argument differs from the type of the dummy argument.
call CSIEZ(counter, Z, 20*log10(E41), 1, -3, BW3cop)
------------------------------------------------------^

It seems the problem is on the last part of the routine...but don't know why. I want to calculate the bandwith when the power is -3dB of the maximum. So, I want 1 value interpolated, when the ordinate is valued -3 and I want the value to be stored in a real variable called BW3cop.

Am I the dummy?? or just my arguments??

omega
03-31-2011, 07:29 AM
From a quick look at your call to CSIEZ:
call CSIEZ(counter, Z, 20*log10(E41), 1, -3, BW3cop)
it appears the 5th argument expects a REAL array but you supply a scalar integer.

oglok
03-31-2011, 07:42 AM
THANKS OMEGA!!!

My gosh...just a .0 and it works (I mean -3.0)

Pfffff... dummy me?? or dummy this damned fortran???

oglok
06-08-2011, 08:12 AM
Hello again!

If you guys, read this post, I could solve the problem with the CSIEZ routine, but now, in my department, they've changed from COMPAQ compiler to Intel Fortran 9.1 compiler... and I have to modify my code again. After making all the links and includes that are required, there is only one error and it's again this CSIEZ routine. This is the error:


If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [VALUE]

Why is this happening??

Thanks!!!

BTW: VALUE in the IMSL documentation corresponds to the -3.0 of my code, ok?

oglok
06-09-2011, 07:26 AM
Is there any chance that IMSL libraries could be treated differently by different Fortran compilers?? I'm completely stucked!!

Anyone??

mecej4
06-09-2011, 09:33 AM
Is there any chance that IMSL libraries could be treated differently by different Fortran compilers?? I'm completely <sic> stucked!!


In fact, when you make calls to IMSL Fortran-9+ module procedures by generic names, the chance is close to zero that the IMSL library will function correctly with any compiler other than than the one it is dedicated to.

Richard Hanson
06-09-2011, 12:03 PM
It would be better to say 'other than than the one it is compiled with and ported to.' Even this barrier can be overcome, often, by calling C wrapper codes that call the alternate library. There is a white paper on standard inter-operating of Fortran and C that is posted on the RW site. But this is a matter for another posting.

The case here might be corrected by using the appropriate syntax. This has not been tried by the poster, but give this a shot:



...
REAL BW3cop(1), MYX(1)
...
MYX=-3.
call CSIEZ(counter, Z, 20*log10(E41), 1, MYX, BW3cop)


The array Z() has size 'counter'. The array E41() should also have size 'counter.' The elementary array-valued function log10() then gives a result of size 'counter' so that seems OK. The factor 20 is turned into a float 20.0 when computing the product. The single interpolated value should be an output in BW3cop(1). You could get several interpolated values at once, if you choose, by extending MYX and BW3cop to arrays that hold many values. That was the way the code was designed, for efficiency.

What used to be OK in Fortran 77 - passing a scalar and using it as an array of size 1 - is now a no-no in later versions. Things may work one place but not another. The code expects an array of size N=1 for both input and output. That is not a scalar, as you had written.

If this does not work get in touch with post-sales support. Cheers.

oglok
06-10-2011, 07:18 AM
It would be better to say 'other than than the one it is compiled with and ported to.' Even this barrier can be overcome, often, by calling C wrapper codes that call the alternate library. There is a white paper on standard inter-operating of Fortran and C that is posted on the RW site. But this is a matter for another posting.

The case here might be corrected by using the appropriate syntax. This has not been tried by the poster, but give this a shot:



...
REAL BW3cop(1), MYX(1)
...
MYX=-3.
call CSIEZ(counter, Z, 20*log10(E41), 1, MYX, BW3cop)


The array Z() has size 'counter'. The array E41() should also have size 'counter.' The elementary array-valued function log10() then gives a result of size 'counter' so that seems OK. The factor 20 is turned into a float 20.0 when computing the product. The single interpolated value should be an output in BW3cop(1). You could get several interpolated values at once, if you choose, by extending MYX and BW3cop to arrays that hold many values. That was the way the code was designed, for efficiency.

What used to be OK in Fortran 77 - passing a scalar and using it as an array of size 1 - is now a no-no in later versions. Things may work one place but not another. The code expects an array of size N=1 for both input and output. That is not a scalar, as you had written.

If this does not work get in touch with post-sales support. Cheers.


Thank you very much for your help Richard, it worked. Just to understand, in terms of compiling, it is not the same a real variable than a real array of just one element?

Thanks again!!

Richard Hanson
06-10-2011, 07:44 AM
Correct, it is not the same. Arrays now may contain 'dope' about their rank, bounds, other attributes, etc. These are hidden from view when reading a code. That is one reason to not fudge with the standard. But once you get used to the new features of Fortran you will likely be pleased. The error message was hard to follow, particularly for a Fortran 77 programmer. It would be better to give a suggestion on what could be done or at least more details. But that is the hand we are dealt. :(
Cheers.