Go to main content
Oracle® Developer Studio 12.6: Performance Library User's Guide

Exit Print View

Updated: July 2017
 
 

Matrix Storage Schemes

Some Oracle Developer Studio Performance Library routines that work with arrays stored normally have corresponding routines that take advantage of these special storage forms. For example, DGBMV will form the product of a general matrix in banded storage and a vector, and DTPMV will form the product of a triangular matrix in packed storage and a vector.

Banded Storage

A banded matrix is stored so the jth column of the matrix corresponds to the jth column of the Fortran array.

The following code copies a banded general matrix in a general array into banded storage mode.

 C     Copy the matrix A from the array AG to the array AB. The
 C     matrix is stored in general storage mode in AG and it will
 C     be stored in banded storage mode in AB. The code to copy
 C     from general to banded storage mode is taken from the
 C     comment block in the original DGBFA by Cleve Moler.
 C
       NSUB = 1
       NSUPER = 2
       NDIAG = NSUB + 1 + NSUPER
       DO ICOL = 1, N
         I1 = MAX0 (1, ICOL - NSUPER)
         I2 = MIN0 (N, ICOL + NSUB)
         DO IROW = I1, I2
           IROWB = IROW - ICOL + NDIAG
           AB(IROWB,ICOL) = AG(IROW,ICOL)
         END DO
       END DO

This method of storing banded matrices is compatible with the storage method used by LAPACK and BLAS.

Packed Storage

A packed vector is an alternative representation for a triangular, symmetric, or Hermitian matrix. An array is packed into a vector by storing the elements sequentially column by column into the vector. Space for the diagonal elements is always reserved, even if the values of the diagonal elements are known, such as in a unit diagonal matrix.

An upper triangular matrix or a symmetric matrix whose upper triangle is stored in general storage in the array A, can be transferred to packed storage in the array AP as shown below. This code comes from the comment block of the LAPACK routine DTPTRI.

   JC = 1
   DO J = 1, N
      DO I = 1, J
         AP(JC+I-1) = A(I,J)
      END DO
      JC = JC + J
    END DO

Similarly, a lower triangular matrix or a symmetric matrix whose lower triangle is stored in general storage in the array A, can be transferred to packed storage in the array AP as shown below:

   JC = 1
   DO J = 1, N
      DO I = J, N
         AP(JC+I-1) = A(I,J)
      END DO
      JC = JC + N - J + 1
   END DO

Rectangular Full Packed Format

Rectangular Full Packed (RFP) matrices is a data format for storing triangular and symmetric matrices. It combines the standard packed format arrays fully utilized storage with high performance using level 3 BLAS. For information, see Rectangular Full Packed Format for LAPACK Algorithms Timings on Several Computers (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.456.7563&rep=rep1&type=pdf) and "Further Details" section of the man pages for the routines that use Rectangular Full Packed Format.