IBM Books

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

SGES, DGES, CGES, and ZGES--General Matrix, Its Transpose, or Its Conjugate Transpose Solve

These subroutines solve the system Ax = b for x, where A is a general matrix and x and b are vectors. Using the iopt argument, they can also solve the real system ATx = b or the complex system AHx = b for x. 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 88. Data Types

A, b, x Subroutine
Short-precision real SGES
Long-precision real DGES
Short-precision complex CGES
Long-precision complex ZGES
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 SGES | DGES | CGES | ZGES (a, lda, n, ipvt, bx, iopt)
C and C++ sges | dges | cges | zges (a, lda, n, ipvt, bx, iopt);
PL/I CALL SGES | DGES | CGES | ZGES (a, lda, n, ipvt, bx, iopt);

On Entry

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

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.

bx
is the vector b of length n, containing the right-hand side of the system. Specified as: a one-dimensional array of (at least) length n, containing numbers of the data type indicated in Table 88.

iopt
determines the type of computation to be performed, where:

If iopt = 0, A is used in the computation.

If iopt = 1, AT is used in SGES and DGES. AH is used in CGES and ZGES.

Note:
No data should be moved to form AT or AH; that is, the matrix A should always be stored in its untransposed form.

Specified as: a fullword integer; iopt = 0 or 1.

On Return

bx
is the solution vector x of length n, containing the results of the computation. Returned as: a one-dimensional array, containing numbers of the data type indicated in Table 88.

Notes
  1. 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.
  2. 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.
  3. The vectors and matrices used in this computation must have no common elements; otherwise, results are unpredictable. See Concepts.

Function

The system Ax = b is solved for x, where A is a general matrix and x and b are vectors. Using the iopt argument, this subroutine can also solve the real system ATx = b or the complex system AHx = b for x. 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 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. lda <= 0
  2. n < 0
  3. n > lda
  4. iopt <> 0 or 1

Example 1

Part 1

This part of the example shows how to solve the system Ax = b, where matrix A is the same matrix factored in the Example 1 for SGEF and DGEF.

Call Statement and Input
           A  LDA  N   IPVT   BX  IOPT
           |   |   |    |     |    |
CALL SGES( A , 9 , 9 , IPVT , BX , 0  )

IPVT = (3, 4, 5, 6, 7, 8, 9, 8, 9)
BX = (4.0, 5.0, 9.0, 10.0, 11.0, 12.0, 12.0, 12.0, 33.0)
A = (same as output A in Example 1)

Output
BX       =  (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)

Part 2

This part of the example shows how to solve the system ATx = b, where matrix A is the input matrix factored in Example 1 for SGEF and DGEF. Most of the input is the same in Part 2 as in Part 1.

Call Statement and Input
           A  LDA  N   IPVT   BX  IOPT
           |   |   |    |     |    |
CALL SGES( A , 9 , 9 , IPVT , BX , 1  )

IPVT = (3, 4, 5, 6, 7, 8, 9, 8, 9)
BX = (6.0, 8.0, 10.0, 12.0, 13.0, 14.0, 15.0, 15.0, 15.0)
A = (same as output A in Example 1)

Output
BX       =  (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)

Example 2

Part 1

This part of the example shows how to solve the system Ax = b, where matrix A is the same matrix factored in the Example 2 for CGEF and ZGEF.

Call Statement and Input
           A  LDA  N   IPVT   BX  IOPT
           |   |   |    |     |    |
CALL CGES( A , 4 , 4 , IPVT , BX , 0  )

IPVT = (4, 4, 3, 4)
BX = ((-10.0, 85.0), (-6.0, 61.0), (10.0, 38.0),
(58.0, 168.0))
A = (same as output A in Example 1)

Output
BX       =  ((9.0, 0.0), (5.0, 1.0), (1.0, 6.0), (3.0, 4.0))

Part 2

This part of the example shows how to solve the system AHx = b, where matrix A is the input matrix factored in Example 2 for CGEF and ZGEF. Most of the input is the same in Part 2 as in Part 1.

Call Statement and Input
           A  LDA  N   IPVT   BX  IOPT
           |   |   |    |     |    |
CALL CGES( A , 4 , 4 , IPVT , BX , 1  )

IPVT = (4, 4, 3, 4)
BX = ((71.0, 12.0), (61.0, -70.0), (123.0, -34.0),
(68.0, 7.0))
A = (same as output A in Example 1)

Output
BX       =  ((9.0, 0.0), (5.0, 1.0), (1.0, 6.0), (3.0, 4.0))


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