This section explains how to set up your scalar and array data and points you to where you can find more detail.
A scalar item is a single item of data, whether it is a constant, a variable, or an element of an array. ESSL assumes that your scalar data conforms to the appropriate standards, as described below. The scalar data types and how you should code them for each programming language are listed under "Coding Your Scalar Data" in each language section in Chapter 4, Coding Your Program.
|Scalar data passed to ESSL from all types of programs, including |Fortran, C, and C++, should conform to the ANSI/IEEE 32-bit and 64-bit binary |floating-point format, as described in the ANSI/IEEE |Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Standard |754-1985.
An array represents an area of storage in your program, containing data stored in a series of locations. An array has a single name. It is made up of one or more pieces of scalar data, all the same type. These are the elements of the array. It can be passed to the ESSL subroutine as input, returned to your program as output, or used for both input and output, in which case the original contents are overwritten.
Arrays can contain conceptual (mathematical) data structures, such as vectors, matrices, or sequences. There are many different types of data structures. Each type of data structure requires a unique arrangement of data in an array and does not necessarily have to include all the elements of the array. In addition, the elements of these data structures are not always contiguous in storage within an array. Stride and leading dimension arguments passed to ESSL subroutines define the separations in array storage for the elements of the vector, matrix, and sequence. All these aspects of data structures are described in Chapter 3, Setting Up Your Data Structures. You must first understand array storage techniques to fully understand the concepts of data structures, stride, and leading dimension, especially if you are using them in unconventional ways.
ESSL subroutines assume that all arrays passed to them are stored using the Fortran array storage techniques (in column-major order), and they process your data accordingly. For details, see Setting Up Arrays in Fortran. On the other hand, C, C++, and PL/I programs store arrays in row-major order. For details on what you can do, see:
All arrays, regardless of the type of data, should be aligned on a doubleword boundary to ensure optimal performance; however, when running on a POWER2 processor, it is best to align your long-precision arrays on a quadword boundary. For information on how your programming language aligns data, see your programming language manuals.
The amount of storage used by arrays and the storage arrangement of data in the arrays can affect overall program performance. As a result, ESSL provides subroutines that operate on different types of data structures, stored using various storage modes. You should chose a storage mode that conserves storage and potentially improves performance. For definitions of the various data structures and their corresponding storage modes, see Chapter 3, Setting Up Your Data Structures. You can also find special storage considerations, where applicable, in the "Notes" section of each subroutine description.
This section describes how you can convert from one storage mode to another.
ESSL provides several subroutines that help you convert from one storage mode to another:
In addition, sample programs are provided with many of the storage mode descriptions in Chapter 3, Setting Up Your Data Structures. You can use these sample programs to convert your data to the desired storage mode by adapting them to your application program.