/* $Id: example16.c,v 2.0 2003/02/22 15:27:32 judd Exp $ */ #include<vsip.h> #define L 20 /* A length*/ int main(){vsip_init((void*)0); { vsip_vview_f* a = vsip_vcreate_f(L,0); vsip_vview_f* b = vsip_vcreate_f(L,0); vsip_vview_vi* ab_vi = vsip_vcreate_vi(L,0); vsip_vview_bl* ab_bl= vsip_vcreate_bl(L,0); int i; vsip_length N; /* make up some data */ vsip_vramp_f(0,2 * M_PI/(L-1),a); vsip_vcos_f(a,b); /* find out where b is greater than zero */ vsip_vfill_f(0,a); vsip_vlgt_f(b,a,ab_bl); /* find the index where b is greater than zero */ if((N = vsip_vindexbool(ab_bl,ab_vi))){ /* make a vector of those points where b is greater than zero*/ vsip_vgather_f(b,ab_vi,vsip_vputlength_f(a,N)); /*print out the results */ printf("Index Value\n"); for(i=0; i<N; i++) printf("%li %6.3f\n", vsip_vget_vi(ab_vi,i), vsip_vget_f(a,i)); } else{ printf("Zero Length Index"); } vsip_valldestroy_f(a); vsip_valldestroy_f(b); vsip_valldestroy_vi(ab_vi); vsip_valldestroy_bl(ab_bl); } vsip_finalize((void*)0); return 0; }
vsip_mview_f* VU_I_f(vsip_length M) { vsip_mview_f *I = vsip_mcreate_f(M,M,VSIP_ROW,VSIP_MEM_NONE); if(I != NULL){ vsip_vview_f *row = vsip_mrowview_f(I,0); if(row != NULL){ vsip_vputlength_f(row,(vsip_length)(M * M)); vsip_vfill_f((vsip_scalar_f)0.0,row); vsip_vputlength_f(row,M); vsip_vputstride_f(row,(vsip_stride) (M + 1)); vsip_vfill_f((vsip_scalar_f)1.0,row); vsip_vdestroy_f(row); } else { vsip_mdestroy_f(I); return (vsip_mview_f*) NULL; } } else { return (vsip_mview_f*) NULL; } return I; }
static vsip_mview_f* meye_f(vsip_length n) { vsip_vview_f *d = (vsip_vview_f*) NULL; vsip_mview_f *retval = (vsip_mview_f*)NULL; retval = vsip_mcreate_f(n,n,VSIP_ROW,VSIP_MEM_NONE); if(retval) d = vsip_mdiagview_f(retval,0); if(d){ vsip_mfill_f(0.0,retval); vsip_vfill_f(1.0,d); vsip_vdestroy_f(d); } else { vsip_malldestroy_f(retval); retval = (vsip_mview_f*) NULL; } return retval; }
int VU_vfrdB_f(vsip_vview_f *a,vsip_scalar_f range) { int ret = 0; vsip_length N_len=vsip_vgetlength_f(a); vsip_cvview_f *ca=vsip_cvcreate_f(N_len,VSIP_MEM_NONE); vsip_fft_f *fft = vsip_ccfftip_create_f( N_len,1,VSIP_FFT_FWD,0,0); vsip_vview_f *ra = vsip_vrealview_f(ca), *ia = vsip_vimagview_f(ca), *ta = vsip_vcloneview_f(a); vsip_offset s = (vsip_offset)vsip_vgetstride_f(ta); if((ca == NULL) || (fft == NULL) || (ra == NULL) || (ia == NULL) || (ta == NULL)){ret = 1; }else{ vsip_vfill_f(0,ia); vsip_vcopy_f_f(a,ra); vsip_ccfftip_f(fft,ca); vsip_vcmagsq_f(ca,ra); { vsip_index ind;/* scale by "range" min to max*/ vsip_scalar_f max = vsip_vmaxval_f(ra,&ind); vsip_scalar_f min = max * range; vsip_vclip_f(ra,min,max,min,max,ra); } if(N_len%2){vsip_length Nlen = N_len/2; vsip_vputlength_f(ta,Nlen+1); vsip_vputlength_f(ra,Nlen+1); vsip_vputoffset_f(ta,Nlen * s); vsip_vcopy_f_f(ra,ta); vsip_vputlength_f(ra,Nlen); vsip_vputlength_f(ta,Nlen); vsip_vputoffset_f(ta,vsip_vgetoffset_f(a)); vsip_vputoffset_f(ra,Nlen+1); vsip_vcopy_f_f(ra,ta); }else{vsip_length Nlen = N_len/2; vsip_vcopy_f_f(ra,ta); vsip_vputlength_f(ta,Nlen); vsip_vputlength_f(a,Nlen); vsip_vputoffset_f(ta,(vsip_offset)(Nlen) * s); vsip_vswap_f(ta,a); vsip_vputlength_f(a,N_len); }vsip_vlog10_f(a,a);vsip_svmul_f(10,a,a); }vsip_fft_destroy_f(fft); vsip_vdestroy_f(ra); vsip_vdestroy_f(ia); vsip_cvalldestroy_f(ca);vsip_vdestroy_f(ta); return ret; }
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; }
int main() { vsip_init((void*)0);{ vsip_mview_f *A = vsip_mcreate_f(NN,NN,VSIP_ROW,VSIP_MEM_NONE); vsip_mview_f *B = vsip_mcreate_f(NN,2,VSIP_COL,VSIP_MEM_NONE); struct tms t_buf; clock_t tclicks; vsip_lu_f *lud = vsip_lud_create_f(NN); printf("data fill in times 1 %lu\n",times(&t_buf)); { int i; vsip_vview_f *r = vsip_mrowview_f(A,0); vsip_offset o = vsip_vgetoffset_f(r); vsip_stride s = vsip_mgetcolstride_f(A); for(i=0; i<NN; i++){ vsip_vputoffset_f(r,o); vsip_vramp_f(i,1,r); o += s; } vsip_vdestroy_f(r); } { vsip_vview_f *r = vsip_mdiagview_f(A,0); vsip_vfill_f(0,r); vsip_vdestroy_f(r); } { vsip_vview_f *r = vsip_mcolview_f(B,0); vsip_vramp_f(1,.01,r); vsip_vdestroy_f(r); r = vsip_mcolview_f(B,1); vsip_vramp_f(2,.01,r); vsip_vdestroy_f(r); } /* printf("A = "); VU_mprintm_f("7.4",A); */ /* printf("B = "); VU_mprintm_f("7.4",B); */ printf("lud in times 2 %lu\n",(tclicks = times(&t_buf))); vsip_lud_f(lud,A); printf("lud out times 3 %lu\n",times(&t_buf) - tclicks); /* printf("Adec = "); VU_mprintm_f("7.4",A); */ printf("lusol in times 4 %lu\n",(tclicks = times(&t_buf))); vsip_lusol_f(lud,VSIP_MAT_NTRANS,B); printf("lusol out times 5 %lu\n",times(&t_buf) - tclicks); /* printf("B = "); VU_mprintm_f("7.4",B); */ } vsip_finalize((void*)0);return 0; }
int main(){vsip_init((void*)0); { int i,j; /* counters */ vsip_vview_f *windowt = vsip_vcreate_hanning_f(Ns,0); vsip_vview_f *windowp = vsip_vcreate_hanning_f(Mp,0); vsip_vview_f *kernel = vsip_vcreate_kaiser_f(Nfilter,kaiser,0); vsip_fir_f *fir = vsip_fir_create_f(kernel, VSIP_NONSYM,2 * Nn,2,VSIP_STATE_SAVE,0,0); vsip_vview_f *t =vsip_vcreate_f(Ns,0); /*time vector*/ vsip_vview_f *noise[Nnoise]; vsip_vview_f *nv = vsip_vcreate_f(2 * Nn,0); vsip_vview_f *tt = vsip_vcreate_f(Ns,0); vsip_mview_f *data = vsip_mcreate_f(Mp,Ns,VSIP_ROW,0), *rmview; vsip_vview_f *data_v, *gram_v; vsip_cvview_f *gram_data_v; vsip_cmview_f *gram_data = vsip_cmcreate_f(Mp,Ns/2 + 1,VSIP_COL,0); vsip_mview_f *gram = vsip_mcreate_f(Mp,Ns/2 + 1,VSIP_ROW,0); vsip_mview_f *Xim = vsip_mcreate_f(Mp,Mp+1,VSIP_ROW,0); vsip_scalar_f alpha = (D * Fs) / c; vsip_vview_f *m = vsip_vcreate_f(Mp,0); vsip_vview_f *Xi = vsip_vcreate_f(Mp + 1,0); vsip_randstate *state = vsip_randcreate(15,1,1,VSIP_PRNG); vsip_scalar_f w0 = 2 * M_PI * F0/Fs; vsip_scalar_f w1 = 2 * M_PI * F1/Fs; vsip_scalar_f w2 = 2 * M_PI * F2/Fs; vsip_scalar_f w3 = 2 * M_PI * F3/Fs; vsip_scalar_f cnst1 = M_PI/Nnoise; vsip_offset offset0 = (vsip_offset)(alpha * Mp + 1); vsip_fftm_f *rcfftmop_obj = /* time fft */ vsip_rcfftmop_create_f(Mp,Ns,1,VSIP_ROW,0,0); vsip_fftm_f *ccfftmip_obj = vsip_ccfftmip_create_f(Mp,Ns/2 + 1,VSIP_FFT_FWD,1,VSIP_COL,0,0); vsip_vramp_f(0,1,m); vsip_vramp_f(0,M_PI/Mp,Xi); vsip_vcos_f(Xi,Xi); vsip_vouter_f(alpha,m,Xi,Xim); { vsip_vview_f *gram_v = vsip_mrowview_f(gram,0); vsip_vputlength_f(gram_v,Mp*(Ns/2 + 1)); vsip_vfill_f(0,gram_v); vsip_vdestroy_f(gram_v); } for(j=0; j<Nnoise; j++){ noise[j] = vsip_vcreate_f(Nn,0); vsip_vrandn_f(state,nv); vsip_firflt_f(fir,nv,noise[j]); vsip_svmul_f(12.0/(Nnoise),noise[j],noise[j]); vsip_vputlength_f(noise[j],Ns); } vsip_vramp_f(0,1.0,t); /* time vector */ for(i=0; i<Mp; i++){ vsip_scalar_f Xim_val = vsip_mget_f(Xim,i,Theta_o); data_v = vsip_mrowview_f(data,i); vsip_vsmsa_f(t,w0,-w0 * Xim_val,tt); vsip_vcos_f(tt,data_v); /*F0 time series */ vsip_vsmsa_f(t,w1,-w1 * Xim_val,tt); vsip_vcos_f(tt,tt); /*F1 time series */ vsip_vadd_f(tt,data_v,data_v); vsip_vsmsa_f(t,w2,-w2 * Xim_val,tt); vsip_vcos_f(tt,tt); /*F2 time series */ vsip_vadd_f(tt,data_v,data_v); vsip_vsmsa_f(t,w3,-w3 * Xim_val,tt); vsip_vcos_f(tt,tt); /*F3 time series */ vsip_svmul_f(3.0,tt,tt); /* scale by 3.0 */ vsip_vadd_f(tt,data_v,data_v); vsip_svmul_f(3,data_v,data_v); for(j=0; j<Nnoise; j++){ /* simple time delay beam forming for noise */ vsip_vputoffset_f(noise[j],offset0 + (int)( i * alpha * cos(j * cnst1))); vsip_vadd_f(noise[j],data_v,data_v); } /* need to destroy before going on to next phone */ vsip_vdestroy_f(data_v); } /* window the data and the array to reduce sidelobes */ vsip_vmmul_f(windowt,data,VSIP_ROW,data); vsip_vmmul_f(windowp,data,VSIP_COL,data); /* do ffts */ vsip_rcfftmop_f(rcfftmop_obj,data,gram_data); vsip_ccfftmip_f(ccfftmip_obj,gram_data); { /* scale gram to db, min 0 max 255 */ vsip_index ind; gram_v = vsip_mrowview_f(gram,0); gram_data_v = vsip_cmcolview_f(gram_data,0); rmview = vsip_mrealview_f(gram_data); vsip_vputlength_f(gram_v,Mp*(Ns/2 + 1)); vsip_cvputlength_f(gram_data_v,Mp*(Ns/2 + 1)); data_v = vsip_vrealview_f(gram_data_v); vsip_vcmagsq_f(gram_data_v,data_v); vsip_mcopy_f_f(rmview,gram); vsip_vdestroy_f(data_v); vsip_svadd_f(1.0 - vsip_vminval_f(gram_v,&ind),gram_v,gram_v); vsip_vlog10_f(gram_v,gram_v); vsip_svmul_f(256.0 / vsip_vmaxval_f(gram_v,&ind), gram_v,gram_v);/* scale */ /* reorganize the data to place zero in the center for direction space */ data_v = vsip_vcloneview_f(gram_v); vsip_vputlength_f(data_v,(Mp/2) * (Ns/2 + 1)); vsip_vputoffset_f(data_v,(Mp/2) * (Ns/2 + 1)); vsip_vputlength_f(gram_v,(Mp/2) * (Ns/2 + 1)); vsip_vswap_f(data_v,gram_v); vsip_vdestroy_f(gram_v); vsip_vdestroy_f(data_v); vsip_cvdestroy_f(gram_data_v); vsip_mdestroy_f(rmview); } VU_mprintgram_f(gram,"gram_output"); } vsip_finalize((void*)0); return 0; }
int main () { vsip_init((void*)0); { vsip_vview_f *kernel = vsip_vcreate_kaiser_f(128,15.0,VSIP_MEM_NONE); vsip_randstate *r_state = vsip_randcreate(11,1,1,VSIP_NPRNG); vsip_conv1d_f *conv; vsip_fir_f *fir; vsip_vview_f *data = vsip_vcreate_f( 2 * N_data,VSIP_MEM_NONE), *noise = vsip_vcreate_f( 3 * N_data,VSIP_MEM_NONE), *avg = vsip_vcreate_f( 4 * N_data,VSIP_MEM_NONE); int i; vsip_length N_len; vsip_vputlength_f(data, (vsip_length)((N_data-1)/dec1)+1); vsip_vputlength_f(avg, (vsip_length)((N_data-1)/dec1)+1); vsip_vputstride_f(data,2); vsip_vputstride_f(avg,4); vsip_vputlength_f(noise,N_data); vsip_vputstride_f(noise,3); conv = vsip_conv1d_create_f( kernel,VSIP_NONSYM, N_data,dec1,VSIP_SUPPORT_SAME,0,0); fir = vsip_fir_create_f( kernel,VSIP_NONSYM, N_data,dec1,VSIP_STATE_NO_SAVE,0,0); vsip_vfill_f(0,avg); for(i=0; i<10; i++){ vsip_vrandn_f(r_state,noise); vsip_convolve1d_f(conv,noise,data); VU_vfrdB_f(data,1e-13); vsip_vsma_f(data,0.1,avg,avg); } N_len = vsip_vgetlength_f(avg); { vsip_vview_f *x = vsip_vcreate_f( N_len,VSIP_MEM_NONE); vsip_vramp_f(-.5,1.0/(vsip_scalar_f)(N_len-1),x); VU_vfprintxyg_f("%8.6f %8.6f\n",x,avg,"conv_dec1"); vsip_vdestroy_f(x); } vsip_vfill_f(0,avg); for(i=0; i<10; i++){ vsip_vrandn_f(r_state,noise); vsip_firflt_f(fir,noise,data); VU_vfrdB_f(data,1e-13); vsip_vsma_f(data,0.1,avg,avg); } N_len = vsip_vgetlength_f(avg); { vsip_vview_f *x = vsip_vcreate_f( N_len,VSIP_MEM_NONE); vsip_vramp_f(-.5,1.0/(vsip_scalar_f)(N_len-1),x); VU_vfprintxyg_f("%8.6f %8.6f\n",x,avg,"fir_dec1"); vsip_vdestroy_f(x); } vsip_conv1d_destroy_f(conv); vsip_fir_destroy_f(fir); conv = vsip_conv1d_create_f( kernel,VSIP_NONSYM, N_data,dec3,VSIP_SUPPORT_SAME,0,0); fir = vsip_fir_create_f( kernel,VSIP_NONSYM, N_data,dec3,VSIP_STATE_NO_SAVE,0,0); vsip_vputlength_f(data, (vsip_length)((N_data-1)/dec3)+1); vsip_vputlength_f(avg, (vsip_length)((N_data-1)/dec3)+1); vsip_vfill_f(0,avg); for(i=0; i<10; i++){ vsip_vrandn_f(r_state,noise); vsip_convolve1d_f(conv,noise,data); VU_vfrdB_f(data,1e-13); vsip_vsma_f(data,0.1,avg,avg); } N_len = vsip_vgetlength_f(avg); { vsip_vview_f *x = vsip_vcreate_f( N_len,VSIP_MEM_NONE); vsip_vramp_f(-.5,1.0/(vsip_scalar_f)(N_len - 1),x); VU_vfprintxyg_f("%8.6f %8.6f\n", x, avg,"conv_dec3"); vsip_vdestroy_f(x); } vsip_vfill_f(0,avg); for(i=0; i<10; i++){ vsip_vrandn_f(r_state,noise); vsip_firflt_f(fir,noise,data); VU_vfrdB_f(data,1e-13); vsip_vsma_f(data,0.1,avg,avg); } N_len = vsip_vgetlength_f(avg); { vsip_vview_f *x = vsip_vcreate_f( N_len,VSIP_MEM_NONE); vsip_vramp_f(-.5,1.0/(vsip_scalar_f)(N_len-1),x); VU_vfprintxyg_f("%8.6f %8.6f\n", x, avg,"fir_dec3"); vsip_vdestroy_f(x); } N_len = vsip_vgetlength_f(kernel); { vsip_vview_f *x = vsip_vcreate_f( N_len,VSIP_MEM_NONE); vsip_vramp_f(0,1,x); VU_vfprintxyg_f("%8.6f %8.6f\n", x,kernel,"kaiser_window"); vsip_vramp_f(-.5,1.0/(vsip_scalar_f)(N_len-1),x); VU_vfrdB_f(kernel,1e-20); VU_vfprintxyg_f("%8.6f %8.6f\n", x,kernel,"Freq_Resp_Kaiser"); vsip_vdestroy_f(x); } vsip_randdestroy(r_state); vsip_valldestroy_f(kernel); vsip_conv1d_destroy_f(conv);vsip_fir_destroy_f(fir); vsip_valldestroy_f(data); vsip_valldestroy_f(noise); vsip_valldestroy_f(avg); } vsip_finalize((void*)0); return 0; }/*end of main program *******************************/
int main(){ int init = vsip_init((void*)0); int i,j, cholsol_retval,chold_retval; double t0 = VU_ansi_c_clock(); /* for doing some timeing */ vsip_cscalar_f czero = vsip_cmplx_f((vsip_scalar_f)0.0,(vsip_scalar_f)0.0); vsip_cmview_f *A = vsip_cmcreate_f(N,N,VSIP_COL,0); vsip_cmview_f *RU = vsip_cmcreate_f(N,N,VSIP_COL,0); vsip_cmview_f *RL = vsip_cmcreate_f(N,N,VSIP_COL,0); vsip_cmview_f *XB = vsip_cmcreate_f(N,M,VSIP_ROW,0); vsip_cchol_f* chol = vsip_cchold_create_f(UPORLO,N); /* NOTE: UPORLO macro above main() */ /* to make sure we have a valid Positive Symetric define */ /* an upper triangular (RU) with positive pivots and */ /* zero below the main diagonal. */ /* Then initialize RL with hermitian of RU */ /* finally create A as the matrix product of RL and RU */ /* Initialise matrix RU */ /* time this */ t0 = VU_ansi_c_clock(); for (i=0; i<N; i++){ for(j = i; j < N; j++){ #ifdef OBNOXIOUS /* make up some reasonably obnoxious data */ vsip_scalar_f a = cos(1.5/((j+1)*(i+1)))+sqrt(i*j); vsip_scalar_f b = (i + j + 1) * cos(M_PI * a); #else /* the above was to obnoxious for bigger than about N = 10 */ /* the following works for N > 100 */ vsip_scalar_f a = 1; vsip_scalar_f b = 1; #endif if(i == j) /* fill diagonal */ vsip_cmput_f(RU,i,j, vsip_cmplx_f(sqrt(N) + sqrt(i),0)); else { /* fill off diagonal */ vsip_cmput_f(RU,i,j,vsip_cmplx_f(b,a)); vsip_cmput_f(RU,j,i,czero); } } } /* initialize RL */ vsip_cmherm_f(RU,RL); #ifdef PRINT VU_cmprintm_f("7.4",RU); VU_cmprintm_f("7.4",RL); #endif printf("Matrix initialize for RU and RL = %f seconds\n",VU_ansi_c_clock() - t0); /* initialize A */ /* this step will take a long time so time it */ t0 = VU_ansi_c_clock(); vsip_cmprod_f(RL,RU,A); #ifdef OBNOXIOUS for(i=0; i<N; i++){ vsip_cvview_f *aview = vsip_cmrowview_f(A,i); vsip_cvrsdiv_f(aview,vsip_cmag_f(vsip_cvmeanval_f(aview)),aview); vsip_cvdestroy_f(aview); } #endif printf("Matrix multiply for initialization of A = %f seconds\n",VU_ansi_c_clock() - t0); /* print A */ /* we only want to do this if A is something reasonable to print */ /* selected as an option in the make file */ #ifdef PRINT printf("Matrix A =\n"); VU_cmprintm_f("4.2",A); fflush(stdout); #endif /* initialise rhs */ /* start out with XB = {1,2,3,...,M} */ /* calculate what B must be using A */ /* then solve to see if we get XB back */ { vsip_index i; vsip_vview_f *y = vsip_vcreate_f(vsip_cmgetcollength_f(A),VSIP_MEM_NONE); vsip_vview_f *x_r,*x_i; vsip_cvview_f *x; vsip_mview_f *A_r = vsip_mrealview_f(A), *A_i = vsip_mimagview_f(A); /* time this */ t0 = VU_ansi_c_clock(); for(i=0; i<M; i++){ vsip_vfill_f((vsip_scalar_f)i+1.0,y); x = vsip_cmcolview_f(XB,i); x_r = vsip_vrealview_f(x); x_i = vsip_vimagview_f(x); vsip_mvprod_f(A_r,y,x_r); vsip_mvprod_f(A_i,y,x_i); vsip_cvdestroy_f(x); vsip_vdestroy_f(x_r); vsip_vdestroy_f(x_i); } vsip_mdestroy_f(A_r); vsip_mdestroy_f(A_i); printf("Matrix init for B = %f seconds\n",VU_ansi_c_clock() - t0); } /* print XB */ /* we only want to do this if XB is something reasonable to print */ /* selected as an option in the make file */ #ifdef PRINT printf("Matrix B = \n"); VU_cmprintm_f("7.4",XB); fflush(stdout); #endif if(chol != NULL){ t0 = VU_ansi_c_clock(); /* we want to time the decomposition */ chold_retval = vsip_cchold_f(chol,A); printf("time decomp %f\n",VU_ansi_c_clock() - t0); printf("decompostion returns %d\n",chold_retval); /* now do the solution */ t0 = VU_ansi_c_clock(); /* we want to time the solution */ cholsol_retval=vsip_ccholsol_f(chol,XB); printf("time solution %f\n",VU_ansi_c_clock() - t0); printf("cholsol returns %d\n",cholsol_retval); /* print XB */ /* we only want to do this if XB is something reasonable to print */ /* selected as an option in the make file; otherwise */ /* we print a single row of XB if the matrix is to large since */ /* M is usally reasonable. Printed as a column vector */ #ifdef PRINT printf("Matrix X = \n"); VU_cmprintm_f("7.4",XB); fflush(stdout); #else { /* pick a row in the middle */ vsip_cvview_f *x = vsip_cmrowview_f(XB,N/2); printf("This output sould be 1,2,...,M\n"); VU_cvprintm_f("7.4",x); fflush(stdout); vsip_cvdestroy_f(x); } #endif } else { printf("failed to create cholesky object \n"); } vsip_cmalldestroy_f(XB); vsip_cmalldestroy_f(A); vsip_cmalldestroy_f(RL); vsip_cmalldestroy_f(RU); vsip_cchold_destroy_f(chol); vsip_finalize((void*)0); return 1; }