00001 /* spotrs.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Table of constant values */ 00017 00018 static real c_b9 = 1.f; 00019 00020 /* Subroutine */ int spotrs_(char *uplo, integer *n, integer *nrhs, real *a, 00021 integer *lda, real *b, integer *ldb, integer *info) 00022 { 00023 /* System generated locals */ 00024 integer a_dim1, a_offset, b_dim1, b_offset, i__1; 00025 00026 /* Local variables */ 00027 extern logical lsame_(char *, char *); 00028 logical upper; 00029 extern /* Subroutine */ int strsm_(char *, char *, char *, char *, 00030 integer *, integer *, real *, real *, integer *, real *, integer * 00031 ), xerbla_(char *, integer *); 00032 00033 00034 /* -- LAPACK routine (version 3.2) -- */ 00035 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00036 /* November 2006 */ 00037 00038 /* .. Scalar Arguments .. */ 00039 /* .. */ 00040 /* .. Array Arguments .. */ 00041 /* .. */ 00042 00043 /* Purpose */ 00044 /* ======= */ 00045 00046 /* SPOTRS solves a system of linear equations A*X = B with a symmetric */ 00047 /* positive definite matrix A using the Cholesky factorization */ 00048 /* A = U**T*U or A = L*L**T computed by SPOTRF. */ 00049 00050 /* Arguments */ 00051 /* ========= */ 00052 00053 /* UPLO (input) CHARACTER*1 */ 00054 /* = 'U': Upper triangle of A is stored; */ 00055 /* = 'L': Lower triangle of A is stored. */ 00056 00057 /* N (input) INTEGER */ 00058 /* The order of the matrix A. N >= 0. */ 00059 00060 /* NRHS (input) INTEGER */ 00061 /* The number of right hand sides, i.e., the number of columns */ 00062 /* of the matrix B. NRHS >= 0. */ 00063 00064 /* A (input) REAL array, dimension (LDA,N) */ 00065 /* The triangular factor U or L from the Cholesky factorization */ 00066 /* A = U**T*U or A = L*L**T, as computed by SPOTRF. */ 00067 00068 /* LDA (input) INTEGER */ 00069 /* The leading dimension of the array A. LDA >= max(1,N). */ 00070 00071 /* B (input/output) REAL array, dimension (LDB,NRHS) */ 00072 /* On entry, the right hand side matrix B. */ 00073 /* On exit, the solution matrix X. */ 00074 00075 /* LDB (input) INTEGER */ 00076 /* The leading dimension of the array B. LDB >= max(1,N). */ 00077 00078 /* INFO (output) INTEGER */ 00079 /* = 0: successful exit */ 00080 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00081 00082 /* ===================================================================== */ 00083 00084 /* .. Parameters .. */ 00085 /* .. */ 00086 /* .. Local Scalars .. */ 00087 /* .. */ 00088 /* .. External Functions .. */ 00089 /* .. */ 00090 /* .. External Subroutines .. */ 00091 /* .. */ 00092 /* .. Intrinsic Functions .. */ 00093 /* .. */ 00094 /* .. Executable Statements .. */ 00095 00096 /* Test the input parameters. */ 00097 00098 /* Parameter adjustments */ 00099 a_dim1 = *lda; 00100 a_offset = 1 + a_dim1; 00101 a -= a_offset; 00102 b_dim1 = *ldb; 00103 b_offset = 1 + b_dim1; 00104 b -= b_offset; 00105 00106 /* Function Body */ 00107 *info = 0; 00108 upper = lsame_(uplo, "U"); 00109 if (! upper && ! lsame_(uplo, "L")) { 00110 *info = -1; 00111 } else if (*n < 0) { 00112 *info = -2; 00113 } else if (*nrhs < 0) { 00114 *info = -3; 00115 } else if (*lda < max(1,*n)) { 00116 *info = -5; 00117 } else if (*ldb < max(1,*n)) { 00118 *info = -7; 00119 } 00120 if (*info != 0) { 00121 i__1 = -(*info); 00122 xerbla_("SPOTRS", &i__1); 00123 return 0; 00124 } 00125 00126 /* Quick return if possible */ 00127 00128 if (*n == 0 || *nrhs == 0) { 00129 return 0; 00130 } 00131 00132 if (upper) { 00133 00134 /* Solve A*X = B where A = U'*U. */ 00135 00136 /* Solve U'*X = B, overwriting B with X. */ 00137 00138 strsm_("Left", "Upper", "Transpose", "Non-unit", n, nrhs, &c_b9, &a[ 00139 a_offset], lda, &b[b_offset], ldb); 00140 00141 /* Solve U*X = B, overwriting B with X. */ 00142 00143 strsm_("Left", "Upper", "No transpose", "Non-unit", n, nrhs, &c_b9, & 00144 a[a_offset], lda, &b[b_offset], ldb); 00145 } else { 00146 00147 /* Solve A*X = B where A = L*L'. */ 00148 00149 /* Solve L*X = B, overwriting B with X. */ 00150 00151 strsm_("Left", "Lower", "No transpose", "Non-unit", n, nrhs, &c_b9, & 00152 a[a_offset], lda, &b[b_offset], ldb); 00153 00154 /* Solve L'*X = B, overwriting B with X. */ 00155 00156 strsm_("Left", "Lower", "Transpose", "Non-unit", n, nrhs, &c_b9, &a[ 00157 a_offset], lda, &b[b_offset], ldb); 00158 } 00159 00160 return 0; 00161 00162 /* End of SPOTRS */ 00163 00164 } /* spotrs_ */