vsip_scalar_f (vsip_cvmodulate_f)( const vsip_cvview_f* a, vsip_scalar_f nu, vsip_scalar_f phi, const vsip_cvview_f* r) { { /* register */ vsip_length n = r->length; vsip_stride cast = a->block->cstride, crst = r->block->cstride; vsip_scalar_f *apr = (vsip_scalar_f*) ((a->block->R->array) + cast * a->offset), *rpr = (vsip_scalar_f*) ((r->block->R->array) + crst * r->offset); vsip_scalar_f *api = (vsip_scalar_f*) ((a->block->I->array) + cast * a->offset), *rpi = (vsip_scalar_f*) ((r->block->I->array) + crst * r->offset); vsip_scalar_f arg = phi; /* register */ vsip_stride ast = (cast * a->stride), rst = (crst * r->stride); while(n-- > 0){ *rpr = *apr * VSIP_COS_F(arg) - *api * VSIP_SIN_F(arg); *rpi = *apr * VSIP_SIN_F(arg) + *api * VSIP_COS_F(arg); arg += nu; apr += ast; api += ast; rpr += rst; rpi += rst; } return arg; } }
void (vsip_vrect_f)( const vsip_vview_f* r, const vsip_vview_f* t, const vsip_cvview_f* a) {/* a_j = r_j*(cos(t_j), sin(t_j)) */ { /* register */ vsip_length n = r->length; vsip_stride cast = a->block->cstride, rrst = r->block->rstride, trst = r->block->rstride; vsip_scalar_f *apr = (vsip_scalar_f*) ((a->block->R->array) + cast * a->offset), *rp = (vsip_scalar_f*) ((r->block->array) + rrst * r->offset), *tp = (vsip_scalar_f*) ((t->block->array) + trst * t->offset); vsip_scalar_f *api = (vsip_scalar_f*) ((a->block->I->array) + cast * a->offset); vsip_scalar_f temp = 0; /* register */ vsip_stride ast = (cast * a->stride), rst = rrst * r->stride, tst = trst * t->stride; while(n-- > 0){ temp = *rp * VSIP_SIN_F(*tp); *apr = *rp * VSIP_COS_F(*tp); *api = temp; apr += ast; api += ast; rp += rst; tp += tst; } } }
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; }
vsip_cscalar_f (vsip_rect_f)( vsip_scalar_f r, vsip_scalar_f t) { return vsip_cmplx_f(r * VSIP_COS_F(t), r * VSIP_SIN_F(t)); }