extern "C" void magma_zlarfxsym(magma_int_t N, magmaDoubleComplex *A, magma_int_t LDA, magmaDoubleComplex *V, magmaDoubleComplex *TAU) { magma_int_t IONE=1; magmaDoubleComplex dtmp; magmaDoubleComplex Z_ZERO = MAGMA_Z_ZERO; //magmaDoubleComplex Z_ONE = MAGMA_Z_ONE; magmaDoubleComplex Z_MONE = MAGMA_Z_NEG_ONE; magmaDoubleComplex Z_HALF = MAGMA_Z_HALF; //magmaDoubleComplex WORK[N]; magmaDoubleComplex *WORK; magma_zmalloc_cpu( &WORK, N ); /* apply left and right on A(st:ed,st:ed)*/ //magma_zlarfxsym(len,A(st,st),LDX,V(st),TAU(st)); /* X = AVtau */ blasf77_zhemv("L",&N, TAU, A, &LDA, V, &IONE, &Z_ZERO, WORK, &IONE); /* je calcul dtmp= X'*V */ dtmp = magma_cblas_zdotc(N, WORK, IONE, V, IONE); /* je calcul 1/2 X'*V*t = 1/2*dtmp*tau */ dtmp = -dtmp * Z_HALF * (*TAU); /* je calcul W=X-1/2VX'Vt = X - dtmp*V */ /* for (j = 0; j < N; j++) WORK[j] = WORK[j] + (dtmp*V[j]); */ blasf77_zaxpy(&N, &dtmp, V, &IONE, WORK, &IONE); /* performs the symmetric rank 2 operation A := alpha*x*y' + alpha*y*x' + A */ blasf77_zher2("L",&N,&Z_MONE,WORK,&IONE,V,&IONE,A,&LDA); magma_free_cpu(WORK); }
inline static void magma_zlarfxsym_v2(magma_int_t n, magmaDoubleComplex *A, magma_int_t lda, magmaDoubleComplex *V, magmaDoubleComplex *TAU, magmaDoubleComplex *work) { /* WORK (workspace) double complex array, dimension N */ magma_int_t ione = 1; magmaDoubleComplex dtmp; magmaDoubleComplex c_zero = MAGMA_Z_ZERO; magmaDoubleComplex c_neg_one= MAGMA_Z_NEG_ONE; magmaDoubleComplex c_half = MAGMA_Z_HALF; /* X = AVtau */ blasf77_zhemv("L",&n, TAU, A, &lda, V, &ione, &c_zero, work, &ione); /* compute dtmp= X'*V */ #if defined(PRECISION_z) || defined(PRECISION_c) dtmp = c_zero; for (magma_int_t j = 0; j < n ; j++) dtmp = dtmp + MAGMA_Z_CNJG(work[j]) * V[j]; //cblas_zdotc_sub(n, work, ione, V, ione, &dtmp); #else dtmp = cblas_zdotc(n, work, ione, V, ione); #endif /* compute 1/2 X'*V*t = 1/2*dtmp*tau */ dtmp = -dtmp * c_half * (*TAU); /* compute W=X-1/2VX'Vt = X - dtmp*V */ blasf77_zaxpy(&n, &dtmp, V, &ione, work, &ione); /* performs the symmetric rank 2 operation A := alpha*x*y' + alpha*y*x' + A */ blasf77_zher2("L", &n, &c_neg_one, work, &ione, V, &ione, A, &lda); }