Ejemplo n.º 1
0
void vsip_mcumsum_f(
   const vsip_mview_f *a,
   vsip_major major,
   const vsip_mview_f *r) {
   {
      vsip_vview_f *va,vaa;
      vsip_vview_f *vr,vrr;
      vsip_index i;
      vsip_length m = a->col_length;
      vsip_length n = a->row_length;
      va = &vaa; vr = &vrr;
      if(major == VSIP_ROW){
         for(i=0; i<m; i++){
            VI_mrowview_f(a,i,va);
            VI_mrowview_f(r,i,vr);
            VI_vcumsum_f(va,vr);
         }
      } else { /* must be VSIP_COL */
         for(i=0; i<n; i++){
            VI_mcolview_f(a,i,va);
            VI_mcolview_f(r,i,vr);
            VI_vcumsum_f(va,vr);
         }
      }
   }
   return;
}
Ejemplo n.º 2
0
static void VI_qprodm_f(
       vsip_mview_f *C0,
       vsip_qr_f *qr)
{
     vsip_mview_f CC = *C0;
     vsip_mview_f *C = &CC;
     vsip_mview_f HH = *(qr->A);
     vsip_mview_f *H = &HH;
     vsip_scalar_f *beta = qr->beta + qr->N - 1;
     vsip_vview_f *h, hh;
     vsip_stride k,
                 h_s = H->row_stride + H->col_stride;
     vsip_vview_f vv = *(qr->v), ww = *(qr->w);
     vsip_vview_f *v = &vv, *w = &ww;
     h = VI_mcolview_f(H,0,&hh);
     h->offset += (qr->N - 1) * h_s;
     h->length -= (qr->N - 1);
     w->length = C->row_length;
     C->col_length -= (qr->N - 1);
     C->offset += (qr->N -1) * C->col_stride;
     for(k = qr->N -1; k >= 0; k--){
          v->length = h->length;
          VI_vcopy_f_f(h,v);
          VI_VPUT_F(v,(vsip_index)0,(vsip_scalar_f)1);
          v->length = C->col_length;
          VI_svmprod_f(- *beta,v,C,w);
          v->length = h->length;
          VI_opu_f(C,v,w);
          C->offset -= C->col_stride; C->col_length++;
          h->length++; h->offset -= h_s;
          beta--;
     }
     return;
}
Ejemplo n.º 3
0
static void VI_mprodq_f(
     vsip_mview_f *C0,
     vsip_qr_f *qr)
{
     vsip_mview_f CC = *C0;
     vsip_mview_f *C = &CC;
     vsip_mview_f HH = *(qr->A);
     vsip_mview_f *H = &HH;
     vsip_scalar_f *beta = qr->beta;
     vsip_vview_f *h, hh;
     vsip_stride k,
                 h_s = H->row_stride + H->col_stride;
     vsip_vview_f vv = *(qr->v), ww = *(qr->w);
     vsip_vview_f *v = &vv, *w = &ww;
     h = VI_mcolview_f(H,0,&hh);
     v->length = h->length;
     w->length = C->col_length;
     for(k= 0; k < (vsip_stride)H->row_length; k++){
         VI_vcopy_f_f(h,v);
         VI_VPUT_F(v,(vsip_index) 0, (vsip_scalar_f)1.0);
         v->length = C->row_length;
         VI_smvprod_f(- *beta,C,v,w);
         VI_opu_f(C,w,v);
         h->offset += h_s; h->length --;
         C->offset += C->row_stride; C->row_length--;
         v->length = h->length; beta++;
     }
     return;
}
Ejemplo n.º 4
0
void vsip_mrandu_f(
     vsip_randstate *state,
     const vsip_mview_f *A)
{
   vsip_index i;
   vsip_vview_f v;
   vsip_length M=A->col_length, N=A->row_length;
   vsip_stride CS=A->col_stride, RS=A->row_stride;
   if (CS < RS){ /* do by column */
       for (i=0; i<N; i++){
            VI_mcolview_f(A,i,&v);
            vrandu_f(state,&v);
       }
   } else { /* do by row */
        for (i=0; i<M; i++){
            VI_mrowview_f(A,i,&v);
            vrandu_f(state,&v);
       }
   }
}