00001 /* stpttr.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 stpttr_(char *uplo, integer *n, real *ap, real *a, 00017 integer *lda, integer *info) 00018 { 00019 /* System generated locals */ 00020 integer a_dim1, a_offset, i__1, i__2; 00021 00022 /* Local variables */ 00023 integer i__, j, k; 00024 extern logical lsame_(char *, char *); 00025 logical lower; 00026 extern /* Subroutine */ int xerbla_(char *, integer *); 00027 00028 00029 /* -- LAPACK routine (version 3.2) -- */ 00030 00031 /* -- Contributed by Julien Langou of the Univ. of Colorado Denver -- */ 00032 /* -- November 2008 -- */ 00033 00034 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ 00035 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */ 00036 00037 /* .. Scalar Arguments .. */ 00038 /* .. */ 00039 /* .. Array Arguments .. */ 00040 /* .. */ 00041 00042 /* Purpose */ 00043 /* ======= */ 00044 00045 /* STPTTR copies a triangular matrix A from standard packed format (TP) */ 00046 /* to standard full format (TR). */ 00047 00048 /* Arguments */ 00049 /* ========= */ 00050 00051 /* UPLO (input) CHARACTER */ 00052 /* = 'U': A is upper triangular. */ 00053 /* = 'L': A is lower triangular. */ 00054 00055 /* N (input) INTEGER */ 00056 /* The order of the matrix A. N >= 0. */ 00057 00058 /* AP (input) REAL array, dimension ( N*(N+1)/2 ), */ 00059 /* On entry, the upper or lower triangular matrix A, packed */ 00060 /* columnwise in a linear array. The j-th column of A is stored */ 00061 /* in the array AP as follows: */ 00062 /* if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; */ 00063 /* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. */ 00064 00065 /* A (output) REAL array, dimension ( LDA, N ) */ 00066 /* On exit, the triangular matrix A. If UPLO = 'U', the leading */ 00067 /* N-by-N upper triangular part of A contains the upper */ 00068 /* triangular part of the matrix A, and the strictly lower */ 00069 /* triangular part of A is not referenced. If UPLO = 'L', the */ 00070 /* leading N-by-N lower triangular part of A contains the lower */ 00071 /* triangular part of the matrix A, and the strictly upper */ 00072 /* triangular part of A is not referenced. */ 00073 00074 /* LDA (input) INTEGER */ 00075 /* The leading dimension of the array A. LDA >= max(1,N). */ 00076 00077 /* INFO (output) INTEGER */ 00078 /* = 0: successful exit */ 00079 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00080 00081 /* ===================================================================== */ 00082 00083 /* .. Parameters .. */ 00084 /* .. */ 00085 /* .. Local Scalars .. */ 00086 /* .. */ 00087 /* .. External Functions .. */ 00088 /* .. */ 00089 /* .. External Subroutines .. */ 00090 /* .. */ 00091 /* .. Executable Statements .. */ 00092 00093 /* Test the input parameters. */ 00094 00095 /* Parameter adjustments */ 00096 --ap; 00097 a_dim1 = *lda; 00098 a_offset = 1 + a_dim1; 00099 a -= a_offset; 00100 00101 /* Function Body */ 00102 *info = 0; 00103 lower = lsame_(uplo, "L"); 00104 if (! lower && ! lsame_(uplo, "U")) { 00105 *info = -1; 00106 } else if (*n < 0) { 00107 *info = -2; 00108 } else if (*lda < max(1,*n)) { 00109 *info = -5; 00110 } 00111 if (*info != 0) { 00112 i__1 = -(*info); 00113 xerbla_("STPTTR", &i__1); 00114 return 0; 00115 } 00116 00117 if (lower) { 00118 k = 0; 00119 i__1 = *n; 00120 for (j = 1; j <= i__1; ++j) { 00121 i__2 = *n; 00122 for (i__ = j; i__ <= i__2; ++i__) { 00123 ++k; 00124 a[i__ + j * a_dim1] = ap[k]; 00125 } 00126 } 00127 } else { 00128 k = 0; 00129 i__1 = *n; 00130 for (j = 1; j <= i__1; ++j) { 00131 i__2 = j; 00132 for (i__ = 1; i__ <= i__2; ++i__) { 00133 ++k; 00134 a[i__ + j * a_dim1] = ap[k]; 00135 } 00136 } 00137 } 00138 00139 00140 return 0; 00141 00142 /* End of STPTTR */ 00143 00144 } /* stpttr_ */