Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#593 External library part 2: netlib

None
closed-out-of-date
Ethan Merritt
None
5
2014-03-03
2012-08-16
Ethan Merritt
No

This is a second proof-of-principle patch implementing recognition
and use of special functions from an external library. Whereas the
first patch used libgsl as an example, this one uses a library built
from the AMOS routines maintained as part of netlib (http://netlib.org).

Neither AMOS or netlib is commonly available as a pre-packaged library
for linux, so I include here a minimal tarball of files to create one.

Two files are attached here. One is the patch to gnuplot.
The other is the tarball to build and install libamos.so.

libamos_15aug2012.patch:
- Patches configure.in to search for the routine "cairy"
in a library "libamos" in the current library search path.
- Adds files src/bessel.c src/bessel.h containing a wrapper
for the fortran routine cairy in libamos.so.
- Modifies src/eval.c to add callable function amos_airy(z)
where z is a complex number.

libamos.tgz:
This is a tarball of a directory libamos/ containing relevant fortran
routines from netlib, a Makefile, and some C langage constants to
describe to the netlib code that we want 8-byte floating point and
4-byte integers. It assumes gfortran. Tested on both 32bit and
64bit linux using gfortran 4.4.3.

Unpack the tarball and run "make". "make install" will try to
copy the new library libamos.so to /usr/local/lib. You may prefer
to put it somewhere else, but either way you need to make sure the
library directory in the current search path. Either use
ldconfig or set LD_LIBRARY_PATH.

The following test shows the discepancy between the low precision
airy() function currently in gnuplot and the netlib amos_airy().
plot [0:10] abs(airy(x) - amos_airy(x)) / amos_airy(x)

This shows the behavior in the complex plane:
set view map
set log cb
set isosamples 100,100
set xr [-10:10]
set yr [-10:10]

set title 'Real component of Ai(z)'
splot real(amos_airy( x + y*{0,1} )) with pm3d
pause -1

set title 'Imaginary component of Ai(z)'
splot imag(amos_airy( x + y*{0,1} )) with pm3d
pause -1

set title 'Modulus of Ai(z)'
splot abs(amos_airy( x + y*{0,1} )) with pm3d
pause -1

Discussion

  • Ethan Merritt
    Ethan Merritt
    2012-08-16

    Patch to invoke libamos routine cairy from gnuplot

     
  • Ethan Merritt
    Ethan Merritt
    2012-08-16

    tarball for building a copy of libamos

     
    Attachments
  • Ethan Merritt
    Ethan Merritt
    2012-08-16

    demo of airy function in the complex plane

     
    Attachments
  • Ethan Merritt
    Ethan Merritt
    2012-08-16

    README for this patch set

     
    Attachments
  • Ethan Merritt
    Ethan Merritt
    2013-03-27

    • assigned_to: Ethan Merritt
    • milestone: -->
     
  • Ethan Merritt
    Ethan Merritt
    2014-03-03

    Superseded by
    libcerf.c (example of supporting a specific foreign library)
    plugin.dem (example of run-time import from a foreign library)

     
  • Ethan Merritt
    Ethan Merritt
    2014-03-03

    • status: open --> closed-out-of-date