Compaq Fortran
User Manual for
OpenVMS Alpha Systems


Previous Contents Index


Chapter 15
Using the Compaq Extended Math Library (CXML)

The Compaq Extended Math Library (CXML), formerly known as the DIGITAL Extended Math Library (DXML), 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. It significantly improves the run-time performance of certain Compaq Fortran programs.

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

The CXML reference guide is available in both online and hardcopy formats. You can obtain this documentation by accessing the following files:

Example programs are also provided with CXML. These programs are located in the following directory:

SYS$COMMON:[SYSHLP.EXAMPLES.CXML]

This chapter contains the following topics about CXML:

15.1 CXML Routine Groups

CXML provides a comprehensive set of highly efficient mathematical subroutines designed for use in many different types of scientific and engineering applications. CXML includes the following functional groups of subroutines:

The routines are described in Table 15-1.

Table 15-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 symmetrically shaped sparse matrices stored using the compressed row storage scheme. The iterative solver package supports 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 OpenVMS Alpha systems.

15.2 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.

The CXML routines can be called explicitly by your program. There are separate CXML libraries for the IEEE and the VAX floating-point formats. You must compile your program for one of these float formats and then link to the matching CXML library (either IEEE or VAX), depending upon how you compiled the program.

Either the IEEE or VAX CXML library can be established as the systemwide default by the system startup procedure. Individual users can select between the VAX and IEEE version by executing the SYS$LIBRARY:CXML$SET_LIB command procedure. For example, the following command alters the default CXML link library for the current user to the VAX format library:


$ @SYS$LIBRARY:CXML$SET_LIB VAX 

For more details, see the section about CXML post-installation startup options in the Compaq Fortran Installation Guide for OpenVMS Alpha Systems.

If needed, you can instead specify the appropriate CXML library or libraries on the LINK command line (use the /LIBRARY qualifier after each library file name). You must compile your program and then link to the appropriate CXML library (either IEEE or VAX), depending upon how you compiled the program. The following examples show the corresponding CXML commands for compiling and linking for cases where the CXML default library is not used:


$ FORTRAN /FLOAT=IEEE_FLOAT MYPROG.F90 
$ LINK MYPROG.OBJ, SYS$LIBRARY:CXML$IMAGELIB_TS/LIBRARY

The link command uses the name of the CXML library for IEEE floating-point data, cxml$imagelib_ts . To use VAX floating-point data, specify the CXML library name as cxml$imagelib_gs .

If you are using an older version of CXML, use dxml$xxxxx instead of cxml$xxxxx as the library name. For more information on using CXML and specifying the correct object libraries on the LINK command, see the Compaq Extended Mathematical Library Reference Manual.

15.3 CXML Program Example

The free-form Fortran 90 example program below invokes the function SAXPY from the BLAS portion of the CXML Libraries. The SAXPY function computes a*x+y .


   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 


Previous Next Contents Index