ztrttp.c
Go to the documentation of this file.
00001 /* ztrttp.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 ztrttp_(char *uplo, integer *n, doublecomplex *a, 
00017         integer *lda, doublecomplex *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 
00031 /*  -- Contributed by Fred Gustavson of the IBM Watson Research Center -- */
00032 /*  --            and Julien Langou of the Univ. of Colorado Denver    -- */
00033 /*  -- November 2008 -- */
00034 
00035 /*  -- LAPACK is a software package provided by Univ. of Tennessee,    -- */
00036 /*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
00037 
00038 /*     .. Scalar Arguments .. */
00039 /*     .. */
00040 /*     .. Array Arguments .. */
00041 /*     .. */
00042 
00043 /*  Purpose */
00044 /*  ======= */
00045 
00046 /*  ZTRTTP copies a triangular matrix A from full format (TR) to standard */
00047 /*  packed format (TP). */
00048 
00049 /*  Arguments */
00050 /*  ========= */
00051 
00052 /*  UPLO    (input) CHARACTER */
00053 /*          = 'U':  A is upper triangular; */
00054 /*          = 'L':  A is lower triangular. */
00055 
00056 /*  N       (input) INTEGER */
00057 /*          The order of the matrices AP and A.  N >= 0. */
00058 
00059 /*  A       (input) COMPLEX*16 array, dimension (LDA,N) */
00060 /*          On entry, the triangular matrix A.  If UPLO = 'U', the leading */
00061 /*          N-by-N upper triangular part of A contains the upper */
00062 /*          triangular part of the matrix A, and the strictly lower */
00063 /*          triangular part of A is not referenced.  If UPLO = 'L', the */
00064 /*          leading N-by-N lower triangular part of A contains the lower */
00065 /*          triangular part of the matrix A, and the strictly upper */
00066 /*          triangular part of A is not referenced. */
00067 
00068 /*  LDA     (input) INTEGER */
00069 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00070 
00071 /*  AP      (output) COMPLEX*16 array, dimension ( N*(N+1)/2 ), */
00072 /*          On exit, the upper or lower triangular matrix A, packed */
00073 /*          columnwise in a linear array. The j-th column of A is stored */
00074 /*          in the array AP as follows: */
00075 /*          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; */
00076 /*          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=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 /*     .. Executable Statements .. */
00093 
00094 /*     Test the input parameters. */
00095 
00096     /* Parameter adjustments */
00097     a_dim1 = *lda;
00098     a_offset = 1 + a_dim1;
00099     a -= a_offset;
00100     --ap;
00101 
00102     /* Function Body */
00103     *info = 0;
00104     lower = lsame_(uplo, "L");
00105     if (! lower && ! lsame_(uplo, "U")) {
00106         *info = -1;
00107     } else if (*n < 0) {
00108         *info = -2;
00109     } else if (*lda < max(1,*n)) {
00110         *info = -4;
00111     }
00112     if (*info != 0) {
00113         i__1 = -(*info);
00114         xerbla_("ZTRTTP", &i__1);
00115         return 0;
00116     }
00117 
00118     if (lower) {
00119         k = 0;
00120         i__1 = *n;
00121         for (j = 1; j <= i__1; ++j) {
00122             i__2 = *n;
00123             for (i__ = j; i__ <= i__2; ++i__) {
00124                 ++k;
00125                 i__3 = k;
00126                 i__4 = i__ + j * a_dim1;
00127                 ap[i__3].r = a[i__4].r, ap[i__3].i = a[i__4].i;
00128             }
00129         }
00130     } else {
00131         k = 0;
00132         i__1 = *n;
00133         for (j = 1; j <= i__1; ++j) {
00134             i__2 = j;
00135             for (i__ = 1; i__ <= i__2; ++i__) {
00136                 ++k;
00137                 i__3 = k;
00138                 i__4 = i__ + j * a_dim1;
00139                 ap[i__3].r = a[i__4].r, ap[i__3].i = a[i__4].i;
00140             }
00141         }
00142     }
00143 
00144 
00145     return 0;
00146 
00147 /*     End of ZTRTTP */
00148 
00149 } /* ztrttp_ */


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