IBM Books

Engineering and Scientific Subroutine Library for AIX Version 3 Release 3: Guide and Reference

SGESM, DGESM, CGESM, and ZGESM--General Matrix, Its Transpose, or Its Conjugate Transpose Multiple Right-Hand Side Solve

These subroutines solve the following systems of equations for multiple right-hand sides, where A, X, and B are general matrices. SGESM and DGESM solve one of the following:

1. AX = B
2. ATX = B

CGESM and ZGESM solve one of the following:

1. AX = B
2. ATX = B
3. AHX = B

These subroutines use the results of the factorization of matrix A, produced by a preceding call to SGEF/SGEFCD, DGEF/DGEFP/DGEFCD, CGEF, or ZGEF, respectively.

Table 89. Data Types

A, B, X Subroutine
Short-precision real SGESM
Long-precision real DGESM
Short-precision complex CGESM
Long-precision complex ZGESM
Note:
The input to these solve subroutines must be the output from the factorization subroutines SGEF/SGEFCD, DGEF/DGEFP/DGEFCD, CGEF, and ZGEF, respectively.

Syntax

Fortran CALL SGESM | DGESM | CGESM | ZGESM (trans, a, lda, n, ipvt, b, ldb, nrhs)
C and C++ sgesm | dgesm | cgesm | zgesm (trans, a, lda, n, ipvt, b, ldb, nrhs);
PL/I CALL SGESM | DGESM | CGESM | ZGESM (trans, a, lda, n, ipvt, b, ldb, nrhs);

On Entry

trans
indicates the form of matrix A to use in the computation, where:

If transa = 'N', A is used in the computation, resulting in equation 1.

If transa = 'T', AT is used in the computation, resulting in equation 2.

If transa = 'C', AH is used in the computation, resulting in equation 3.

Specified as: a single character. It must be 'N', 'T', or 'C'.

a
is the factorization of matrix A, produced by a preceding call to SGEF/SGEFCD, DGEF/DGEFP/DGEFCD, CGEF, or ZGEF, respectively. Specified as: an lda by (at least) n array, containing numbers of the data type indicated in Table 89.

lda
is the leading dimension of the array specified for a. Specified as: a fullword integer; lda > 0 and lda >= n.

n
is the order of matrix A. Specified as: a fullword integer; 0 <= n <= lda.

ipvt
is the integer vector ipvt of length n, containing the pivot indices produced by a preceding call to SGEF/SGEFCD, DGEF/DGEFP/DGEFCD, CGEF, or ZGEF, respectively. Specified as: a one-dimensional array of (at least) length n, containing fullword integers.

b
is the matrix B, containing the nrhs right-hand sides of the system. The right-hand sides, each of length n, reside in the columns of matrix B. Specified as: an ldb by (at least) nrhs array, containing numbers of the data type indicated in Table 89.

ldb
is the leading dimension of the array specified for b. Specified as: a fullword integer; ldb > 0 and ldb >= n.

nrhs
is the number of right-hand sides in the system to be solved. Specified as: a fullword integer; nrhs >= 0.

On Return

b
is the matrix B, containing the nrhs solutions to the system in the columns of B. Specified as: an ldb by (at least) nrhs array, containing numbers of the data type indicated in Table 89.

Notes
  1. For SGESM and DGESM, if you specify 'C' for the trans argument, it is interpreted as though you specified 'T'.
  2. The scalar data specified for input arguments lda and n for these subroutines must be the same as the corresponding input arguments specified for SGEF/SGEFCD, DGEF/DGEFP/DGEFCD, CGEF, and ZGEF, respectively.
  3. The array data specified for input arguments a and ipvt for these subroutines must be the same as the corresponding output arguments for SGEF/SGEFCD, DGEF/DGEFP/DGEFCD, CGEF, and ZGEF, respectively.
  4. The vectors and matrices used in this computation must have no common elements; otherwise, results are unpredictable. See Concepts.

Function

One of the following systems of equations is solved for multiple right-hand sides:

1. AX = B
2. ATX = B
3. AHX = B (only for CGESM and ZGESM)

where A, B, and X are general matrices. These subroutines use the results of the factorization of matrix A, produced by a preceding call to SGEF/SGEFCD, DGEF/DGEFP/DGEFCD, CGEF, or ZGEF, respectively. For a description of how A is factored, see SGEF, DGEF, CGEF, and ZGEF--General Matrix Factorization.

If n or nrhs is 0, no computation is performed. See references [36] and [38].

Error Conditions

Computational Errors

None

Note:
If the factorization performed by SGEF, DGEF, CGEF, ZGEF, SGEFCD, DGEFCD, or DGEFP failed because a pivot element is zero, the results returned by this subroutine are unpredictable, and there may be a divide-by-zero program exception message.

Input-Argument Errors
  1. trans <> 'N', 'T', or 'C'
  2. lda, ldb <= 0
  3. n < 0
  4. n > lda, ldb
  5. nrhs < 0

Example 1

Part 1

This part of the example shows how to solve the system AX = B for two right-hand sides, where matrix A is the same matrix factored in the Example 1 for SGEF and DGEF.

Call Statement and Input
           TRANS  A  LDA  N   IPVT   B  LDB  NRHS
             |    |   |   |    |     |   |    |
