Re: gamma undefined in ncl6.0.0

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 23 2011 - 14:10:40 MDT

On Jun 23, 2011, at 2:01 PM, pliu@notes.cc.sunysb.edu wrote:

> Hi Mary,
>
> Thanks for explanation. But how to get the following example run specifically xgam=gamma(x) please? An undefined error always stops the program.

I don't understand how you got the printed output below if it claims that "gamma" is undefined. Am I missing something?

You can't get to this internal "gamma" routine directly, because we haven't made a built-in function out of it. Please see the message I just posted, where I included a Fortran file and an NCL script for you to try.

If you are able to successfully create the "gamma_interface.so" file using WRAPIT, then your program should look like this:

  external GAMMA "./gamma_interface.so" ; load the wrapper we created for "gammacomplete"

  x = todouble((/0.5, 0.33333333, 0.25, 0.20, 2.00, 3.00, 4.00/)) ; create an array

  N = dimsizes(x)
  xgam = new(N,typeof(x)) ; Create the output array
  GAMMA::gammacomplete(N,x,xgam) ; Call the gamma function
  print(xgam)

This is what I got:

(0) 1.772453850905516
(1) 2.678938451355363
(2) 3.625609908221908
(3) 4.590843639635322
(4) 1
(5) 2
(6) 6

--Mary

> N = 7
> x = new(N,"double")
> x(0) = 0.5
> x(1) = 0.33333333
> x(2) = 0.25
> x(3) = 0.20
> x(4) = 2.00
> x(5) = 3.00
> x(6) = 4.00
>
> xgam = gamma(x)
> print(xgam)
>
>
>
> Output:
>
>
> (0) 1.772453850905516
> (1) 2.678938451355363
> (2) 3.625609908221908
> (3) 4.590843639635322
> (4) 1
> (5) 2
> (6) 6
>
>
>
>
>
>
> From: Mary Haley <haley@ucar.edu>
> To: pliu@notes.cc.sunysb.edu
> Cc: ncl-talk@ucar.edu
> Date: 2011/06/23 15:54
> Subject: Re: [ncl-talk] gamma undefined in ncl6.0.0
>
>
>
> Hi,
>
> The "gamma" that you see in the ncl executable is not from a built-in function, but rather from an internal Fortran routine that we have called "gamma".
>
> I see that we have *advertised* that we have a function called "gamma", but this was never implemented. I'll have to check with Dennis on this.
>
> One way to search for a particular function in NCL from the UNIX command line:
>
> echo "list_procfuncs()" | ncl | grep gamma
>
> You'll get this output:
>
> function gammainc (
> function random_gamma (
>
> I believe the "gamma" that you found in the "ncl" executable is from an internal GAMMA function that is used by the "chiinv" function:
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/chiinv.shtml
>
> --Mary
>
> On Jun 23, 2011, at 12:06 PM, pliu@notes.cc.sunysb.edu wrote:
>
> Hi,
>
> The pre-compiled ncl6.0.0 is installed.
> nm $NCARG_ROOT/bin/ncl | grep -i gamma
> 0000000000833a4d T gamma_
>
> However,http://www.ncl.ucar.edu/Document/Functions/Built-in/gamma.shtml
> returns
>
> xgam=gamma(x)
> fatal:Undefined identifier: (gamma) is undefined, can't continue
> fatal:Execute: Error occurred at or near line 9
>
> This error also occurs on mirage3.ucar.edu
>
> Is there anything missing?
>
> Thanks
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 23 14:10:49 2011

This archive was generated by hypermail 2.1.8 : Thu Jun 30 2011 - 12:54:44 MDT