コード例 #1
0
static void VI_mprodq_d(
     vsip_mview_d *C,
     vsip_qr_d *qr)
{
     vsip_mview_d *H = qr->A;
     vsip_scalar_d *beta = qr->beta;
     vsip_vview_d *h, hh;
     vsip_length j;
     vsip_stride k;
     vsip_vview_d vv = *(qr->v),
                  ww = *(qr->w); 
     vsip_vview_d *v = &vv,
                  *w = &ww;
     h = VI_mcolview_d(H,0,&hh);
     w->length = C->col_length;
     for(k= 0; k < (vsip_stride)H->row_length; k++){
         j = (vsip_length)k;
         h->offset = j * H->row_stride +
                     j * H->col_stride + H->offset;
         h->length = H->col_length - j;
         v->length = h->length;
         v->offset = qr->M - h->length;
         VI_vcopy_d_d(h,v);
         VI_VPUT_D(v,(vsip_index) 0, (vsip_scalar_d)1.0);
         vv = *(qr->v);
         v->length = C->col_length;
         VI_smvprod_d(-beta[j],C,v,w);
         v->length = qr->M;
         VI_opu_d(C,w,v);
         vv = *(qr->v);
         VI_VPUT_D(v,k,0);
     }   
     return;
}
コード例 #2
0
static 
void 
VI_qprodm_d(
       vsip_mview_d *C,
       vsip_qr_d *qr)
{
     vsip_mview_d *H = qr->A;
     vsip_scalar_d *beta = qr->beta;
     vsip_vview_d *h, hh;
     vsip_length j;
     vsip_stride k;
     vsip_vview_d vv = *(qr->v),
                  ww = *(qr->w);
     vsip_vview_d *v = &vv, *w = &ww;
     VI_vfill_d(0,v);
     h = VI_mcolview_d(H,0,&hh);
     w->length = C->row_length;
     for(k = qr->N -1; k >= 0; k--){
          j = (vsip_length)k;
          h->offset = j * (H->row_stride + H->col_stride) + H->offset;
          h->length = H->col_length -j;
          v->length = h->length;
          v->offset = qr->M - h->length;
          VI_vcopy_d_d(h,v);
          VI_VPUT_D(v,(vsip_index)0,(vsip_scalar_d)1);
          vv = *(qr->v);
          v->length = C->col_length;
          VI_svmprod_d(-beta[j],v,C,w);
          v->length = qr->M;
          VI_opu_d(C,v,w);
     }
     return;
}
コード例 #3
0
int vsip_firflt_d(
        vsip_fir_d *fir,
        const vsip_vview_d *xc,
        const vsip_vview_d *yc)
{
    vsip_length nout,k;
    vsip_vview_d xx = *xc,
                 yy = *yc;
    vsip_vview_d H1 = *(fir->h),
                 H2 = *(fir->h);
    vsip_vview_d *x=&xx,*y=&yy;
    vsip_vview_d *h1=&H1,*h2=&H2;
    vsip_offset oinc;
    oinc = (vsip_offset)((vsip_stride)fir->D * x->stride);

    /* calculate number of terms in y */
    nout = (fir->N - fir->p);
    nout = ((nout % fir->D) == 0) ? (nout / fir->D ) : (nout / fir->D + 1);

    /* do overlap section */
    k = 0;
    x->length = fir->p + 1;
    h1->length = fir->s->length;
    h2->length = x->length;
    h2->offset = h1->length;

    while(x->length < fir->M){
        VI_VPUT_D(y,k++,vsip_vdot_d(h1,fir->s)+vsip_vdot_d(h2,x));
        x->length += fir->D;
        fir->s->length -= fir->D;
        fir->s->offset += fir->D;
        h1->length = fir->s->length;
        h2->length = x->length;
        h2->offset = h1->length;
    }
    x->offset += (x->length - fir->M) * x->stride;
    x->length = fir->M;

    while(k < nout){ /* do the rest of the pieces */
       VI_VPUT_D(y,k++,vsip_vdot_d(fir->h,x));
       x->offset += oinc;
    }

    {  /* Hacked Mod because In ANSI C it is a machine dependent mod for negative */
       vsip_stride temp_p = (fir->p % fir->D)  - (fir->N % fir->D);
       fir->p = ((temp_p < 0) ? (vsip_length)((vsip_stride)fir->D + temp_p) : (vsip_length)temp_p); 
    }
    fir->s->offset = 0;
    fir->s->length = (fir->state == VSIP_STATE_SAVE) ? fir->M - 1 - fir->p : fir->M -1;
    x->length = fir->s->length;
    /* fix by JMA 31/01/2000, incorrect offset calculation */
    /* x->offset = xc->length - fir->s->length; */
    x->offset = xc->offset + (xc->length - fir->s->length) * xc->stride;
    if((fir->s->length > 0) && (fir->state == VSIP_STATE_SAVE)) 
          VI_vcopy_d_d(x,fir->s);
    if(fir->state == VSIP_STATE_NO_SAVE){
         VI_vfill_d(0,fir->s);
         fir->p = 0;
     }
    return (int)k;
}