NAG C Library Function Document nag_zhemv (f16scc)

Similar documents
NAG C Library Function Document nag_zgemv (f16sac)

NAG C Library Function Document nag_zhpmv (f16sec)

NAG C Library Function Document nag_zhbmv (f16sdc)

NAG C Library Function Document nag_dgemv (f16pac)

NAG C Library Function Document nag_zger (f16smc)

NAG Library Function Document nag_zsymv (f16tac)

NAG Library Function Document nag_dsymv (f16pcc)

NAG C Library Function Document nag_dsbmv (f16pdc)

NAG Library Function Document nag_dtrmv (f16pfc)

NAG C Library Function Document nag_dgbmv (f16pbc)

NAG Library Function Document nag_zhpr2 (f16ssc)

NAG Library Function Document nag_zhpr2 (f16ssc)

NAG Library Function Document nag_dger (f16pmc)

NAG Library Function Document nag_dtr_load (f16qgc)

NAG Library Function Document nag_dspr (f16pqc)

NAG Library Function Document nag_dgbmv (f16pbc)

NAG Library Function Document nag_dtpsv (f16plc)

NAG Library Function Document nag_zaxpby (f16gcc)

NAG C Library Function Document nag_zsytri (f07nwc)

NAG C Library Function Document nag_binary_factor_service (g11sbc)

NAG Library Function Document nag_dtpttr (f01vcc)

NAG Library Function Document nag_dtrttf (f01vec)

NAG Library Function Document nag_dsytrf (f07mdc)

NAG Library Function Document nag_zhfrk (f16zqc)

NAG Library Function Document nag_ztrttf (f01vfc)

NAG Library Function Document nag_ztbcon (f07vuc)

NAG Library Function Document nag_dgglse (f08zac)

NAG C Library Function Document nag_zspcon (f07quc)

NAG Library Function Document nag_zhpev (f08gnc)

NAG Library Function Document nag_dgetri (f07ajc)

NAG C Library Function Document nag_dspcon (f07pgc)

NAG Library Function Document nag_dsf_norm (f16rkc)

NAG Library Function Document nag_dpbtrf (f07hdc)

NAG Library Function Document nag_dgetrf (f07adc)

NAG Library Function Document nag_dtrsyl (f08qhc)

NAG Library Function Document nag_dtfttp (f01vlc)

NAG Library Function Document nag_real_gen_matrix_exp (f01ecc)

NAG C Library Function Document nag_linf_fit (e02gcc)

NAG Library Function Document nag_zpbequ (f07htc)

NAG Library Function Document nag_ztfttp (f01vmc)

NAG Library Function Document nag_dspsv (f07pac)

NAG Library Function Document nag_dgb_norm (f16rbc)

NAG Library Function Document nag_zgelsy (f08bnc)

NAG C Library Function Document nag_dgbtrs (f07bec)

NAG Library Function Document nag_dsygv (f08sac)

NAG Library Function Document nag_dgelsd (f08kcc)

NAG Library Function Document nag_zgelss (f08knc)

NAG Library Function Document nag_complex_gen_lin_solve (f04cac)

NAG Library Function Document nag_real_sym_posdef_tridiag_lin_solve (f04bgc)

NAG Library Function Document nag_zheevx (f08fpc)

NAG Library Function Document nag_rngs_copula_students_t (g05rbc)

NAG Library Function Document nag_herm_posdef_tridiag_lin_solve (f04cgc)

NAG Library Function Document nag_dgttrs (f07cec)

NAG Library Function Document nag_rgsn_matrix_multi_normal (g05lyc)

NAG Library Function Document nag_ztzrzf (f08bvc)

NAG Library Function Document nag_dsbev (f08hac)

NAG C Library Function Document nag_rngs_varma_time_series (g05pcc)

NAG Library Function Document nag_complex_tridiag_lin_solve (f04ccc)

NAG Library Function Document nag_matop_complex_gen_matrix_cond_sqrt (f01kdc)

NAG Library Function Document nag_matop_complex_gen_matrix_fun_num (f01flc)

NAG Library Function Document nag_all_regsn (g02eac)

