Compaq Fortran
User Manual for
Tru64 UNIX and
Linux Alpha Systems


Previous Contents Index


Chapter 13
Using the Compaq Extended Math Library (CXML)

This chapter contains the following topics:

13.1 What Is CXML?

The Compaq Extended Math Library (CXML) provides a comprehensive set of mathematical library routines callable from Fortran and other languages. CXML contains a set of over 1500 high-performance mathematical subprograms designed for use in many different types of scientific and engineering applications.

CXML is included with Compaq Fortran for Tru64 UNIX Systems and can be installed using the instructions in the Compaq Fortran Installation Guide for Tru64 UNIX Systems.

CXML kits for Tru64 UNIX are also available from the Compaq Math Libraries Web site, which always has the latest version:


http://www.compaq.com/math 

Since CXML might have been updated since the Compaq Fortran kit was released, you should check the Web site to make sure you have the latest version.

CXML is available as a separate download item for Linux Alpha systems. For more information, see the Compaq Math Libraries Web site.

CXML documentation is also available at the Web site. See Section 13.5, CXML Documentation.

13.2 CXML Routine Groups

CXML routines include those for basic linear algebra (BLAS), signal processing, sparse linear system solution, linear algebra (LAPACK), and utilities related to random numbers, vector math, and sorting. The routines are described in Table 13-1.

Table 13-1 CXML Routine Groups
Name Description
Basic Linear Algebra The Basic Linear Algebra Subprograms (BLAS) library includes the industry-standard Basic Linear Algebra Subprograms for Level 1 (vector-vector, BLAS1), Level 2 (matrix-vector, BLAS2), and Level 3 (matrix-matrix, BLAS3). Also included are subprograms for BLAS Level 1 Extensions, and Sparse BLAS Level 1.
Signal Processing The Signal Processing library provides a basic set of signal processing functions. Included are one-, two-, and three-dimensional Fast Fourier Transforms (FFT), group FFTs, Cosine/Sine Transforms (FCT/FST), Convolution, Correlation, and Digital Filters.
Sparse Linear System The Sparse Linear System library provides both direct and iterative sparse linear system solvers. The direct solver package supports both symmetric and nonsymmetric sparse matrices stored using the skyline storage scheme. The iterative solver package contains a basic set of storage schemes, preconditioners, and iterative solvers.
LAPACK LAPACK is an industry-standard subprogram package offering an extensive set of linear system and eigenproblem solvers. LAPACK uses blocked algorithms that are better suited to most modern architectures, particularly ones with memory hierarchies.
Utility subprograms Utility subprograms include random number generation, vector math functions, and sorting subprograms.

Where appropriate, each subprogram has a version to support each combination of real or complex and single or double precision arithmetic. In addition, selected key CXML routines are available in parallel form as well as serial form on Compaq Tru64 UNIX systems.

13.3 Using CXML from Fortran

To use CXML, you need to make the CXML routines and their interfaces available to your program and specify the appropriate libraries when linking. To specify the CXML routines library when linking, use the -lcxml option. To compile and link a Fortran program that contains calls to CXML routines on Tru64 UNIX or Linux Alpha systems, use one of the following commands:
Operating System Command
Tru64 UNIX f90 my_prog.f90 -lcxml
Linux fort my_prog.f -lcxml

For example, to link a Fortran 90 program with the serial CXML library on a Tru64 UNIX system, you would give this command:


% f90 my_prog.f90 -lcxml

On Tru64 UNIX systems, selected key CXML routines have been parallelized using OpenMP. To link with the parallel version of the CXML library, use -lcxmlp instead of -lcxml .

13.4 CXML Program Example

Example 13-1, Fortran Example Program Using CXML invokes the function SAXPY from the BLAS portion of the CXML Libraries. The SAXPY function computes a*x+y .

Example 13-1 Fortran Example Program Using CXML

   PROGRAM example 
! 
!  This free-form example demonstrates how to call 
!  CXML routines from Fortran. 
! 
   REAL(KIND=4)    :: a(10) 
   REAL(KIND=4)    :: x(10) 
   REAL(KIND=4)    :: alpha 
   INTEGER(KIND=4) :: n 
   INTEGER(KIND=4) :: incx 
   INTEGER(KIND=4) :: incy 
   n = 5 ; incx = 1 ; incy = 1 ; alpha = 3.0 
   DO i = 1,n 
     a(i) = FLOAT(i) 
     x(i) = FLOAT(2*i) 
   ENDDO 
   PRINT 98, (a(i),i=1,n) 
   PRINT 98, (x(i),i=1,n) 
98 FORMAT(' Input = ',10F7.3) 
   CALL saxpy( n, alpha, a, incx, x, incy ) 
   PRINT 99, (x(i),I=1,n) 
99 FORMAT(/,' Result = ',10F7.3) 
   STOP 
   END PROGRAM example 

13.5 CXML Documentation

For more information, see the following CXML documentation, available at the Math Libraries Web site described in Section 13.1, What Is CXML?:

When CXML is installed on Tru64 UNIX systems, subsets containing reference pages in both traditional ("man page") and HTML format can be installed.

When CXML is installed on Linux systems, the reference pages are available in HTML format and are placed in a /usr/doc subdirectory.


Previous Next Contents Index