sposv.c
Go to the documentation of this file.
00001 /* sposv.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 /* Subroutine */ int sposv_(char *uplo, integer *n, integer *nrhs, real *a, 
00017         integer *lda, real *b, integer *ldb, integer *info)
00018 {
00019     /* System generated locals */
00020     integer a_dim1, a_offset, b_dim1, b_offset, i__1;
00021 
00022     /* Local variables */
00023     extern logical lsame_(char *, char *);
00024     extern /* Subroutine */ int xerbla_(char *, integer *), spotrf_(
00025             char *, integer *, real *, integer *, integer *), spotrs_(
00026             char *, integer *, integer *, real *, integer *, real *, integer *
00027 , integer *);
00028 
00029 
00030 /*  -- LAPACK driver routine (version 3.2) -- */
00031 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00032 /*     November 2006 */
00033 
00034 /*     .. Scalar Arguments .. */
00035 /*     .. */
00036 /*     .. Array Arguments .. */
00037 /*     .. */
00038 
00039 /*  Purpose */
00040 /*  ======= */
00041 
00042 /*  SPOSV computes the solution to a real system of linear equations */
00043 /*     A * X = B, */
00044 /*  where A is an N-by-N symmetric positive definite matrix and X and B */
00045 /*  are N-by-NRHS matrices. */
00046 
00047 /*  The Cholesky decomposition is used to factor A as */
00048 /*     A = U**T* U,  if UPLO = 'U', or */
00049 /*     A = L * L**T,  if UPLO = 'L', */
00050 /*  where U is an upper triangular matrix and L is a lower triangular */
00051 /*  matrix.  The factored form of A is then used to solve the system of */
00052 /*  equations A * X = B. */
00053 
00054 /*  Arguments */
00055 /*  ========= */
00056 
00057 /*  UPLO    (input) CHARACTER*1 */
00058 /*          = 'U':  Upper triangle of A is stored; */
00059 /*          = 'L':  Lower triangle of A is stored. */
00060 
00061 /*  N       (input) INTEGER */
00062 /*          The number of linear equations, i.e., the order of the */
00063 /*          matrix A.  N >= 0. */
00064 
00065 /*  NRHS    (input) INTEGER */
00066 /*          The number of right hand sides, i.e., the number of columns */
00067 /*          of the matrix B.  NRHS >= 0. */
00068 
00069 /*  A       (input/output) REAL array, dimension (LDA,N) */
00070 /*          On entry, the symmetric matrix A.  If UPLO = 'U', the leading */
00071 /*          N-by-N upper triangular part of A contains the upper */
00072 /*          triangular part of the matrix A, and the strictly lower */
00073 /*          triangular part of A is not referenced.  If UPLO = 'L', the */
00074 /*          leading N-by-N lower triangular part of A contains the lower */
00075 /*          triangular part of the matrix A, and the strictly upper */
00076 /*          triangular part of A is not referenced. */
00077 
00078 /*          On exit, if INFO = 0, the factor U or L from the Cholesky */
00079 /*          factorization A = U**T*U or A = L*L**T. */
00080 
00081 /*  LDA     (input) INTEGER */
00082 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00083 
00084 /*  B       (input/output) REAL array, dimension (LDB,NRHS) */
00085 /*          On entry, the N-by-NRHS right hand side matrix B. */
00086 /*          On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
00087 
00088 /*  LDB     (input) INTEGER */
00089 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00090 
00091 /*  INFO    (output) INTEGER */
00092 /*          = 0:  successful exit */
00093 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00094 /*          > 0:  if INFO = i, the leading minor of order i of A is not */
00095 /*                positive definite, so the factorization could not be */
00096 /*                completed, and the solution has not been computed. */
00097 
00098 /*  ===================================================================== */
00099 
00100 /*     .. External Functions .. */
00101 /*     .. */
00102 /*     .. External Subroutines .. */
00103 /*     .. */
00104 /*     .. Intrinsic Functions .. */
00105 /*     .. */
00106 /*     .. Executable Statements .. */
00107 
00108 /*     Test the input parameters. */
00109 
00110     /* Parameter adjustments */
00111     a_dim1 = *lda;
00112     a_offset = 1 + a_dim1;
00113     a -= a_offset;
00114     b_dim1 = *ldb;
00115     b_offset = 1 + b_dim1;
00116     b -= b_offset;
00117 
00118     /* Function Body */
00119     *info = 0;
00120     if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00121         *info = -1;
00122     } else if (*n < 0) {
00123         *info = -2;
00124     } else if (*nrhs < 0) {
00125         *info = -3;
00126     } else if (*lda < max(1,*n)) {
00127         *info = -5;
00128     } else if (*ldb < max(1,*n)) {
00129         *info = -7;
00130     }
00131     if (*info != 0) {
00132         i__1 = -(*info);
00133         xerbla_("SPOSV ", &i__1);
00134         return 0;
00135     }
00136 
00137 /*     Compute the Cholesky factorization A = U'*U or A = L*L'. */
00138 
00139     spotrf_(uplo, n, &a[a_offset], lda, info);
00140     if (*info == 0) {
00141 
00142 /*        Solve the system A*X = B, overwriting B with X. */
00143 
00144         spotrs_(uplo, n, nrhs, &a[a_offset], lda, &b[b_offset], ldb, info);
00145 
00146     }
00147     return 0;
00148 
00149 /*     End of SPOSV */
00150 
00151 } /* sposv_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:13