IBM Books

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

SGETRS, DGETRS, CGETRS, and ZGETRS--General Matrix Multiple Right-Hand Side Solve

SGETRS and DGETRS solve one of the following systems of equations for multiple right-hand sides:

1. AX = B
2. ATX = B

CGETRS and ZGETRS solve one of the following systems of equations for multiple right-hand sides:

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

In the formulas above:

A represents the general matrix A containing the LU factorization.
B represents the general matrix B containing the right-hand sides in its columns.
X represents the general matrix B containing the solution vectors in its columns.

These subroutines use the results of the factorization of matrix A, produced by a preceding call to SGETRF, DGETRF, CGETRF, or ZGETRF, respectively.

Table 91. Data Types

A, B Subroutine
Short-precision real SGETRS
Long-precision real DGETRS
Short-precision complex CGETRS
Long-precision complex ZGETRS
Note:
The input to these solve subroutines must be the output from the factorization subroutines SGETRF, DGETRF, CGETRF and ZGETRF, respectively.

Syntax

Fortran CALL SGETRS | DGETRS | CGETRS | ZGETRS (transa, n, nrhs, a, lda, ipvt, bx, ldb, info)
C and C++ sgetrs | dgetrs | cgetrs | zgetrs (transa, n, nrhs, a, lda, ipvt, bx, ldb, info);
PL/I CALL SGETRS | DGETRS | CGETRS | ZGETRS (transa, n, nrhs, a, lda, ipvt, bx, ldb, info);

On Entry

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

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

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

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

Specified as: a single character; transa = 'N', 'T', or 'C'.

n
is the order of factored matrix A and the number of rows in matrix B. Specified as: a fullword integer; n >= 0.

nrhs
the number of right-hand sides--that is, the number of columns in matrix B used in the computation. Specified as: a fullword integer; nrhs >= 0.

a
is the factorization of matrix A, produced by a preceding call to SGETRF, DGETRF, CGETRF, or ZGETRF, respectively. Specified as: an lda by (at least) n array, containing numbers of the data type indicated in Table 91.

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

ipvt
is the integer vector ipvt of length n, containing the pivot indices produced by a preceding call to SGETRF, DGETRF, CGETRF, or ZGETRF, respectively. Specified as: a one-dimensional array of (at least) length n, containing fullword integers, where 1 <= ipvt(i) <= n.

bx
is the general matrix B containing the right-hand side of the system. Specified as: an ldb by (at least) nrhs array, containing numbers of the data type indicated in Table 91.

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

info
See On Return.

On Return

bx
is the solution X containing the results of the computation. Returned as: an ldb by (at least) nrhs array, containing numbers of the data type indicated in Table 91.

info
info has the following meaning:

If info = 0, the solve of general matrix A completed successfully.

Notes
  1. In your C program, argument info must be passed by reference.
  2. These subroutines accept lower case letters for the transa argument.
  3. For SGETRS and DGETRS, if you specify 'C' for the transa argument, it is interpreted as though you specified 'T'.
  4. The scalar data specified for input argument n must be the same for both _GETRF and _GETRS. In addition, the scalar data specified for input argument m in _GETRF must be the same as input argument n in both _GETRF and _GETRS.

    If, however, you do not plan to call _GETRS after calling _GETRF, then input arguments m and n in _GETRF do not need to be equal.

  5. The array data specified for input arguments a and ipvt for these subroutines must be the same as the corresponding output arguments for SGETRF, DGETRF, CGETRF, and ZGETRF, respectively.
  6. The matrices and vector used in this computation must have no common elements; otherwise, results are unpredictable. See Concepts.
  7. On both input and output, matrices A and B conform to LAPACK format.

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 CGETRS and ZGETRS)

where A, B, and X are general matrices. These subroutines uses the results of the factorization of matrix A, produced by a preceding call to SGETRF, DGETRF, CGETRF or ZGETRF, respectively. For details on the factorization, see SGETRF, DGETRF, CGETRF and ZGETRF--General Matrix Factorization.

