1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
|
/* ---------------------------------------------------------------------
*
* -- PBLAS auxiliary routine (version 2.0) --
* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
* and University of California, Berkeley.
* April 1, 1998
*
* ---------------------------------------------------------------------
*/
/*
* Include files
*/
#include "../pblas.h"
#include "../PBpblas.h"
#include "../PBtools.h"
#include "../PBblacs.h"
#include "../PBblas.h"
#ifdef __STDC__
void PB_Ctztrmv( PBTYP_T * TYPE, char * SIDE, char * UPLO, char * TRANS,
char * DIAG, int M, int N, int K, int IOFFD,
char * ALPHA, char * A, int LDA, char * X, int LDX,
char * Y, int LDY )
#else
void PB_Ctztrmv( TYPE, SIDE, UPLO, TRANS, DIAG, M, N, K, IOFFD, ALPHA,
A, LDA, X, LDX, Y, LDY )
/*
* .. Scalar Arguments ..
*/
char * SIDE, * UPLO, * TRANS, * DIAG;
int IOFFD, K, LDA, LDX, LDY, M, N;
char * ALPHA;
/*
* .. Array Arguments ..
*/
char * A, * X, * Y;
PBTYP_T * TYPE;
#endif
{
/*
* Purpose
* =======
*
* PB_Ctztrmv performs the matrix-vector operation
*
* y := A * x, or y := A' * x, or y := conjg( A' ) * x,
*
* where alpha and beta are scalars, x and y are vectors, and A is an
* m by n trapezoidal triangular matrix.
*
* Arguments
* =========
*
* TYPE (local input) pointer to a PBTYP_T structure
* On entry, TYPE is a pointer to a structure of type PBTYP_T,
* that contains type information (See pblas.h).
*
* SIDE (dummy) pointer to CHAR
* In this routine, SIDE is a dummy (unused) argument.
*
* UPLO (input) pointer to CHAR
* On entry, UPLO specifies which part of the matrix A is to be
* referenced as follows:
*
* UPLO = 'L' or 'l' the lower trapezoid of A is referenced,
*
* UPLO = 'U' or 'u' the upper trapezoid of A is referenced,
*
* otherwise all of the matrix A is referenced.
*
* TRANS (input) pointer to CHAR
* On entry, TRANS specifies the operation to be performed as
* follows:
*
* TRANS = 'N' or 'n': y := A*x,
*
* TRANS = 'T' or 't': y := A'*x,
*
* TRANS = 'C' or 'c': y := A'*x or y := conjg( A' )*x.
*
* DIAG (input) pointer to CHAR
* On entry, DIAG specifies whether or not A is unit triangular
* as follows:
*
* DIAG = 'U' or 'u' A is assumed to be unit triangular.
*
* DIAG = 'N' or 'n' A is not assumed to be unit triangular.
*
* M (input) INTEGER
* On entry, M specifies the number of rows of the matrix A. M
* must be at least zero.
*
* N (input) INTEGER
* On entry, N specifies the number of columns of the matrix A.
* N must be at least zero.
*
* K (dummy) INTEGER
* In this routine, K is a dummy (unused) argument.
*
* IOFFD (input) INTEGER
* On entry, IOFFD specifies the position of the offdiagonal de-
* limiting the upper and lower trapezoidal part of A as follows
* (see the notes below):
*
* IOFFD = 0 specifies the main diagonal A( i, i ),
* with i = 1 ... MIN( M, N ),
* IOFFD > 0 specifies the subdiagonal A( i+IOFFD, i ),
* with i = 1 ... MIN( M-IOFFD, N ),
* IOFFD < 0 specifies the superdiagonal A( i, i-IOFFD ),
* with i = 1 ... MIN( M, N+IOFFD ).
*
* ALPHA (dummy) pointer to CHAR
* In this routine, ALPHA is a dummy (unused) argument.
*
* A (input) pointer to CHAR
* On entry, A is an array of dimension (LDA,N) containing the m
* by n matrix A. Only the trapezoidal part of A determined by
* UPLO and IOFFD is referenced. When DIAG = 'U' or 'u', the
* diagonal elements of A are not referenced either, but are
* assumed to be unity.
*
* LDA (input) INTEGER
* On entry, LDA specifies the leading dimension of the array A.
* LDA must be at least max( 1, M ).
*
* X (input) pointer to CHAR
* On entry, X is an array of dimension (LDX,Kx). Before entry,
* with TRANS = 'N' or 'n', the array X must contain the n ele-
* ment vector x corresponding to the columns of A. Otherwise,
* the array X must contain the m element vector x corresponding
* to the rows of A. When TRANS is 'N' or 'n', LDX is at least
* 1, and Kx is at least N. Otherwise, LDX is at least max(1,M),
* and Kx is at least 1.
*
* LDX (input) INTEGER
* On entry, LDX specifies the leading dimension of the array X.
* LDX must be at least 1 when TRANS is 'N' or 'n' and
* max( 1, M ) otherwise.
*
* Y (input/output) pointer to CHAR
* On entry, Y is an array of dimension (LDY,Ky). On exit, with
* TRANS = 'N' or 'n', the array Y contains the m element vector
* y corresponding to the rows of A. Otherwise, the array Y con-
* tains the n element vector y corresponding to the columns of
* A. When TRANS is 'N' or 'n', LDY is at least max( 1, M ), and
* Ky is at least 1. Otherwise, LDY is at least 1, and Ky is at
* least N. On exit, Y is overwritten by the partial updated
* vector y.
*
* LDY (input) INTEGER
* On entry, LDY specifies the leading dimension of the array Y.
* LDY must be at least max( 1, M ) when TRANS is 'N' or
* 'n' and 1 otherwise.
*
* Notes
* =====
* N N
* ---------------------------- -----------
* | d | | |
* M | d Upper | | Upper |
* | Lower d | |d |
* | d | M | d |
* ---------------------------- | d |
* | d |
* IOFFD < 0 | Lower d |
* | d|
* N | |
* ----------- -----------
* | d Upper|
* | d | IOFFD > 0
* M | d |
* | d| N
* | Lower | ----------------------------
* | | | Upper |
* | | |d |
* | | | d |
* | | | d |
* | | |Lower d |
* ----------- ----------------------------
*
* -- Written on April 1, 1998 by
* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
*
* ---------------------------------------------------------------------
*/
/*
* .. Local Scalars ..
*/
int ione = 1;
char * Aptr = NULL;
/* ..
* .. Executable Statements ..
*
*/
if( ( M <= 0 ) || ( N <= 0 ) ) return;
if( ( Mupcase( UPLO[0] ) == CLOWER ) || ( Mupcase( UPLO[0] ) == CUPPER ) )
{
Aptr = PB_Cmalloc( M * N * TYPE->size );
TYPE->Ftzpadcpy( C2F_CHAR( UPLO ), C2F_CHAR( DIAG ), &M, &N, &IOFFD,
A, &LDA, Aptr, &M );
if( Mupcase( TRANS[0] ) == CNOTRAN )
{
TYPE->Fgemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, Aptr, &M, X, &LDX,
TYPE->one, Y, &ione );
}
else
{
TYPE->Fgemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, Aptr, &M, X, &ione,
TYPE->one, Y, &LDY );
}
if( Aptr ) free( Aptr );
}
else
{
if( Mupcase( TRANS[0] ) == CNOTRAN )
{
TYPE->Fgemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, A, &LDA, X, &LDX,
TYPE->one, Y, &ione );
}
else
{
TYPE->Fgemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, A, &LDA, X, &ione,
TYPE->one, Y, &LDY );
}
}
/*
* End of PB_Ctztrmv
*/
}
|