static vsip_mview_f* msv_f(vsip_mview_f *B,vsip_mview_f *BS, vsip_index i,vsip_index j) { vsip_mattr_f attr; vsip_mgetattrib_f(B,&attr); attr.row_length -= j; attr.col_length -= i; attr.offset += j * attr.row_stride + i * attr.col_stride; vsip_mputattrib_f(BS,&attr); return BS; }
static vsip_mview_f* imsv_f( vsip_mview_f *B, vsip_mview_f *BS, vsip_index i1,vsip_index j1, vsip_index i2, vsip_index j2) { vsip_mattr_f attr; vsip_mgetattrib_f(B,&attr); if(j1 == 0) j1 =attr.col_length; if(j2 == 0) j2 =attr.row_length; attr.col_length = (j1 - i1); attr.row_length = (j2 - i2); attr.offset += i2 * attr.row_stride + i1 * attr.col_stride; vsip_mputattrib_f(BS,&attr); return BS; }
void VU_mprodqt_f( vsip_mview_f *C, vsip_mview_f *H, vsip_scalar_f *beta) { vsip_mattr_f attr_C,attr_C0; vsip_mattr_f attr_H0; vsip_vattr_f attr_h,attr_v0; vsip_vview_f *h = vsip_mcolview_f(H,0); vsip_length m,n; vsip_length j; vsip_stride k; vsip_vview_f *v, *w; vsip_mgetattrib_f(C,&attr_C); vsip_vgetattrib_f(h,&attr_h); vsip_mgetattrib_f(H,&attr_H0); attr_C0 = attr_C; m = attr_C.col_length; n = attr_C.row_length; v = vsip_vcreate_f(n,0); vsip_vgetattrib_f(v,&attr_v0); w = vsip_vcreate_f(m,0); vsip_vfill_f(0,v); for(k= attr_H0.row_length - 1; k >= 0; k--){ j = (vsip_length)k; attr_h.offset = j * attr_H0.row_stride + j * attr_H0.col_stride + attr_H0.offset; attr_h.length = attr_H0.col_length - j; vsip_vputlength_f(v,attr_h.length); vsip_vputoffset_f(v,n - attr_h.length); vsip_vputattrib_f(h,&attr_h); vsip_vcopy_f_f(h,v); vsip_vput_f(v,0,1); vsip_vputattrib_f(v,&attr_v0); VU_smvprod_f(-beta[j],C,v,w); VU_opu_f(C,w,v); } printf("here 2\n"); vsip_mputattrib_f(C,&attr_C0); vsip_vdestroy_f(h); vsip_valldestroy_f(v); vsip_valldestroy_f(w); return; }
void VU_qtprodm_f( vsip_mview_f *C, vsip_mview_f *H, vsip_scalar_f *beta) { vsip_mattr_f attr_C,attr_C0; vsip_mattr_f attr_H0; vsip_vattr_f attr_h,attr_v0; vsip_vview_f *h = vsip_mcolview_f(H,0); vsip_length m,n; vsip_length j; vsip_stride k; vsip_vview_f *v, *w; vsip_mgetattrib_f(C,&attr_C); vsip_vgetattrib_f(h,&attr_h); vsip_mgetattrib_f(H,&attr_H0); attr_C0 = attr_C; m = attr_C.col_length; n = attr_C.row_length; v = vsip_vcreate_f(m,0); vsip_vgetattrib_f(v,&attr_v0); w = vsip_vcreate_f(n,0); for(k= 0; k < attr_H0.row_length; k++){ j = (vsip_length)k; attr_h.offset = j * attr_H0.row_stride + j * attr_H0.col_stride + attr_H0.offset; attr_h.length = attr_H0.col_length -j; vsip_vputlength_f(v,attr_h.length); vsip_vputoffset_f(v,m - attr_h.length); vsip_vputattrib_f(h,&attr_h); vsip_vcopy_f_f(h,v); vsip_vput_f(v,0,1); vsip_vputattrib_f(v,&attr_v0); VU_svmprod_f(-beta[j],v,C,w); VU_opu_f(C,v,w); vsip_vput_f(v,k,0); } vsip_mputattrib_f(C,&attr_C0); vsip_vdestroy_f(h); vsip_valldestroy_f(v); vsip_valldestroy_f(w); return; }