Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp


 
hp.com home
End of Jump to page title


Math Libraries
Jump to content
Jump to content

» Math Libraries

product information
» home
» introduction
» news
» downloads
» documentation
» FAQs
» support

related links
» Tru64 UNIX
» OpenVMS
» Linux at Compaq
» Professional Linux Developer's Software
» Developer's Toolkit Supplement
» high performance
technical computing
Content starts here
 
 CPML faqs

This collection of Frequently Asked Questions (FAQs) for CPML provides brief answers to many common questions about the Compaq Portable Math Library. You will also find links to more detailed information available on our site.

This is a good place to start looking for answers to your questions. If you cannot find your answer here, please send us email. We welcome your questions and will provide prompt answers.


General Questions (all operating systems):

Tru64 UNIX Questions:

Linux Questions:


General Answers (all operating systems):

Q: How do I call complex functions like cexp and clog?

A: It is a little tricky to call the CPML complex functions directly, because our complex functions return their values using a private interface. The real and imaginary parts are returned in floating registers f0 and f1.

In Fortran, there is no problem. Fortran supports complex datatypes like COMPLEX*16. The Compaq Fortran compiler recognizes clog and cexp, so it knows where to pick up the return values; for example,

program call_complex

double complex w, z
double precision a, b

a = 2.0
b = 3.0
w = cmplx(a,b)
z = log(w)
print *, "log(", w, ") = ", z
end

There is no complex datatype in C - yet. C99 will support complex numbers and complex functions. The Compaq C99 compiler (and friends) will provide a header file with the prototypes for the complex functions. The C99 compiler will understand how to get the return values.

In the meantime, until C99 is available, if you want to call complex functions from Compaq C you could try something like the following example. This will not work on gcc or other non-Compaq C compilers.

#pragma linkage complex_linkage = ( result (f0, f1) )
#pragma use_linkage complex_linkage ( clog ) 

typedef struct { double r, i; } D_COMPLEX ; 

extern D_COMPLEX clog ( double, double );

main()
{
     D_COMPLEX z;
     double a, b, r, i;

     a = 2.0;
     b = 3.0;
     z = clog(a, b);
     r = z.r ; 	/* real part */
     i = z.i ; 	/* imaginary part */
     printf("clog(%f,%f) = (%f,%f)\n",a,b,r,i);
}

In the above program, you defined a struct, D_COMPLEX, to receive the complex number that the complex function clog computes.

The "complex_linkage" pragmas tell the Compaq C compiler how the complex function really returns its values, using that private interface.

Then you can just call the complex function, and the compiler will put the returned value into the real and imaginary members in the structure.

Back to Top


Tru64 UNIX Answers:

Q: CPML is supposed to come with Tru64 UNIX operating system, but I cannot find it on my system. Where is CPML?

A: On Tru64 UNIX, CPML is contained in the library /usr/lib/libm.a and in the shared object /usr/shlib/libm.so. If you link your application with -lm, you are using CPML. Tru64 UNIX does not have a separate package called CPML.

Back to Top


Linux Answers:

Q: I installed cpml_ev5/6-0.2/3 and I just did an upgrade to 0.4 or 5.0.0. There was no error message, but now I can't find /usr/lib/libcpml.so (or /usr/lib/cpml.h). What happened?

A: What is happening is that after the new kit gets installed, the old kit runs its "post-delete" script and deletes the symbolic links.

You have to delete the old kit (using rpm -e) and then install the new kit (using rpm -i).

Back to Top


Q: Can I install both cpml_ev5 and cpml_ev6?

A: To use libcpml, you only need to install one cpml package. We recommend that you install the cpml package that matches your hardware: cpml_ev5 on ev4 and ev5 systems, cpml_ev6 on ev6 systems.

Note that the "ev6" libcpml uses a few hardware instructions that are available only on ev6 and later systems. Therefore, if you link your application against the libcpml.a from the cpml_ev6 package, the application may trap when executing on an ev4 or ev5 system.

But, if you really want to install more than one copy of CPML on a system, please note that all cpml packages share the following common files (symbolic links):

/usr/include/cpml.h
/usr/lib/libcpml.a
/usr/lib/libcpml.so

Because of this sharing, rpm will complain if you do a plain installation of another cpml package.

Here is a way to install multiple cpml packages with different version or different architecture or both:

  1. You should write down the current link of the shared files, so that you can recover the links if you deinstall another cpml package. For example:
    /usr/lib/libcpml.a -> 
    /usr/lib/compaq/cpml-n.n.n/libcpml_ev5.a
    
  2. You can use the --replacefiles flag to tell rpm command to overwrite the shared files. For example:

    rpm -i -vv --replacefiles cpml_ev6-n.n.n-1.alpha.rpm

  3. When you deinstall one of the cpml packages, restore any symbolic links if necessary:
     
    ln -sf /usr/lib/compaq/cpml-n.n.n/libcpml_ev5.a 
    /usr/lib/libcpml.a 
    

Back to Top


Q: I just installed the cpml package, but the shared CPML library is an empty file. Why is that?

A: During the installation, rpm runs a script to construct the shared CPML library. There are several possibilities why this might fail:

  1. The libots rpm package might not be installed. The shared CPML library currently requires the libots package in order to link.

    The libots rpm package is available for free download from the Compaq Fortran kits.

  2. The cpml and libots packages were installed on the same command line but the cpml package was listed before the libots package.
  3. On Debian systems, the alien utility that reconfigures rpm packages does not always translate the scripts.

    For preceding cases 2 and 3 and other situations where you want to construct the shared CPML library, here is the script. You may need to change the version numbers. For example,

cd /usr/lib/compaq/cpml-5.1.0
rm -f /usr/lib/compaq/cpml-5.1.0/libcpml_ev5.so
ld -shared -o libcpml_ev5.so -soname libcpml.so \
   -whole-archive libcpml_ev5.a -no-whole-archive -lots
strip libcpml_ev5.so
/sbin/ldconfig

Back to Top


  » buy online or call 1.800.282.6672
privacy statement using this site means you accept its terms support