|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* -- translated by f2c (version 19940927).
|
|
kusano |
7d535a |
You must link the resulting object file with the libraries:
|
|
kusano |
7d535a |
-lf2c -lm (in that order)
|
|
kusano |
7d535a |
*/
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#include "f2c.h"
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Subroutine */ int ctrsv_(char *uplo, char *trans, char *diag, integer *n,
|
|
kusano |
7d535a |
complex *a, integer *lda, complex *x, integer *incx)
|
|
kusano |
7d535a |
{
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* System generated locals */
|
|
kusano |
7d535a |
integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
|
|
kusano |
7d535a |
complex q__1, q__2, q__3;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Builtin functions */
|
|
kusano |
7d535a |
void c_div(complex *, complex *, complex *), r_cnjg(complex *, complex *);
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Local variables */
|
|
kusano |
7d535a |
static integer info;
|
|
kusano |
7d535a |
static complex temp;
|
|
kusano |
7d535a |
static integer i, j;
|
|
kusano |
7d535a |
extern logical lsame_(char *, char *);
|
|
kusano |
7d535a |
static integer ix, jx, kx;
|
|
kusano |
7d535a |
extern /* Subroutine */ int xerbla_(char *, integer *);
|
|
kusano |
7d535a |
static logical noconj, nounit;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Purpose
|
|
kusano |
7d535a |
=======
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
CTRSV solves one of the systems of equations
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
A*x = b, or A'*x = b, or conjg( A' )*x = b,
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
where b and x are n element vectors and A is an n by n unit, or
|
|
kusano |
7d535a |
non-unit, upper or lower triangular matrix.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
No test for singularity or near-singularity is included in this
|
|
kusano |
7d535a |
routine. Such tests must be performed before calling this routine.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Parameters
|
|
kusano |
7d535a |
==========
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
UPLO - CHARACTER*1.
|
|
kusano |
7d535a |
On entry, UPLO specifies whether the matrix is an upper or
|
|
kusano |
7d535a |
lower triangular matrix as follows:
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
UPLO = 'U' or 'u' A is an upper triangular matrix.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
UPLO = 'L' or 'l' A is a lower triangular matrix.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Unchanged on exit.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
TRANS - CHARACTER*1.
|
|
kusano |
7d535a |
On entry, TRANS specifies the equations to be solved as
|
|
kusano |
7d535a |
follows:
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
TRANS = 'N' or 'n' A*x = b.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
TRANS = 'T' or 't' A'*x = b.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
TRANS = 'C' or 'c' conjg( A' )*x = b.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Unchanged on exit.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
DIAG - CHARACTER*1.
|
|
kusano |
7d535a |
On entry, DIAG specifies whether or not A is unit
|
|
kusano |
7d535a |
triangular as follows:
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
DIAG = 'U' or 'u' A is assumed to be unit triangular.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
DIAG = 'N' or 'n' A is not assumed to be unit
|
|
kusano |
7d535a |
triangular.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Unchanged on exit.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
N - INTEGER.
|
|
kusano |
7d535a |
On entry, N specifies the order of the matrix A.
|
|
kusano |
7d535a |
N must be at least zero.
|
|
kusano |
7d535a |
Unchanged on exit.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
A - COMPLEX array of DIMENSION ( LDA, n ).
|
|
kusano |
7d535a |
Before entry with UPLO = 'U' or 'u', the leading n by n
|
|
kusano |
7d535a |
upper triangular part of the array A must contain the upper
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
triangular matrix and the strictly lower triangular part of
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
A is not referenced.
|
|
kusano |
7d535a |
Before entry with UPLO = 'L' or 'l', the leading n by n
|
|
kusano |
7d535a |
lower triangular part of the array A must contain the lower
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
triangular matrix and the strictly upper triangular part of
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
A is not referenced.
|
|
kusano |
7d535a |
Note that when DIAG = 'U' or 'u', the diagonal elements of
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
A are not referenced either, but are assumed to be unity.
|
|
kusano |
7d535a |
Unchanged on exit.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
LDA - INTEGER.
|
|
kusano |
7d535a |
On entry, LDA specifies the first dimension of A as declared
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
in the calling (sub) program. LDA must be at least
|
|
kusano |
7d535a |
max( 1, n ).
|
|
kusano |
7d535a |
Unchanged on exit.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
X - COMPLEX array of dimension at least
|
|
kusano |
7d535a |
( 1 + ( n - 1 )*abs( INCX ) ).
|
|
kusano |
7d535a |
Before entry, the incremented array X must contain the n
|
|
kusano |
7d535a |
element right-hand side vector b. On exit, X is overwritten
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
with the solution vector x.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
INCX - INTEGER.
|
|
kusano |
7d535a |
On entry, INCX specifies the increment for the elements of
|
|
kusano |
7d535a |
X. INCX must not be zero.
|
|
kusano |
7d535a |
Unchanged on exit.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Level 2 Blas routine.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
-- Written on 22-October-1986.
|
|
kusano |
7d535a |
Jack Dongarra, Argonne National Lab.
|
|
kusano |
7d535a |
Jeremy Du Croz, Nag Central Office.
|
|
kusano |
7d535a |
Sven Hammarling, Nag Central Office.
|
|
kusano |
7d535a |
Richard Hanson, Sandia National Labs.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Test the input parameters.
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
Parameter adjustments
|
|
kusano |
7d535a |
Function Body */
|
|
kusano |
7d535a |
#define X(I) x[(I)-1]
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
#define A(I,J) a[(I)-1 + ((J)-1)* ( *lda)]
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
info = 0;
|
|
kusano |
7d535a |
if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
|
|
kusano |
7d535a |
info = 1;
|
|
kusano |
7d535a |
} else if (! lsame_(trans, "N") && ! lsame_(trans, "T") &&
|
|
kusano |
7d535a |
! lsame_(trans, "C")) {
|
|
kusano |
7d535a |
info = 2;
|
|
kusano |
7d535a |
} else if (! lsame_(diag, "U") && ! lsame_(diag, "N")) {
|
|
kusano |
7d535a |
info = 3;
|
|
kusano |
7d535a |
} else if (*n < 0) {
|
|
kusano |
7d535a |
info = 4;
|
|
kusano |
7d535a |
} else if (*lda < max(1,*n)) {
|
|
kusano |
7d535a |
info = 6;
|
|
kusano |
7d535a |
} else if (*incx == 0) {
|
|
kusano |
7d535a |
info = 8;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (info != 0) {
|
|
kusano |
7d535a |
xerbla_("CTRSV ", &info);
|
|
kusano |
7d535a |
return 0;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Quick return if possible. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if (*n == 0) {
|
|
kusano |
7d535a |
return 0;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
noconj = lsame_(trans, "T");
|
|
kusano |
7d535a |
nounit = lsame_(diag, "N");
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Set up the start point in X if the increment is not unity. This
|
|
kusano |
7d535a |
will be ( N - 1 )*INCX too small for descending loops. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if (*incx <= 0) {
|
|
kusano |
7d535a |
kx = 1 - (*n - 1) * *incx;
|
|
kusano |
7d535a |
} else if (*incx != 1) {
|
|
kusano |
7d535a |
kx = 1;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Start the operations. In this version the elements of A are
|
|
kusano |
7d535a |
accessed sequentially with one pass through A. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if (lsame_(trans, "N")) {
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Form x := inv( A )*x. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if (lsame_(uplo, "U")) {
|
|
kusano |
7d535a |
if (*incx == 1) {
|
|
kusano |
7d535a |
for (j = *n; j >= 1; --j) {
|
|
kusano |
7d535a |
i__1 = j;
|
|
kusano |
7d535a |
if (X(j).r != 0.f || X(j).i != 0.f) {
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
i__1 = j;
|
|
kusano |
7d535a |
c_div(&q__1, &X(j), &A(j,j));
|
|
kusano |
7d535a |
X(j).r = q__1.r, X(j).i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__1 = j;
|
|
kusano |
7d535a |
temp.r = X(j).r, temp.i = X(j).i;
|
|
kusano |
7d535a |
for (i = j - 1; i >= 1; --i) {
|
|
kusano |
7d535a |
i__1 = i;
|
|
kusano |
7d535a |
i__2 = i;
|
|
kusano |
7d535a |
i__3 = i + j * a_dim1;
|
|
kusano |
7d535a |
q__2.r = temp.r * A(i,j).r - temp.i * A(i,j).i,
|
|
kusano |
7d535a |
q__2.i = temp.r * A(i,j).i + temp.i * A(i,j).r;
|
|
kusano |
7d535a |
q__1.r = X(i).r - q__2.r, q__1.i = X(i).i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
X(i).r = q__1.r, X(i).i = q__1.i;
|
|
kusano |
7d535a |
/* L10: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
/* L20: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
jx = kx + (*n - 1) * *incx;
|
|
kusano |
7d535a |
for (j = *n; j >= 1; --j) {
|
|
kusano |
7d535a |
i__1 = jx;
|
|
kusano |
7d535a |
if (X(jx).r != 0.f || X(jx).i != 0.f) {
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
i__1 = jx;
|
|
kusano |
7d535a |
c_div(&q__1, &X(jx), &A(j,j));
|
|
kusano |
7d535a |
X(jx).r = q__1.r, X(jx).i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__1 = jx;
|
|
kusano |
7d535a |
temp.r = X(jx).r, temp.i = X(jx).i;
|
|
kusano |
7d535a |
ix = jx;
|
|
kusano |
7d535a |
for (i = j - 1; i >= 1; --i) {
|
|
kusano |
7d535a |
ix -= *incx;
|
|
kusano |
7d535a |
i__1 = ix;
|
|
kusano |
7d535a |
i__2 = ix;
|
|
kusano |
7d535a |
i__3 = i + j * a_dim1;
|
|
kusano |
7d535a |
q__2.r = temp.r * A(i,j).r - temp.i * A(i,j).i,
|
|
kusano |
7d535a |
q__2.i = temp.r * A(i,j).i + temp.i * A(i,j).r;
|
|
kusano |
7d535a |
q__1.r = X(ix).r - q__2.r, q__1.i = X(ix).i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
X(ix).r = q__1.r, X(ix).i = q__1.i;
|
|
kusano |
7d535a |
/* L30: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
jx -= *incx;
|
|
kusano |
7d535a |
/* L40: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
if (*incx == 1) {
|
|
kusano |
7d535a |
i__1 = *n;
|
|
kusano |
7d535a |
for (j = 1; j <= *n; ++j) {
|
|
kusano |
7d535a |
i__2 = j;
|
|
kusano |
7d535a |
if (X(j).r != 0.f || X(j).i != 0.f) {
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
i__2 = j;
|
|
kusano |
7d535a |
c_div(&q__1, &X(j), &A(j,j));
|
|
kusano |
7d535a |
X(j).r = q__1.r, X(j).i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__2 = j;
|
|
kusano |
7d535a |
temp.r = X(j).r, temp.i = X(j).i;
|
|
kusano |
7d535a |
i__2 = *n;
|
|
kusano |
7d535a |
for (i = j + 1; i <= *n; ++i) {
|
|
kusano |
7d535a |
i__3 = i;
|
|
kusano |
7d535a |
i__4 = i;
|
|
kusano |
7d535a |
i__5 = i + j * a_dim1;
|
|
kusano |
7d535a |
q__2.r = temp.r * A(i,j).r - temp.i * A(i,j).i,
|
|
kusano |
7d535a |
q__2.i = temp.r * A(i,j).i + temp.i * A(i,j).r;
|
|
kusano |
7d535a |
q__1.r = X(i).r - q__2.r, q__1.i = X(i).i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
X(i).r = q__1.r, X(i).i = q__1.i;
|
|
kusano |
7d535a |
/* L50: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
/* L60: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
jx = kx;
|
|
kusano |
7d535a |
i__1 = *n;
|
|
kusano |
7d535a |
for (j = 1; j <= *n; ++j) {
|
|
kusano |
7d535a |
i__2 = jx;
|
|
kusano |
7d535a |
if (X(jx).r != 0.f || X(jx).i != 0.f) {
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
i__2 = jx;
|
|
kusano |
7d535a |
c_div(&q__1, &X(jx), &A(j,j));
|
|
kusano |
7d535a |
X(jx).r = q__1.r, X(jx).i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__2 = jx;
|
|
kusano |
7d535a |
temp.r = X(jx).r, temp.i = X(jx).i;
|
|
kusano |
7d535a |
ix = jx;
|
|
kusano |
7d535a |
i__2 = *n;
|
|
kusano |
7d535a |
for (i = j + 1; i <= *n; ++i) {
|
|
kusano |
7d535a |
ix += *incx;
|
|
kusano |
7d535a |
i__3 = ix;
|
|
kusano |
7d535a |
i__4 = ix;
|
|
kusano |
7d535a |
i__5 = i + j * a_dim1;
|
|
kusano |
7d535a |
q__2.r = temp.r * A(i,j).r - temp.i * A(i,j).i,
|
|
kusano |
7d535a |
q__2.i = temp.r * A(i,j).i + temp.i * A(i,j).r;
|
|
kusano |
7d535a |
q__1.r = X(ix).r - q__2.r, q__1.i = X(ix).i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
X(ix).r = q__1.r, X(ix).i = q__1.i;
|
|
kusano |
7d535a |
/* L70: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
jx += *incx;
|
|
kusano |
7d535a |
/* L80: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* Form x := inv( A' )*x or x := inv( conjg( A' ) )*x. */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
if (lsame_(uplo, "U")) {
|
|
kusano |
7d535a |
if (*incx == 1) {
|
|
kusano |
7d535a |
i__1 = *n;
|
|
kusano |
7d535a |
for (j = 1; j <= *n; ++j) {
|
|
kusano |
7d535a |
i__2 = j;
|
|
kusano |
7d535a |
temp.r = X(j).r, temp.i = X(j).i;
|
|
kusano |
7d535a |
if (noconj) {
|
|
kusano |
7d535a |
i__2 = j - 1;
|
|
kusano |
7d535a |
for (i = 1; i <= j-1; ++i) {
|
|
kusano |
7d535a |
i__3 = i + j * a_dim1;
|
|
kusano |
7d535a |
i__4 = i;
|
|
kusano |
7d535a |
q__2.r = A(i,j).r * X(i).r - A(i,j).i * X(
|
|
kusano |
7d535a |
i).i, q__2.i = A(i,j).r * X(i).i +
|
|
kusano |
7d535a |
A(i,j).i * X(i).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
/* L90: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &A(j,j));
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
i__2 = j - 1;
|
|
kusano |
7d535a |
for (i = 1; i <= j-1; ++i) {
|
|
kusano |
7d535a |
r_cnjg(&q__3, &A(i,j));
|
|
kusano |
7d535a |
i__3 = i;
|
|
kusano |
7d535a |
q__2.r = q__3.r * X(i).r - q__3.i * X(i).i,
|
|
kusano |
7d535a |
q__2.i = q__3.r * X(i).i + q__3.i * X(
|
|
kusano |
7d535a |
i).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
/* L100: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
r_cnjg(&q__2, &A(j,j));
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &q__2);
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__2 = j;
|
|
kusano |
7d535a |
X(j).r = temp.r, X(j).i = temp.i;
|
|
kusano |
7d535a |
/* L110: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
jx = kx;
|
|
kusano |
7d535a |
i__1 = *n;
|
|
kusano |
7d535a |
for (j = 1; j <= *n; ++j) {
|
|
kusano |
7d535a |
ix = kx;
|
|
kusano |
7d535a |
i__2 = jx;
|
|
kusano |
7d535a |
temp.r = X(jx).r, temp.i = X(jx).i;
|
|
kusano |
7d535a |
if (noconj) {
|
|
kusano |
7d535a |
i__2 = j - 1;
|
|
kusano |
7d535a |
for (i = 1; i <= j-1; ++i) {
|
|
kusano |
7d535a |
i__3 = i + j * a_dim1;
|
|
kusano |
7d535a |
i__4 = ix;
|
|
kusano |
7d535a |
q__2.r = A(i,j).r * X(ix).r - A(i,j).i * X(
|
|
kusano |
7d535a |
ix).i, q__2.i = A(i,j).r * X(ix).i +
|
|
kusano |
7d535a |
A(i,j).i * X(ix).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
ix += *incx;
|
|
kusano |
7d535a |
/* L120: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &A(j,j));
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
i__2 = j - 1;
|
|
kusano |
7d535a |
for (i = 1; i <= j-1; ++i) {
|
|
kusano |
7d535a |
r_cnjg(&q__3, &A(i,j));
|
|
kusano |
7d535a |
i__3 = ix;
|
|
kusano |
7d535a |
q__2.r = q__3.r * X(ix).r - q__3.i * X(ix).i,
|
|
kusano |
7d535a |
q__2.i = q__3.r * X(ix).i + q__3.i * X(
|
|
kusano |
7d535a |
ix).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
ix += *incx;
|
|
kusano |
7d535a |
/* L130: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
r_cnjg(&q__2, &A(j,j));
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &q__2);
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__2 = jx;
|
|
kusano |
7d535a |
X(jx).r = temp.r, X(jx).i = temp.i;
|
|
kusano |
7d535a |
jx += *incx;
|
|
kusano |
7d535a |
/* L140: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
if (*incx == 1) {
|
|
kusano |
7d535a |
for (j = *n; j >= 1; --j) {
|
|
kusano |
7d535a |
i__1 = j;
|
|
kusano |
7d535a |
temp.r = X(j).r, temp.i = X(j).i;
|
|
kusano |
7d535a |
if (noconj) {
|
|
kusano |
7d535a |
i__1 = j + 1;
|
|
kusano |
7d535a |
for (i = *n; i >= j+1; --i) {
|
|
kusano |
7d535a |
i__2 = i + j * a_dim1;
|
|
kusano |
7d535a |
i__3 = i;
|
|
kusano |
7d535a |
q__2.r = A(i,j).r * X(i).r - A(i,j).i * X(
|
|
kusano |
7d535a |
i).i, q__2.i = A(i,j).r * X(i).i +
|
|
kusano |
7d535a |
A(i,j).i * X(i).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
/* L150: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &A(j,j));
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
i__1 = j + 1;
|
|
kusano |
7d535a |
for (i = *n; i >= j+1; --i) {
|
|
kusano |
7d535a |
r_cnjg(&q__3, &A(i,j));
|
|
kusano |
7d535a |
i__2 = i;
|
|
kusano |
7d535a |
q__2.r = q__3.r * X(i).r - q__3.i * X(i).i,
|
|
kusano |
7d535a |
q__2.i = q__3.r * X(i).i + q__3.i * X(
|
|
kusano |
7d535a |
i).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
/* L160: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
r_cnjg(&q__2, &A(j,j));
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &q__2);
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__1 = j;
|
|
kusano |
7d535a |
X(j).r = temp.r, X(j).i = temp.i;
|
|
kusano |
7d535a |
/* L170: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
kx += (*n - 1) * *incx;
|
|
kusano |
7d535a |
jx = kx;
|
|
kusano |
7d535a |
for (j = *n; j >= 1; --j) {
|
|
kusano |
7d535a |
ix = kx;
|
|
kusano |
7d535a |
i__1 = jx;
|
|
kusano |
7d535a |
temp.r = X(jx).r, temp.i = X(jx).i;
|
|
kusano |
7d535a |
if (noconj) {
|
|
kusano |
7d535a |
i__1 = j + 1;
|
|
kusano |
7d535a |
for (i = *n; i >= j+1; --i) {
|
|
kusano |
7d535a |
i__2 = i + j * a_dim1;
|
|
kusano |
7d535a |
i__3 = ix;
|
|
kusano |
7d535a |
q__2.r = A(i,j).r * X(ix).r - A(i,j).i * X(
|
|
kusano |
7d535a |
ix).i, q__2.i = A(i,j).r * X(ix).i +
|
|
kusano |
7d535a |
A(i,j).i * X(ix).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
ix -= *incx;
|
|
kusano |
7d535a |
/* L180: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &A(j,j));
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
} else {
|
|
kusano |
7d535a |
i__1 = j + 1;
|
|
kusano |
7d535a |
for (i = *n; i >= j+1; --i) {
|
|
kusano |
7d535a |
r_cnjg(&q__3, &A(i,j));
|
|
kusano |
7d535a |
i__2 = ix;
|
|
kusano |
7d535a |
q__2.r = q__3.r * X(ix).r - q__3.i * X(ix).i,
|
|
kusano |
7d535a |
q__2.i = q__3.r * X(ix).i + q__3.i * X(
|
|
kusano |
7d535a |
ix).r;
|
|
kusano |
7d535a |
q__1.r = temp.r - q__2.r, q__1.i = temp.i -
|
|
kusano |
7d535a |
q__2.i;
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
ix -= *incx;
|
|
kusano |
7d535a |
/* L190: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
if (nounit) {
|
|
kusano |
7d535a |
r_cnjg(&q__2, &A(j,j));
|
|
kusano |
7d535a |
c_div(&q__1, &temp, &q__2);
|
|
kusano |
7d535a |
temp.r = q__1.r, temp.i = q__1.i;
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
i__1 = jx;
|
|
kusano |
7d535a |
X(jx).r = temp.r, X(jx).i = temp.i;
|
|
kusano |
7d535a |
jx -= *incx;
|
|
kusano |
7d535a |
/* L200: */
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
}
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
return 0;
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
/* End of CTRSV . */
|
|
kusano |
7d535a |
|
|
kusano |
7d535a |
} /* ctrsv_ */
|
|
kusano |
7d535a |
|