NAG C Library Function Document nag_surviv_risk_sets (g12zac)

NAG C Library Function Document nag_rank_regsn (g08rac)

NAG Library Function Document nag_zhbevx (f08hpc)

NAG Library Function Document nag_dstev (f08jac)

NAG Library Function Document nag_ztgsen (f08yuc)

NAG Library Function Document nag_rngs_varma_time_series (g05pcc)

NAG Library Function Document nag_asian_geom_price (s30sac)

NAG Library Function Document. nag_matop_complex_gen_matrix_cond_num

NAG Library Function Document nag_matop_real_gen_matrix_fun_num (f01elc)

NAG C Library Function Document nag_cp_stat (g02ecc)

NAG Library Function Document. nag_matop_real_gen_matrix_cond_num

NAG Library Function Document nag_1d_cheb_fit_constr (e02agc)

NAG Library Function Document nag_rand_copula_normal (g05rdc)

NAG Library Function Document nag_dgges (f08xac)

NAG Library Function Document nag_mv_ordinal_multidimscale (g03fcc)

NAG Library Function Document nag_sum_sqs_update (g02btc)

NAG C Library Function Document nag_superlu_condition_number_lu (f11mgc)

NAG Library Function Document nag_mv_distance_mat (g03eac)

NAG C Library Function Document nag_tsa_multi_auto_corr_part (g13dbc)

NAG Library Function Document nag_robust_m_corr_user_fn_no_derr (g02hmc)

NAG Library Function Document nag_rand_copula_clayton (g05rhc)

NAG Library Function Document nag_bsm_price (s30aac)

NAG Library Function Document nag_robust_m_corr_user_fn (g02hlc)

NAG Library Function Document nag_mldwt_2d (c09ecc)

NAG Library Function Document nag_zggesx (f08xpc)

NAG Library Function Document nag_2d_panel_sort (e02zac)

NAG Library Function Document nag_rand_bivariate_copula_frank (g05rfc)

NAG Library Function Document nag_bsm_greeks (s30abc)

NAG C Library Function Document nag_mesh2d_delaunay (d06abc)

NAG Library Function Document nag_superlu_lu_factorize (f11mec)

NAG Library Function Document nag_asian_geom_greeks (s30sbc)

NAG Library Function Document nag_real_cholesky_skyline_solve (f04mcc)

NAG C Library Function Document nag_tsa_multi_cross_corr (g13dmc)

NAG Library Function Document nag_sparse_nherm_jacobi (f11dxc)

NAG Library Function Document nag_rand_2_way_table (g05pzc)

NAG Library Function Document nag_mv_promax (g03bdc)

NAG C Library Function Document nag_tsa_multi_part_lag_corr (g13dnc)

NAG Library Function Document nag_tsa_dickey_fuller_unit (g13awc)

NAG Library Function Document nag_superlu_diagnostic_lu (f11mmc)

Transcription:

f16 NAG Interface to BLAS f16scc 1 Purpose NAG C Library Function Document nag_zhemv (f16scc) nag_zhemv (f16scc) performs matrix-vector multiplication for a complex Hermitian matrix. 2 Specification #include <nag.h> #include <nagf16.h> void nag_zhemv (Nag_OrderType order, Nag_UploType uplo, Integer n, Complex alpha, const Complex a[], Integer pda, const Complex x[], Integer incx, Complex beta, Complex y[], Integer incy, NagError *fail) 3 Description nag_zhemv (f16scc) performs the matrix-vector operation y Ax þ y where A is an n by n complex Hermitian matrix, x and y are n element complex vectors, and and are complex scalars. 4 References The BLAS Technical Forum Standard (2001) www.netlib.org/blas/blast-forum 5 Arguments 1: order Nag_OrderType Input On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., rowmajor ordering or column-major ordering. C language defined storage is specified by order ¼ Nag_RowMajor. See Section 2.2.1.4 of the Essential Introduction for a more detailed explanation of the use of this argument. Constraint: order ¼ Nag_RowMajor or Nag_ColMajor. 2: uplo Nag_UploType Input On entry: specifies whether the upper or lower triangular part of A is stored. uplo ¼ Nag_Upper The upper triangular part of A is stored. uplo ¼ Nag_Lower The lower triangular part of A is stored. Constraint: uplo ¼ Nag_Upper or Nag_Lower. 3: n Integer Input On entry: n, the order of the matrix A. Constraint: n 0. f16scc.1

