Esempio n. 1
0
void (vsip_mexp_f)(
  const vsip_mview_f *a,
  const vsip_mview_f *r) {

  { 
    vsip_length n_mj, /* major length */
                n_mn; /* minor length */
    vsip_stride ast_mj, ast_mn,
                rst_mj, rst_mn;
    vsip_scalar_f *ap = (a->block->array) + a->offset * a->block->rstride,
                  *rp = (r->block->array) + r->offset * r->block->rstride;
    vsip_scalar_f *ap0 = ap,
                  *rp0 = rp;
    /* pick direction dependent on output */
    if(r->row_stride < r->col_stride){
           n_mj    = r->row_length; n_mn = r->col_length;
           rst_mj  = r->row_stride; rst_mn = r->col_stride;
           ast_mj  = a->row_stride; ast_mn = a->col_stride;
           rst_mj *= r->block->rstride; rst_mn *= r->block->rstride;
           ast_mj *= a->block->rstride; ast_mn *= a->block->rstride;
    } else {
           n_mn    = r->row_length; n_mj = r->col_length;
           rst_mn  = r->row_stride; rst_mj = r->col_stride;
           ast_mn  = a->row_stride; ast_mj = a->col_stride;
           rst_mn *= r->block->rstride; rst_mj *= r->block->rstride;
           ast_mn *= a->block->rstride; ast_mj *= a->block->rstride;
    }
    /*end define*/
    if(ap == rp){ /* inplace */
       while(n_mn-- > 0){
          vsip_length n = n_mj;
          while(n-- >0){
            *rp = VSIP_EXP_F(*rp);
             rp += rst_mj;
          }
          rp0 += rst_mn;
          rp = rp0;
       }
    } else {
       while(n_mn-- > 0){
          vsip_length n = n_mj;
          while(n-- >0){
            *rp = VSIP_EXP_F(*ap);
            ap += ast_mj;  rp += rst_mj;
          }
          ap0 += ast_mn; rp0 += rst_mn;
          ap = ap0; rp = rp0;
    }
   }
  }
  return;
}
Esempio n. 2
0
void (vsip_vexp_f)(
  const vsip_vview_f *a,
  const vsip_vview_f *r) {
  { 
     /*define variables*/
      /* register */ vsip_length n = r->length;
      /* register */ vsip_stride ast = a->stride * a->block->rstride,
                                 rst = r->stride * r->block->rstride;
      vsip_scalar_f *ap = (a->block->array) + a->offset * a->block->rstride,
                    *rp = (r->block->array) + r->offset * r->block->rstride;
      /*end define*/
      while(n-- > 0){
         *rp = VSIP_EXP_F(*ap);
         ap += ast; rp += rst;
      }
   }
}
Esempio n. 3
0
void (vsip_cmexp_f)(
  const vsip_cmview_f *a,
  const vsip_cmview_f *r) {

  { 
    vsip_length n_mj, /* major length */
                n_mn; /* minor length */
    vsip_stride ast_mj, ast_mn,
                rst_mj, rst_mn;
    vsip_scalar_f *ap_r = (a->block->R->array) + a->offset * a->block->cstride,
                  *rp_r = (r->block->R->array) + r->offset * r->block->cstride;
    vsip_scalar_f *ap_i = (a->block->I->array) + a->offset * a->block->cstride,
                  *rp_i = (r->block->I->array) + r->offset * r->block->cstride;
    vsip_scalar_f *ap0_r = ap_r,
                  *rp0_r = rp_r;
    vsip_scalar_f *ap0_i = ap_i,
                  *rp0_i = rp_i;
    vsip_scalar_f mag = 0;
    /* pick direction dependent on output */
    if(r->row_stride < r->col_stride){
           n_mj = r->row_length; n_mn = r->col_length;
           rst_mj = r->row_stride; rst_mn = r->col_stride;
           ast_mj = a->row_stride; ast_mn = a->col_stride;
           rst_mj *= r->block->cstride; rst_mn *= r->block->cstride;
           ast_mj *= a->block->cstride; ast_mn *= a->block->cstride;
    } else {
           n_mn = r->row_length; n_mj = r->col_length;
           rst_mn = r->row_stride; rst_mj = r->col_stride;
           ast_mn = a->row_stride; ast_mj = a->col_stride;
           rst_mn *= r->block->cstride; rst_mj *= r->block->cstride;
           ast_mn *= a->block->cstride; ast_mj *= a->block->cstride;
    }
    /*end define*/
    if(ap_i == rp_i){ /* inplace */
       while(n_mn-- > 0){
          vsip_length n = n_mj;
          while(n-- >0){
             mag = VSIP_EXP_F(*rp_r);
             *rp_r = mag * VSIP_COS_F(*rp_i);
             *rp_i = mag * VSIP_SIN_F(*rp_i);
             rp_r += rst_mj;
             rp_i += rst_mj;
          }
          rp0_r += rst_mn;
          rp0_i += rst_mn;
          rp_r = rp0_r;
          rp_i = rp0_i;
       }
    } else { /* out of place */
       while(n_mn-- > 0){
          vsip_length n = n_mj;
          while(n-- >0){
             mag = VSIP_EXP_F(*ap_r);
             *rp_r = mag * VSIP_COS_F(*ap_i);
             *rp_i = mag * VSIP_SIN_F(*ap_i);
             ap_r += ast_mj;  rp_r += rst_mj;
             ap_i += ast_mj;  rp_i += rst_mj;
          }
          ap0_r += ast_mn; rp0_r += rst_mn;
          ap0_i += ast_mn; rp0_i += rst_mn;
          ap_r = ap0_r; rp_r = rp0_r;
          ap_i = ap0_i; rp_i = rp0_i;
    }
   }
  }
  return;
}