Exemplo n.º 1
0
extern "C" void
magma_dtrdtype2cbHLsym_withQ_v2(magma_int_t n, magma_int_t nb,
                                double *A, magma_int_t lda,
                                double *V, magma_int_t ldv,
                                double *TAU,
                                magma_int_t st, magma_int_t ed,
                                magma_int_t sweep, magma_int_t Vblksiz,
                                double *work)
{
    /*
     WORK (workspace) double real array, dimension NB
    */

    magma_int_t ione = 1;
    magma_int_t vpos, taupos;

    double conjtmp;

    double c_one = MAGMA_D_ONE;

    magma_int_t ldx = lda-1;
    magma_int_t len = ed - st + 1;
    magma_int_t lem = min(ed+nb, n) - ed;

    if (lem > 0) {
        magma_bulge_findVTAUpos(n, nb, Vblksiz, sweep-1, st-1, ldv, &vpos, &taupos);
        /* apply remaining right coming from the top block */
        lapackf77_dlarfx("R", &lem, &len, V(vpos), TAU(taupos), A(ed+1, st), &ldx, work);
    }
    if (lem > 1) {
        magma_bulge_findVTAUpos(n, nb, Vblksiz, sweep-1, ed, ldv, &vpos, &taupos);

        /* remove the first column of the created bulge */
        *V(vpos)  = c_one;
        //memcpy(V(vpos+1), A(ed+2, st), (lem-1)*sizeof(double));
        cblas_dcopy(lem-1, A(ed+2, st), ione, V(vpos+1), ione);
        memset(A(ed+2, st),0,(lem-1)*sizeof(double));

        /* Eliminate the col at st */
        lapackf77_dlarfg( &lem, A(ed+1, st), V(vpos+1), &ione, TAU(taupos) );

        /* apply left on A(J1:J2,st+1:ed) */
        len = len-1; /* because we start at col st+1 instead of st. col st is the col that has been removed; */
        conjtmp = MAGMA_D_CNJG(*TAU(taupos));
        lapackf77_dlarfx("L", &lem, &len, V(vpos),  &conjtmp, A(ed+1, st+1), &ldx, work);
    }
}
Exemplo n.º 2
0
extern "C" void
magma_dtrdtype2cbHLsym_withQ(
    magma_int_t N, magma_int_t NB,
    double *A, magma_int_t LDA,
    double *V, double *TAU,
    magma_int_t st, magma_int_t ed, magma_int_t sweep, magma_int_t Vblksiz)
{
    magma_int_t    J1, J2, len, lem, LDX;
    //magma_int_t    i, j;
    magma_int_t    IONE=1;
    magma_int_t    blkid, vpos, taupos, tpos;
    double conjtmp;
    double Z_ONE  =  MAGMA_D_ONE;
    //double WORK[NB];
    double *WORK;
    magma_dmalloc_cpu( &WORK, NB );


    findVTpos(N,NB,Vblksiz,sweep-1,st-1, &vpos, &taupos, &tpos, &blkid);
    LDX    = LDA-1;
    J1     = ed+1;
    J2     = min(ed+NB,N);
    len    = ed-st+1;
    lem    = J2-J1+1;
    if (lem > 0) {
        /* apply remaining right commming from the top block */
        lapackf77_dlarfx("R", &lem, &len, V(vpos), TAU(taupos), A(J1, st), &LDX, WORK);
    }
    if (lem > 1) {
        findVTpos(N,NB,Vblksiz,sweep-1,J1-1, &vpos, &taupos, &tpos, &blkid);
        /* remove the first column of the created bulge */
        *V(vpos)  = Z_ONE;
        memcpy(V(vpos+1), A(J1+1, st), (lem-1)*sizeof(double));
        memset(A(J1+1, st),0,(lem-1)*sizeof(double));
        /* Eliminate the col at st */
        lapackf77_dlarfg( &lem, A(J1, st), V(vpos+1), &IONE, TAU(taupos) );
        /* apply left on A(J1:J2,st+1:ed) */
        len = len-1; /* because we start at col st+1 instead of st. col st is the col that has been revomved; */
        conjtmp = MAGMA_D_CNJG(*TAU(taupos));
        lapackf77_dlarfx("L", &lem, &len, V(vpos),  &conjtmp, A(J1, st+1), &LDX, WORK);
    }
    magma_free_cpu(WORK);
}
Exemplo n.º 3
0
extern "C" void
magma_dsbtype2cb(magma_int_t n, magma_int_t nb,
                double *A, magma_int_t lda,
                double *V, magma_int_t ldv,
                double *TAU,
                magma_int_t st, magma_int_t ed, magma_int_t sweep,
                magma_int_t Vblksiz, magma_int_t wantz,
                double *work)
{
    double ctmp;
    magma_int_t J1, J2, len, lem, ldx;
    magma_int_t vpos, taupos;
    //magma_int_t blkid, tpos;
    magma_int_t ione = 1;
    const double c_one    =  MAGMA_D_ONE;

    if ( wantz == 0 ) {
        vpos   = (sweep%2)*n + st;
        taupos = (sweep%2)*n + st;
    } else {
        //findVTpos(n, nb, Vblksiz, sweep, st, &vpos, &taupos, &tpos, &blkid);
        magma_bulge_findVTAUpos(n, nb, Vblksiz, sweep, st, ldv, &vpos, &taupos);
    }

    ldx = lda-1;
    J1  = ed+1;
    J2  = min(ed+nb,n-1);
    len = ed-st+1;
    lem = J2-J1+1;

    if ( lem > 0 ) {
        /* Apply remaining right commming from the top block */
        lapackf77_dlarfx("R", &lem, &len, V(vpos), TAU(taupos), A(J1, st), &ldx, work);
    }

    if ( lem > 1 ) {
        if ( wantz == 0 ) {
            vpos   = (sweep%2)*n + J1;
            taupos = (sweep%2)*n + J1;
        } else {
            magma_bulge_findVTAUpos(n, nb, Vblksiz, sweep, J1, ldv, &vpos, &taupos);
            //findVTpos(n,nb,Vblksiz,sweep,J1, &vpos, &taupos, &tpos, &blkid);
        }

        /* Remove the first column of the created bulge */
        *V(vpos)  = c_one;
        
        //magma_int_t lem2=lem-1;
        //blasf77_dcopy( &lem2, A(ed+2, st), &ione, V(vpos+1), &ione );
        memcpy(V(vpos+1), A(J1+1, st), (lem-1)*sizeof(double));
        memset(A(J1+1, st), 0, (lem-1)*sizeof(double));

        /* Eliminate the col at st */
        lapackf77_dlarfg( &lem, A(J1, st), V(vpos+1), &ione, TAU(taupos) );

        /*
         * Apply left on A(J1:J2,st+1:ed)
         * We decrease len because we start at col st+1 instead of st.
         * col st is the col that has been revomved;
         */
        len = len-1;
        ctmp = MAGMA_D_CONJ(*TAU(taupos));
        lapackf77_dlarfx("L", &lem, &len, V(vpos),  &ctmp, A(J1, st+1), &ldx, work);
    }
}