int main(void) { double *vect1,*vect2,*vect3; wn_gpmake("general_free"); wn_make_vect(&vect1,LEN); wn_make_vect(&vect2,LEN); wn_make_vect(&vect3,LEN); wn_random_vect(vect1,LEN); wn_print_vect(vect1,LEN); wn_copy_vect(vect2,vect1,LEN); wn_print_vect(vect1,LEN); wn_random_vect(vect2,LEN); printf("v1.v2 = %lf\n",wn_dot_vects(vect1,vect2,LEN)); printf("v1.v1 = %lf\n",wn_dot_vects(vect1,vect1,LEN)); printf("norm2(v1) = %lf\n",wn_norm2_vect(vect1,LEN)); printf("norm(v1) = %lf\n",wn_norm_vect(vect1,LEN)); printf("corr(v1,v2)) = %lf\n", wn_dot_vects(vect1,vect2,LEN)/ (wn_norm_vect(vect1,LEN)*wn_norm_vect(vect2,LEN))); wn_free_vect(vect1,LEN); wn_gpfree(); return(0); }
void wn_free_mat(double **mat,int len_i,int len_j) { int i; for(i=0;i<len_i;i++) { wn_free_vect(mat[i],len_j); } wn_free(mat); }