CALL SGESM( 'N' , A , 9 , 9 , IPVT , B , 9 ,  2  )

IPVT = (3, 4, 5, 6, 7, 8, 9, 8, 9)
A = (same as output A in Example 1)
        *             *
        |  4.0   10.0 |
        |  5.0   15.0 |
        |  9.0   24.0 |
        | 10.0   35.0 |
B    =  | 11.0   48.0 |
        | 12.0   63.0 |
        | 12.0   70.0 |
        | 12.0   78.0 |
        | 33.0  266.0 |
        *             *

Output
        *          *
        | 1.0  1.0 |
        | 1.0  2.0 |
        | 1.0  3.0 |
        | 1.0  4.0 |
B    =  | 1.0  5.0 |
        | 1.0  6.0 |
        | 1.0  7.0 |
        | 1.0  8.0 |
        | 1.0  9.0 |
        *          *

Part 2

This part of the example shows how to solve the system ATX = B for two right-hand sides, where matrix A is the input matrix factored in Example 1 for SGEF and DGEF.

Call Statement and Input
           TRANS  A  LDA  N   IPVT   B  LDB  NRHS
             |    |   |   |    |     |   |    |
CALL SGESM( 'T' , A , 9 , 9 , IPVT , B , 9 ,  2  )

IPVT = (3, 4, 5, 6, 7, 8, 9, 8, 9)
A = (same as output A in Example 1)
        *             *
        |  6.0   15.0 |
        |  8.0   26.0 |
        | 10.0   40.0 |
        | 12.0   57.0 |
B    =  | 13.0   76.0 |
        | 14.0   97.0 |
        | 15.0  120.0 |
        | 15.0  125.0 |
        | 15.0  129.0 |
        *             *

Output
        *          *
        | 1.0  1.0 |
        | 1.0  2.0 |
        | 1.0  3.0 |
        | 1.0  4.0 |
B    =  | 1.0  5.0 |
        | 1.0  6.0 |
        | 1.0  7.0 |
        | 1.0  8.0 |
        | 1.0  9.0 |
        *          *

Example 2

Part 1

This part of the example shows how to solve the system AX = B for two right-hand sides, where matrix A is the same matrix factored in the Example 2 for CGEF and ZGEF.

Call Statement and Input
           TRANS  A  LDA  N   IPVT   B  LDB  NRHS
             |    |   |   |    |     |   |    |
CALL CGESM( 'N' , A , 4 , 4 , IPVT , B , 4 ,  2  )

IPVT = (4, 4, 3, 4)
A = (same as output A in Example 2)
        *                              *
        | (-10.0, 85.0)  (-11.0, 53.0) |
B    =  |  (-6.0, 61.0)   (-6.0, 54.0) |
        |  (10.0, 38.0)    (2.0, 40.0) |
        | (58.0, 168.0)  (15.0, 105.0) |
        *                              *

Output
        *                        *
        | (9.0, 0.0)  (1.0, 1.0) |
B    =  | (5.0, 1.0)  (2.0, 2.0) |
        | (1.0, 6.0)  (3.0, 3.0) |
        | (3.0, 4.0)  (4.0, 4.0) |
        *                        *

Part 2

This part of the example shows how to solve the system ATX = B for two right-hand sides, where matrix A is the input matrix factored in Example 2 for CGEF and ZGEF.

Call Statement and Input
           TRANS  A  LDA  N   IPVT   B  LDB  NRHS
             |    |   |   |    |     |   |    |
CALL CGESM( 'T' , A , 4 , 4 , IPVT , B , 4 ,  2  )

IPVT = (4, 4, 3, 4)
A = (same as output A in Example 2)
        *                               *
        |   (71.0, 12.0)   (18.0, 68.0) |
B    =  |  (61.0, -70.0)  (-27.0, 71.0) |
        | (123.0, -34.0)  (-11.0, 97.0) |
        |    (68.0, 7.0)   (28.0, 50.0) |
        *                               *

Output
        *                        *
        | (9.0, 0.0)  (1.0, 1.0) |
B    =  | (5.0, 1.0)  (2.0, 2.0) |
        | (1.0, 6.0)  (3.0, 3.0) |
        | (3.0, 4.0)  (4.0, 4.0) |
        *                        *

Part 3

This part of the example shows how to solve the system AHX = B for two right-hand sides, where matrix A is the input matrix factored in Example 2 for CGEF and ZGEF.

Call Statement and Input
           TRANS  A  LDA  N   IPVT   B  LDB  NRHS
             |    |   |   |    |     |   |    |
CALL CGESM( 'C' , A , 4 , 4 , IPVT , B , 4 ,  2  )

IPVT = (4, 4, 3, 4)
A = (same as output A in Example 2)
        *                              *
        |  (58.0, -3.0)   (45.0, 20.0) |
B    =  | (68.0, -31.0)  (83.0, -20.0) |
        | (89.0, -22.0)    (98.0, 1.0) |
        |  (53.0, 15.0)   (45.0, 25.0) |
        *                              *

Output
        *                        *
        | (1.0, 4.0)  (4.0, 5.0) |
B    =  | (2.0, 3.0)  (3.0, 4.0) |
        | (3.0, 2.0)  (2.0, 3.0) |
        | (4.0, 1.0)  (1.0, 2.0) |
        *                        *


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]