If n = 0 or nrhs = 0, no computation is performed and the subroutine returns after doing some parameter checking. See references [|8, [36], and [62].

Error Conditions

Computational Errors

None

Note:
If the factorization performed by SGETRF, DGETRF, CGETRF or ZGETRF 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. transa <> 'N', 'T', or 'C'
  2. n < 0
  3. nrhs < 0
  4. n > lda
  5. n > ldb
  6. lda <= 0
  7. ldb <= 0

Example 1

This example shows how to solve the system AX = B, where matrix A is the same matrix factored in the Example 1 for DGETRF.

Call Statement and Input
           TRANSA  N  NRHS  A  LDA  IPIV  BX LDB  INFO
             |     |    |   |   |     |   |   |     |
CALL DGETRS('N' ,  9 ,  5 , A , 9 , IPIV, B , 9 , INFO)

IPVT = (9, 9, 9, 9, 9, 9, 9, 9, 9)
A = (same as output A in Example 1)
        *                                  *
        | 93.0  186.0  279.0  372.0  465.0 |
        | 84.4  168.8  253.2  337.6  422.0 |
        | 76.6  153.2  229.8  306.4  383.0 |
        | 70.0  140.0  210.0  280.0  350.0 |
B    =  | 65.0  130.0  195.0  260.0  325.0 |
        | 62.0  124.0  186.0  248.0  310.0 |
        | 61.4  122.8  184.2  245.6  307.0 |
        | 63.6  127.2  190.8  254.4  318.0 |
        | 69.0  138.0  207.0  276.0  345.0 |
        *                                  *

Output
        *                             *
        | 1.0   2.0   3.0   4.0   5.0 |
        | 2.0   4.0   6.0   8.0  10.0 |
        | 3.0   6.0   9.0  12.0  15.0 |
        | 4.0   8.0  12.0  16.0  20.0 |
B    =  | 5.0  10.0  15.0  20.0  25.0 |
        | 6.0  12.0  18.0  24.0  30.0 |
        | 7.0  14.0  21.0  28.0  35.0 |
        | 8.0  16.0  24.0  32.0  40.0 |
        | 9.0  18.0  27.0  36.0  45.0 |
        *                             *
INFO     =  0

Example 2

This example shows how to solve the system AX = b, where matrix A is the same matrix factored in the Example 2 for ZGETRF.

Call Statement and Input
           TRANS   N  NRHS  A  LDA  IPIV  B  LDB  INFO
             |     |    |   |   |     |   |   |     |
CALL ZGETRS('N' ,  9 ,  5 , A , 9 , IPIV, B , 9 , INFO)

IPVT = (9, 9, 9, 9, 9, 9, 9, 9, 9)
A = (same as output A in Example 2)


        *                                                                           *
        | (193.0,-10.6)  (200.0, 21.8)  (207.0, 54.2)  (214.0, 86.6)  (221.0,119.0) |
        | (173.8, -9.4)  (178.8, 20.2)  (183.8, 49.8)  (188.8, 79.4)  (193.8,109.0) |
        | (156.2, -5.4)  (159.2, 22.2)  (162.2, 49.8)  (165.2, 77.4)  (168.2,105.0) |
        | (141.0,  1.4)  (142.0, 27.8)  (143.0, 54.2)  (144.0, 80.6)  (145.0,107.0) |
B    =  | (129.0, 11.0)  (128.0, 37.0)  (127.0, 63.0)  (126.0, 89.0)  (125.0,115.0) |
        | (121.0, 23.4)  (118.0, 49.8)  (115.0, 76.2)  (112.0,102.6)  (109.0,129.0) |
        | (117.8, 38.6)  (112.8, 66.2)  (107.8, 93.8)  (102.8,121.4)   (97.8,149.0) |
        | (120.2, 56.6)  (113.2, 86.2)  (106.2,115.8)   (99.2,145.4)   (92.2,175.0) |
        | (129.0, 77.4)  (120.0,109.8)  (111.0,142.2). (102.0,174.6)   (93.0,207.0) |
        *                                                                           *

Output


        *                                                     *
        | (1.0,1.0)  (1.0,2.0)  (1.0,3.0) (1.0,4.0) (1.0,5.0) |
        | (2.0,1.0)  (2.0,2.0)  (2.0,3.0) (2.0,4.0) (2.0,5.0) |
        | (3.0,1.0)  (3.0,2.0)  (3.0,3.0) (3.0,4.0) (3.0,5.0) |
        | (4.0,1.0)  (4.0,2.0)  (4.0,3.0) (4.0,4.0) (4.0,5.0) |
B     = | (5.0,1.0)  (5.0,2.0)  (5.0,3.0) (5.0,4.0) (5.0,5.0) |
        | (6.0,1.0)  (6.0,2.0)  (6.0,3.0) (6.0,4.0) (6.0,5.0) |
        | (7.0,1.0)  (7.0,2.0)  (7.0,3.0) (7.0,4.0) (7.0,5.0) |
        | (8.0,1.0)  (8.0,2.0)  (8.0,3.0) (8.0,4.0) (8.0,5.0) |
        | (9.0,1.0)  (9.0,2.0)  (9.0,3.0) (9.0,4.0) (9.0,5.0) |
        *                                                     *
INFO     =  0


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