00001 /* ctrttp.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 ctrttp_(char *uplo, integer *n, complex *a, integer *lda, 00017 complex *ap, integer *info) 00018 { 00019 /* System generated locals */ 00020 integer a_dim1, a_offset, i__1, i__2, i__3, i__4; 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 /* -- Contributed by Fred Gustavson of the IBM Watson Research Center -- */ 00031 /* -- and 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 /* CTRTTP copies a triangular matrix A from full format (TR) to standard */ 00046 /* packed format (TP). */ 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 matrices AP and A. N >= 0. */ 00057 00058 /* A (input) COMPLEX array, dimension (LDA,N) */ 00059 /* On entry, the triangular matrix A. If UPLO = 'U', the leading */ 00060 /* N-by-N upper triangular part of A contains the upper */ 00061 /* triangular part of the matrix A, and the strictly lower */ 00062 /* triangular part of A is not referenced. If UPLO = 'L', the */ 00063 /* leading N-by-N lower triangular part of A contains the lower */ 00064 /* triangular part of the matrix A, and the strictly upper */ 00065 /* triangular part of A is not referenced. */ 00066 00067 /* LDA (input) INTEGER */ 00068 /* The leading dimension of the array A. LDA >= max(1,N). */ 00069 00070 /* AP (output) COMPLEX array, dimension ( N*(N+1)/2 ), */ 00071 /* On exit, the upper or lower triangular matrix A, packed */ 00072 /* columnwise in a linear array. The j-th column of A is stored */ 00073 /* in the array AP as follows: */ 00074 /* if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; */ 00075 /* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=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 a_dim1 = *lda; 00097 a_offset = 1 + a_dim1; 00098 a -= a_offset; 00099 --ap; 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 = -4; 00110 } 00111 if (*info != 0) { 00112 i__1 = -(*info); 00113 xerbla_("CTRTTP", &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 i__3 = k; 00125 i__4 = i__ + j * a_dim1; 00126 ap[i__3].r = a[i__4].r, ap[i__3].i = a[i__4].i; 00127 } 00128 } 00129 } else { 00130 k = 0; 00131 i__1 = *n; 00132 for (j = 1; j <= i__1; ++j) { 00133 i__2 = j; 00134 for (i__ = 1; i__ <= i__2; ++i__) { 00135 ++k; 00136 i__3 = k; 00137 i__4 = i__ + j * a_dim1; 00138 ap[i__3].r = a[i__4].r, ap[i__3].i = a[i__4].i; 00139 } 00140 } 00141 } 00142 00143 00144 return 0; 00145 00146 /* End of CTRTTP */ 00147 00148 } /* ctrttp_ */