f16scc NAG C Library Manual 4: alpha Complex Input On entry: the scalar. 5: a½dimš const Complex Input Note: the dimension, dim, of the array a must be at least maxð1; pda nþ. If order ¼ Nag_ColMajor, the If order ¼ Nag_RowMajor, the ði; jþth element of the matrix A is stored in a½ðj 1Þpda þ i 1Š. ði; jþth element of the matrix A is stored in a½ði 1Þpda þ j 1Š. On entry: the n by n Hermitian matrix A. If uplo ¼ Nag_Upper, the upper triangle of A must be stored and the elements of the array below the diagonal are not referenced. If uplo ¼ Nag_Lower, the lower triangle of A must be stored and the elements of the array above the diagonal are not referenced. 6: pda Integer Input On entry: the stride separating matrix row or column elements (depending on the value of order) in the array a. Constraint: pda maxð1; nþ. 7: x½dimš const Complex Input Note: the dimension, dim, of the array x must be at least maxð1; 1 þ ðn 1ÞjincxjÞ. On entry: the vector x. 8: incx Integer Input On entry: the increment in the subscripts of x between successive elements of x. Constraint: incx 6¼ 0. 9: beta Complex Input On entry: the scalar. 10: y½dimš Complex Input/Output Note: the dimension, dim, of the array y must be at least maxð1; 1 þ ðn 1ÞjincyjÞ. On entry: the vector y. If beta ¼ 0, y need not be set. On exit: the updated vector y. 11: incy Integer Input On entry: the increment in the subscripts of y between successive elements of y. Constraint: incy 6¼ 0. 12: fail NagError * Input/Output The NAG error argument (see Section 2.6 of the Essential Introduction). 6 Error Indicators and Warnings NE_ALLOC_FAIL Dynamic memory allocation failed. f16scc.2

f16 NAG Interface to BLAS f16scc NE_BAD_PARAM On entry, argument NE_INT On entry, incx ¼ hvaluei. Constraint: incx 6¼ 0. On entry, incy ¼ hvaluei. Constraint: incy 6¼ 0. On entry, n ¼ hvaluei. Constraint: n 0. hvaluei had an illegal value. NE_INT_2 On entry, pda ¼ hvaluei, n ¼ hvaluei. Constraint: pda maxð1; nþ. 7 Accuracy The BLAS standard requires accurate implementations which avoid unnecessary over/underflow (see Section 2.7 of The BLAS Technical Forum Standard (2001)). 8 Further Comments None. 9 Example To compute the matrix-vector product where y ¼ Ax þ y 0 1 1:0 þ 0:0i 1:0 þ 2:0i 1:0 þ 3:0i A ¼ @ 1:0 2:0i 2:0 þ 0:0i 2:0 þ 3:0i A, 1:0 3:0i 2:0 3:0i 3:0 þ 0:0i 0 1 1:0 1:0i x ¼ @ 2:0 2:0i A, 3:0 3:0i 9.1 Program Text 0 1 9:0 2:5i y ¼ @ 7:5 þ 4:0i A, 0:0 þ 14:5i ¼ 1:0 þ 0:0i and ¼ 2:0 þ 0:0i. /* nag_zhemv (f16scc) Example Program. * * Copyright 2005 Numerical Algorithms Group. * * Mark 8, 2005. */ #include <stdio.h> #include <nag.h> #include <nag_stdlib.h> #include <nagf16.h> f16scc.3

