/* $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;
}
示例#2
0
文件: svd_f.c 项目: rrjudd/jvsip
void svdFinalize_f(svdObj_f *s)
{
    vsip_vdestroy_f(s->ts);
    vsip_valldestroy_f(s->t);
    vsip_vdestroy_f(s->rs_one);
    vsip_vdestroy_f(s->rs_two);
    vsip_mdestroy_f(s->Rs);
    vsip_vdestroy_f(s->ls_one);
    vsip_vdestroy_f(s->ls_two);
    vsip_mdestroy_f(s->Ls);
    vsip_mdestroy_f(s->Bs);
    vsip_vdestroy_f(s->bs);
    vsip_malldestroy_f(s->B);
    vsip_malldestroy_f(s->R);
    vsip_malldestroy_f(s->L);
    vsip_valldestroy_vi(s->indx_L);
    vsip_valldestroy_vi(s->indx_R);
    vsip_vdestroy_f(s->ds);
    vsip_valldestroy_f(s->d);
    vsip_vdestroy_f(s->fs);
    vsip_valldestroy_f(s->f);
    s=NULL;
}