comparison libcruft/lapack/cgesv.f @ 7789:82be108cc558

First attempt at single precision tyeps * * * corrections to qrupdate single precision routines * * * prefer demotion to single over promotion to double * * * Add single precision support to log2 function * * * Trivial PROJECT file update * * * Cache optimized hermitian/transpose methods * * * Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author David Bateman <dbateman@free.fr>
date Sun, 27 Apr 2008 22:34:17 +0200
parents
children
comparison
equal deleted inserted replaced
7788:45f5faba05a2 7789:82be108cc558
1 SUBROUTINE CGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
2 *
3 * -- LAPACK driver routine (version 3.1) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8 INTEGER INFO, LDA, LDB, N, NRHS
9 * ..
10 * .. Array Arguments ..
11 INTEGER IPIV( * )
12 COMPLEX A( LDA, * ), B( LDB, * )
13 * ..
14 *
15 * Purpose
16 * =======
17 *
18 * CGESV computes the solution to a complex system of linear equations
19 * A * X = B,
20 * where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
21 *
22 * The LU decomposition with partial pivoting and row interchanges is
23 * used to factor A as
24 * A = P * L * U,
25 * where P is a permutation matrix, L is unit lower triangular, and U is
26 * upper triangular. The factored form of A is then used to solve the
27 * system of equations A * X = B.
28 *
29 * Arguments
30 * =========
31 *
32 * N (input) INTEGER
33 * The number of linear equations, i.e., the order of the
34 * matrix A. N >= 0.
35 *
36 * NRHS (input) INTEGER
37 * The number of right hand sides, i.e., the number of columns
38 * of the matrix B. NRHS >= 0.
39 *
40 * A (input/output) COMPLEX array, dimension (LDA,N)
41 * On entry, the N-by-N coefficient matrix A.
42 * On exit, the factors L and U from the factorization
43 * A = P*L*U; the unit diagonal elements of L are not stored.
44 *
45 * LDA (input) INTEGER
46 * The leading dimension of the array A. LDA >= max(1,N).
47 *
48 * IPIV (output) INTEGER array, dimension (N)
49 * The pivot indices that define the permutation matrix P;
50 * row i of the matrix was interchanged with row IPIV(i).
51 *
52 * B (input/output) COMPLEX array, dimension (LDB,NRHS)
53 * On entry, the N-by-NRHS matrix of right hand side matrix B.
54 * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
55 *
56 * LDB (input) INTEGER
57 * The leading dimension of the array B. LDB >= max(1,N).
58 *
59 * INFO (output) INTEGER
60 * = 0: successful exit
61 * < 0: if INFO = -i, the i-th argument had an illegal value
62 * > 0: if INFO = i, U(i,i) is exactly zero. The factorization
63 * has been completed, but the factor U is exactly
64 * singular, so the solution could not be computed.
65 *
66 * =====================================================================
67 *
68 * .. External Subroutines ..
69 EXTERNAL CGETRF, CGETRS, XERBLA
70 * ..
71 * .. Intrinsic Functions ..
72 INTRINSIC MAX
73 * ..
74 * .. Executable Statements ..
75 *
76 * Test the input parameters.
77 *
78 INFO = 0
79 IF( N.LT.0 ) THEN
80 INFO = -1
81 ELSE IF( NRHS.LT.0 ) THEN
82 INFO = -2
83 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
84 INFO = -4
85 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
86 INFO = -7
87 END IF
88 IF( INFO.NE.0 ) THEN
89 CALL XERBLA( 'CGESV ', -INFO )
90 RETURN
91 END IF
92 *
93 * Compute the LU factorization of A.
94 *
95 CALL CGETRF( N, N, A, LDA, IPIV, INFO )
96 IF( INFO.EQ.0 ) THEN
97 *
98 * Solve the system A*X = B, overwriting B with X.
99 *
100 CALL CGETRS( 'No transpose', N, NRHS, A, LDA, IPIV, B, LDB,
101 $ INFO )
102 END IF
103 RETURN
104 *
105 * End of CGESV
106 *
107 END