f16scc NAG C Library Manual #include <nagx04.h> int main(void) /* Scalars */ Complex alpha, beta; Integer exit_status, i, incx, incy, j, n, pda, xlen, ylen; /* Arrays */ Complex *a=0, *x=0, *y=0; char nag_enum_arg[40]; /* Nag Types */ NagError fail; Nag_OrderType order; Nag_UploType uplo; #ifdef NAG_COLUMN_MAJOR #define A(I,J) a[(j-1)*pda + I - 1] order = Nag_ColMajor; #else #define A(I,J) a[(i-1)*pda + J - 1] order = Nag_RowMajor; #endif exit_status = 0; INIT_FAIL(fail); Vprintf( "nag_zhemv (f16scc) Example Program Results\n\n"); /* Skip heading in data file */ Vscanf("%*[^\n] "); /* Read the problem dimension */ Vscanf("%ld%*[^\n] ", &n); /* Read uplo */ Vscanf("%s%*[^\n] ", nag_enum_arg); /* nag_enum_name_to_value(x04nac). * Converts NAG enum member name to value */ uplo = nag_enum_name_to_value(nag_enum_arg); /* Read scalar parameters */ Vscanf(" ( %lf, %lf ) ( %lf, %lf )%*[^\n] ", &alpha.re, &alpha.im, &beta.re, &beta.im); /* Read increment parameters */ Vscanf("%ld%ld%*[^\n] ", &incx, &incy); pda = n; xlen = MAX(1, 1 + (n - 1)*ABS(incx)); ylen = MAX(1, 1 + (n - 1)*ABS(incy)); if (n > 0) /* Allocate memory */ if (!(a = NAG_ALLOC(n*pda, Complex))!(x = NAG_ALLOC(xlen, Complex))!(y = NAG_ALLOC(ylen, Complex)) ) Vprintf("Allocation failure\n"); exit_status = -1; goto END; else Vprintf("Invalid n\n"); exit_status = 1; return exit_status; /* Input the matrix A and vectors x and y */ f16scc.4

f16 NAG Interface to BLAS f16scc if (uplo == Nag_Upper) for (i = 1; i <= n; ++i) for (j = i; j <= n; ++j) Vscanf(" ( %lf, %lf ) ", &A(i,j).re, &A(i,j).im); Vscanf("%*[^\n] "); else for (i = 1; i <= n; ++i) for (j = 1; j <= i; ++j) Vscanf(" ( %lf, %lf ) ", &A(i,j).re, &A(i,j).im); Vscanf("%*[^\n] "); for (i = 1; i <= xlen; ++i) Vscanf(" ( %lf, %lf )%*[^\n] ", &x[i - 1].re, &x[i - 1].im); for (i = 1; i <= ylen; ++i) Vscanf(" ( %lf, %lf )%*[^\n] ", &y[i - 1].re, &y[i - 1].im); /* nag_zhemv(f16scc). * Hermitian matrix-vector multiply. * */ nag_zhemv(order, uplo, n, alpha, a, pda, x, incx, beta, y, incy, &fail ); if (fail.code!= NE_NOERROR) Vprintf("Error from nag_zhemv.\n%s\n", fail.message); exit_status = 1; goto END; /* Print output vector y */ Vprintf("%s\n", " y"); for (i = 1; i <= ylen; ++i) Vprintf("(%11f,%11f)\n", y[i-1].re, y[i-1].im); END: if (a) if (x) if (y) return NAG_FREE(a); NAG_FREE(x); NAG_FREE(y); exit_status; 9.2 Program Data nag_zhemv (f16scc) Example Program Data 3 : n the dimension of matrix A Nag_Upper : uplo ( 1.0, 0.0 ) ( 2.0, 0.0 ) : alpha, beta 1 1 : incx, incy ( 1.0, 0.0 ) ( 1.0, 2.0 ) ( 1.0, 3.0 ) ( 2.0, 0.0 ) ( 2.0, 3.0 ) ( 3.0, 0.0 ) : the end of matrix A ( 1.0,-1.0) ( 2.0,-2.0) ( 3.0,-3.0) : the end of vector x (-9.0,-2.5) (-7.5, 4.0) ( 0.0, 14.5) : the end of vector y f16scc.5

f16scc NAG C Library Manual 9.3 Program Results nag_zhemv (f16scc) Example Program Results y ( 1.000000, 2.000000) ( 3.000000, 4.000000) ( 5.000000, 6.000000) f16scc.6 (last)