您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vcalloc函数代码示例

51自学网 2021-06-03 09:35:01
  C++
这篇教程C++ vcalloc函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中vcalloc函数的典型用法代码示例。如果您正苦于以下问题:C++ vcalloc函数的具体用法?C++ vcalloc怎么用?C++ vcalloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了vcalloc函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: declare_sequence

Sequence * declare_sequence ( int min, int max, int nseq)    {    Sequence *LS;    LS=vcalloc (1, sizeof ( Sequence));    LS->seq_comment=declare_char ( nseq,COMMENT_SIZE);    LS->aln_comment=declare_char ( nseq,COMMENT_SIZE);    LS->file=declare_char( nseq,STRING+1);    LS->seq=declare_char ( nseq, max+1);    LS->name=declare_char( nseq,MAXNAMES+1);    LS->len=vcalloc ( nseq, sizeof (int));    LS->max_len=max;    LS->min_len=min;    LS->nseq=nseq;    LS->max_nseq=nseq;    LS->type=vcalloc(30, sizeof (char));    LS->T=declare_arrayN(2, sizeof (Template), nseq, 1);    LS->dc=declare_int (nseq, 2);    return LS;    }
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:27,


示例2: compute_oligomer_distance_tree

voidcompute_oligomer_distance_tree(char *seq_file_name, int* char2value, char *tree_file_name, int max_dist, int word_length, int alphabet_size){	int i;	int *compare =(int*) vcalloc(1,sizeof(int));	int *num_seq =(int*) vcalloc(1,sizeof(int));	int num_features = (int)pow(alphabet_size,word_length);		num_features *= num_features * (max_dist+1);	Cluster_info *matrix  = feature_extract(seq_file_name, max_dist, word_length, char2value, alphabet_size, compare, num_seq, num_features);		int *node =(int*) vcalloc(1, sizeof(int));	*node = *num_seq;		FILE *tree_f = fopen(tree_file_name,"w");	double *mean = (double*)vcalloc(num_features, sizeof(double));	double *variance =  (double*)vcalloc(num_features, sizeof(double));	cluster_recursive(0, *num_seq-1, matrix, num_features, mean, variance, compare, tree_f, node);		for (i = 0; i < *num_seq; ++i)	{// 		printf("ERG: %i/n", i);		vfree(matrix[i].features);	}	vfree(matrix);	fclose (tree_f);	vfree(mean);	vfree(variance);	vfree(compare);	vfree(node);	vfree(num_seq);}
开发者ID:B-Rich,项目名称:tcoffee,代码行数:35,


示例3: declare_char_node

Char_node * declare_char_node (int action){static struct Char_node **heap;static int heap_size, free_heap, a;static int key;   if ( action==DECLARE)    {      if ( free_heap==0)	{	  free_heap=100;	  	  heap=vrealloc (heap,(heap_size+free_heap)*sizeof (struct Char_node *));	  for ( a=heap_size; a<heap_size+free_heap; a++)	    {	      (heap[a])=vcalloc ( 1, sizeof ( struct Char_node));	      (heap[a])->c=vcalloc ( 256, sizeof (Char_node*));	      (heap[a])->key=key++;	    }	  heap_size+=free_heap;	}      return heap[heap_size-(free_heap--)];    }  else if ( action==FREE_STACK)    {      for (a=0; a< heap_size; a++)	{	  heap[a]->key=key++;	  vfree ( heap[a]->c);	  (heap[a])->c=vcalloc ( 256, sizeof (Char_node*));	}      free_heap=heap_size;      return NULL;    }  return NULL;}
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:35,


示例4: commonsextet

/*** calculates the number of common tuples*/int commonsextet( int *table, int *pointt ){	int value = 0;	int tmp;	int point;	static int *memo = NULL;	static int *ct = NULL;	static int *cp;	if( !memo )	{		memo =(int*) vcalloc( tsize+1, sizeof( int ) );		ct =(int*) vcalloc( tsize+1, sizeof( int ) );	}	cp = ct;	while( ( point = *pointt++ ) != END_ARRAY )	{	  tmp = memo[point]++;	  if( tmp < table[point] )	    value++;	  if( tmp == 0 )	    {	      *cp++ = point;	    }	}	*cp = END_ARRAY;	cp =  ct;	while( *cp != END_ARRAY )		memo[*cp++] = 0;	return( value );}
开发者ID:cbcrg,项目名称:tcoffee,代码行数:37,


示例5: allocate_ktup_hasch_data

struct Hasch_data * allocate_ktup_hasch_data (struct Hasch_data *e, int action){  static struct Hasch_data **heap;  static int heap_size, free_heap, a;  if ( action == 100)    {      fprintf ( stderr, "/nHeap size: %d, Free Heap: %d", heap_size, free_heap);      return NULL;    }  else if ( action==DECLARE)    {      if ( free_heap==0)	{	  free_heap=100;	  heap_size+=free_heap;	  heap=(Hasch_data**)vrealloc (heap,heap_size*sizeof (struct Hasch_entry *));	  for ( a=0; a<free_heap; a++)	    {	      (heap[a])=(Hasch_data*)vcalloc ( 1, sizeof ( struct Hasch_entry *));	      (heap[a])->list=(int*)vcalloc ( 10, sizeof (int));	      (heap[a])->list[0]=10;	    }	}      return heap[--free_heap];    }  else if ( action==FREE)    {      heap[free_heap++]=e;      e->list[1]=0;      return NULL;    }  return NULL;}
开发者ID:cbcrg,项目名称:tcoffee,代码行数:34,


示例6: extract_N_diag

int * extract_N_diag (int l1, int l2, int **sorted_diag, int n_chosen_diag)    {    int a, b, up, low,current_diag,n_diag;    int * slopes;    int *diag_list;    int window=0;            n_diag=l1+l2-1;        diag_list=vcalloc (l1+l2+1, sizeof (int));    slopes=vcalloc ( n_diag+1, sizeof (int));        for ( a=n_diag; a>0 && a>(n_diag-n_chosen_diag); a--)            {	    current_diag=sorted_diag[a][0];	    up=MAX(1,current_diag-window);	    low=MIN(n_diag, current_diag+window);	    for ( b=up; b<=low; b++)slopes[current_diag]=1;	    }        slopes[1]=1;    slopes[l1+l2-1]=1;    slopes[l2]=1;    for (a=0; a<= (l1+l2-1); a++)	if ( slopes[a]){diag_list[++diag_list[0]]=a;}    free (slopes);    return diag_list;    }
开发者ID:B-Rich,项目名称:tcoffee,代码行数:35,


示例7: flag_diagonals

int * flag_diagonals (int l1, int l2, int **sorted_diag, float T, int window)    {    int a, b, up, low,current_diag,n_diag;    int * slopes;    int *diag_list;    double mean;    double sd;    int use_z_score=1;    n_diag=l1+l2-1;    mean=return_mean_int ( sorted_diag, n_diag+1, 1);    sd  =return_sd_int ( sorted_diag, n_diag+1, 1, (int)mean);    if ( T==0)      {      use_z_score=1;      T=(((double)sorted_diag[n_diag][1]-mean)/sd)/25;      }    diag_list=(int*)vcalloc (l1+l2+1, sizeof (int));    slopes=(int*)vcalloc ( n_diag+1, sizeof (int));    for ( a=n_diag; a>0; a--)            {	    current_diag=sorted_diag[a][0];	    if ( !use_z_score && sorted_diag[a][1]>T)	       {		   up=MAX(1,current_diag-window);		   low=MIN(n_diag, current_diag+window);		   for ( b=up; b<=low; b++)slopes[b]=1;	       }	    else if (use_z_score && ((double)sorted_diag[a][1]-mean)/sd>T)	      {		up=MAX(1,current_diag-window);		low=MIN(n_diag, current_diag+window);		for ( b=up; b<=low; b++)slopes[b]=1;	      }	    else break;	    }    for ( a=1, b=0; a<=n_diag; a++)        {	    b+=slopes[a];	}    slopes[1]=1;    slopes[l1+l2-1]=1;    slopes[l2]=1;    for (a=0; a<= (l1+l2-1); a++)	if ( slopes[a]){diag_list[++diag_list[0]]=a;}    vfree (slopes);    return diag_list;    }
开发者ID:cbcrg,项目名称:tcoffee,代码行数:60,


示例8: vcalloc

Decoded_chromosome *get_mem_free_decoded_chrom ( Parameter *PARAM)	{	int a;		if (PARAM->MEM==NULL)		{		PARAM->MEM= vcalloc ( 1, sizeof ( Mem));		(PARAM->MEM)->C_BUF=vcalloc ( 100, sizeof (Decoded_chromosome *));		}		 	for ( a=0; a< (PARAM->MEM)->NC; a++)		{		if ( ((PARAM->MEM)->C_BUF[a])->used==0)			{			((PARAM->MEM)->C_BUF[a])->used=1;			((PARAM->MEM)->C_BUF[a])->num=a;			return ((PARAM->MEM)->C_BUF[a]);			}		}			(PARAM->MEM)->C_BUF[(PARAM->MEM)->NC]=declare_decoded_chromosome (PARAM);	((PARAM->MEM)->C_BUF[(PARAM->MEM)->NC])->used=1;	((PARAM->MEM)->C_BUF[(PARAM->MEM)->NC])->num=(PARAM->MEM)->NC;	(PARAM->MEM)->NC++;	if ( (PARAM->MEM)->NC>=100)		{		printf ( "/nMEMORY LEAK: TOO MANY DEC CHROM ALLOCATED, FORCED EXIT");		fprintf ((PARAM->BGA)->FP_ERROR, "/nMEMORY LEAK: TOO MANY DEC CHROM ALLOCATED, FORCED EXIT");		crash ( "FORCED EXIT");		}			return ((PARAM->MEM)->C_BUF[(PARAM->MEM)->NC-1]);	}
开发者ID:B-Rich,项目名称:tcoffee,代码行数:32,


示例9: read_oligo_list

Oligo * read_oligo_list ( char *fname)    {    Oligo *O;    FILE *fp;    int a, b;            O=vcalloc (1, sizeof (Oligo));    O->ALPHABET=vcalloc ( 100, sizeof (char));    O->EALPHABET=vcalloc ( 100, sizeof (char));    O->AMBIGUITIES=vcalloc ( 100, sizeof (char));        fp=vfopen ( fname, "r");    fscanf ( fp, "ALPHABET %s/n", O->ALPHABET);    fscanf ( fp, "AMBIG_ALPHABET %s/n", O->AMBIGUITIES);    if ( O->AMBIGUITIES[0]=='@')O->AMBIGUITIES[0]='/0';    fscanf ( fp, "WORD_SIZE %d/n", &O->WSIZE);    fscanf ( fp, "NSEQ %d/n", &O->NSEQ);    fscanf ( fp, "LEN %d/n", &O->LEN);    fscanf ( fp, "SCORE %d", &a);    sprintf ( O->EALPHABET, "%s%s", O->ALPHABET, O->AMBIGUITIES);       O->seq=declare_char ( O->NSEQ, O->LEN+1);    for ( a=0; a< O->NSEQ; a++)	{	fscanf ( fp, "%*s/n%s/n",O->seq[a]);	}    vfclose (fp);    return O;    }
开发者ID:B-Rich,项目名称:tcoffee,代码行数:31,


示例10: declare_arrayN

void * declare_arrayN (int ndim, size_t size, ...){  va_list ap;  int *array;  void **p;  int a;  va_start (ap, size);  array=vcalloc (ndim, sizeof (int));  for ( a=0; a< ndim; a++)    {      array[a]=va_arg (ap,int);      if ( array[a]<0){va_end(ap);return NULL;}    }  va_end (ap);  if ( ndim==2)    {      p=vcalloc_nomemset (array[0], sizeof ( void*));      for (a=0; a< array[0]; a++)	p[a]=vcalloc (array[1], size);    }  else    {      p=declare_arrayN2 (ndim, array, size);    }  vfree (array);  return p;}
开发者ID:cbcrg,项目名称:mta-nf,代码行数:33,


示例11: sizeof

Alignment *declare_Alignment ( Sequence *S)	{	Alignment *LA;	int a;	/*ordre:	  [x][0]= which is the xth seq of aln	  [x][1]= how many deleted residues before the first one	*/	LA=vcalloc (1, sizeof ( Alignment));	aln_stack (LA, DECLARE_ALN);	if ( S==NULL)	    {	      LA->declared_len=MAX_LEN_ALN;	      LA->max_n_seq=MAX_N_SEQ;	    }	else	  {	    LA->declared_len=2*S->max_len+1;	    LA->max_n_seq=S->nseq+1;	  }	LA->S=S;	LA->seq_comment=declare_char (LA->max_n_seq, COMMENT_SIZE);	LA->aln_comment=declare_char (LA->max_n_seq, COMMENT_SIZE);	LA->seq_al=declare_char ( LA->max_n_seq,LA->declared_len );	LA->name=declare_char (LA->max_n_seq, MAXNAMES+1);	LA->file=declare_char (LA->max_n_seq, STRING);	LA->tree_order=declare_char (LA->max_n_seq, STRING);	LA->order= declare_int (LA->max_n_seq , 5);	//order[a][0]: sequence index in S	//order[a][1]: offset of the sequence	//order[a][2]: used by sw_gotoh_pair_wise	//order[a][3]: used by sw_gotoh_pair_wise	//order[a][4]: weight, -1	LA->score_seq= vcalloc (LA->max_n_seq, sizeof (int));	for ( a=0; a< LA->max_n_seq; a++)LA->order[a][0]=a;	LA->len_aln=0;	LA->score_aln=0;	LA->len=vcalloc (LA->max_n_seq, sizeof (int));	if (S && S->name)for ( a=0; a<S->nseq; a++)	  {	    sprintf ( LA->name[a], "%s", S->name[a]);	  }	return LA;	}
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:59,


示例12: read_dirichlet

Mixture * read_dirichlet ( char *name)	{	FILE *fp;	int a,b, c;	float f;		Mixture *D;	D=vcalloc ( 1, sizeof (Mixture));			D->N_COMPONENT=9;	D->ALPHA=vcalloc (9, sizeof (double*));	for ( a=0; a< 9; a++)		D->ALPHA[a]=vcalloc (20, sizeof (double));	D->DM_Q=vcalloc (9, sizeof (double));		if (name!=NULL)	  {	    fp=vfopen ( name, "r");	    for ( a=0; a< 9; a++)		{		fscanf(fp, "%f/n", &f);		D->DM_Q[a]=(double)f;		fscanf(fp, "%f", &f);				for ( b=0; b<20; b++)			{			fscanf(fp, "%f", &f);			D->ALPHA[a][b]=(double)f;			}		fscanf(fp, "/n");		}	    for ( a=0; a< 9; a++)	      {		fprintf(stderr, "/n%f/n",(float)D->DM_Q[a] );				for ( b=0; b<20; b++)		  {		    fprintf(stderr, "%f ", (float)D->ALPHA[a][b]);		  }		fprintf(stderr, "/n");	      }	    fprintf ( stderr, "/nN_C=%d",D->N_COMPONENT );		    vfclose ( fp);	  }	else	  {	    for (c=0, a=0; a< 9;a++)	      {		D->DM_Q[a]=dm[c++];			for (b=0; b<20; b++)		  D->ALPHA[a][b]=dm[c++];	      }	  }		return D;	}
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:58,


示例13: sprintf

int *code_seq (char *seq, char *type){  static int *code;  static int *aa, ng;  int a, b, l;  if (!aa)    {      char **gl;      if ( strm (type, "DNA") || strm (type, "RNA"))	{	  gl=declare_char (4,5);	  sprintf ( gl[ng++], "Aa");	  sprintf ( gl[ng++], "Gg");	  sprintf ( gl[ng++], "TtUu");	  sprintf ( gl[ng++], "Cc");	}      else	{	  gl=make_group_aa ( &ng, "mafft");	}      aa=(int*)vcalloc ( 256, sizeof (int));      for ( a=0; a<ng; a++)	{	  for ( b=0; b< strlen (gl[a]); b++)	    {	      aa[(int)gl[a][b]]=a;	    }	}      free_char (gl, -1);    }  l=strlen (seq);  if ( code) code--;  if ( !code || read_array_size (code, sizeof (int))<(l+2))    {      vfree (code);      code=(int*)vcalloc (l+2, sizeof (int));    }  code[0]=ng;  code++;  for (a=0; a<l; a++)    {      code[a]=aa[(int)seq[a]];    }  code[a]=END_ARRAY;  return code;}
开发者ID:cbcrg,项目名称:tcoffee,代码行数:54,


示例14: hasch_seq

int hasch_seq(char *seq, int **hs, int **lu,int ktup,char *alp)    {	static int a[10];	int i,j,l,limit,code,flag;	char residue;	int alp_lu[10000];	int alp_size;	alp_size=alp[0];	alp++;	for ( i=0; i< alp_size; i++)	    {	      alp_lu[(int)alp[i]]=i;	    }	l=strlen (seq);	limit = (int)   pow((double)(alp_size+1),(double)ktup);	hs[0]=(int*)vcalloc ( l+1,sizeof (int));	lu[0]=(int*)vcalloc ( limit+1, sizeof(int));	if ( l==0)myexit(EXIT_FAILURE);	for (i=1;i<=ktup;i++)           a[i] = (int) pow((double)(alp_size+1),(double)(i-1));	for(i=1;i<=(l-ktup+1);++i)	        {		code=0;		flag=FALSE;		for(j=1;j<=ktup;++j)		   {		   if (is_gap(seq[i+j-2])){flag=TRUE;break;}		   else residue=alp_lu[(int)seq[i+j-2]];		   code+=residue*a[j];		   }		if ( flag)continue;		++code;		if (lu[0][code])hs[0][i]=lu[0][code];		lu[0][code]=i;		}	return 0;    }
开发者ID:cbcrg,项目名称:tcoffee,代码行数:53,


示例15: declare_weights

Weights* declare_weights ( int nseq)	{	Weights *W;	W=vcalloc ( 1, sizeof ( Weights));	W->comments=vcalloc ( 1000, sizeof (char));	W->nseq=nseq;	W->mode=vcalloc (FILENAMELEN, sizeof (char));	W->seq_name= declare_char ( W->nseq*2, 200);	W->PW_SD=declare_float ( W->nseq, W->nseq);	W->PW_ID=declare_float ( W->nseq, W->nseq);	W->SEQ_W=vcalloc ( W->nseq, sizeof ( float));	return W;	}
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:14,


示例16: sizeof

Fname *declare_fname (int size){    Fname *F;    size+=1000+FILENAMELEN+1;    F=vcalloc ( 1, sizeof (Fname));    F->name = (char *) vcalloc(size, sizeof (char));    F->path = (char *) vcalloc(size, sizeof (char));    F->suffix= (char *) vcalloc(size, sizeof (char));    F->full= (char *) vcalloc(size, sizeof (char));        return F;}
开发者ID:cbcrg,项目名称:mta-nf,代码行数:14,


示例17: flag_diagonals

int * flag_diagonals (int l1, int l2, int **sorted_diag, float T)    {    int a, b, up, low,current_diag,n_diag;    int * slopes;    int *diag_list;    double mean;    double sd;    int window=0;            n_diag=l1+l2-1;    mean=return_mean_int ( sorted_diag, n_diag+1, 1);    sd  =return_sd_int ( sorted_diag, n_diag+1, 1, (int)mean);        if ( T==0)T=(((double)sorted_diag[n_diag][1]-mean)/sd)/10;        diag_list=vcalloc (l1+l2+1, sizeof (int));    slopes=vcalloc ( n_diag+1, sizeof (int));     for ( a=n_diag; a>0; a--)            {	    current_diag=sorted_diag[a][0];	    if (((double)sorted_diag[a][1]-mean)/sd>T)	       {		   up=MAX(1,current_diag-window);		   low=MIN(n_diag, current_diag+window);		   for ( b=up; b<=low; b++)slopes[b]=1;	       }	    else break;			    }    for ( a=1, b=0; a<=n_diag; a++)        {	    b+=slopes[a];	}/*    fprintf (stderr, "/nN_DIAG=%d [%.3f]/n]", b, (float)b/((float)n_diag));*/    slopes[1]=1;    slopes[l1+l2-1]=1;    slopes[l2]=1;    for (a=0; a<= (l1+l2-1); a++)	if ( slopes[a]){diag_list[++diag_list[0]]=a;}    free (slopes);        return diag_list;    }
开发者ID:B-Rich,项目名称:tcoffee,代码行数:49,


示例18: seq2hasch

SeqHasch * seq2hasch (int i,char *seq, int ktup, SeqHasch *H){  int a,b,l, n=0;  SeqHasch h;  if (!H)    {      H=(hseq**)vcalloc (2, sizeof (SeqHasch));      H[0]=(hseq*)vcalloc (1, sizeof (hseq));      n=1;    }  else    {      n=0;      while (H[++n]);    }  l=strlen (seq);  for (a=0; a<l-ktup; a++)    {      h=H[0];      for (b=a; b<a+ktup; b++)	{	  char r;	  r=seq[b];	  if (!h->hl[r])  h->hl[r]=(hseq*)vcalloc (1, sizeof (hseq));	  h=h->hl[r];	}      if (!h->l)	{	  h->n=2;	  h->l=(int*)vcalloc (2, sizeof (int));	  H=(hseq**)vrealloc (H,(n+2)*sizeof (SeqHasch));	  H[n]=h;	  n++;	}      else	{	  h->n+=2;	  h->l=(int*)vrealloc (h->l, (h->n)*sizeof (int));	}      h->l[h->n-2]=i;      h->l[h->n-1]=a;    }  return H;}
开发者ID:cbcrg,项目名称:tcoffee,代码行数:49,


示例19: ktup_pair_wise

int ktup_pair_wise (Alignment *A,int*ns, int **l_s,Constraint_list *CL)    {      static char **gl;      static int ng;      char *seq1;      char *seq2;      int min_len=10;      if ( !gl)	gl=make_group_aa (&ng, "vasiliky");      if ( ns[0]>1)seq1=sub_aln2cons_seq_mat (A, ns[0], l_s[0],"blosum62mt");      else	{	  seq1=(char*)vcalloc ( strlen (A->seq_al[l_s[0][0]])+1, sizeof (char));	  sprintf ( seq1, "%s",A->seq_al[l_s[0][0]]);	}      if ( ns[1]>1)seq2=sub_aln2cons_seq_mat (A, ns[1], l_s[1],"blosum62mt");      else	{	  seq2=(char*)vcalloc ( strlen (A->seq_al[l_s[1][0]])+1, sizeof (char));	  sprintf ( seq2, "%s",A->seq_al[l_s[1][0]]);	}      if ( strlen (seq1)<min_len || strlen (seq2)<min_len)	{	  Alignment *B;	  ungap(seq1); ungap(seq2);	  B=align_two_sequences ( seq1, seq2, "blosum62mt",-10, -1, "myers_miller_pair_wise");	  A->score=A->score_aln=aln2sim(B, "idmat");	  free_aln (B);	  return A->score;	}      else	{	  string_convert (seq1, ng, gl);	  string_convert (seq2, ng, gl);	  A->score=A->score_aln=ktup_comparison (seq1,seq2, CL->ktup);	}      vfree (seq1); vfree (seq2);      return A->score;    }
开发者ID:cbcrg,项目名称:tcoffee,代码行数:49,


示例20: duplicate_TC_param

TC_param * duplicate_TC_param ( TC_param*B){  TC_param *N;  N=vcalloc (1, sizeof ( TC_param));  memcpy(B, N, sizeof(TC_param));  return N;  }
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:7,


示例21: makepointtable

int * makepointtable( int *pointt, int *n, int ktup ){  int point, a, ng;  register int *p;  static int *prod;  ng=n[-1];  if (!prod)    {      prod=(int*)vcalloc ( ktup, sizeof (int));      for ( a=0; a<ktup; a++)	{	  prod[ktup-a-1]=(int)pow(n[-1],a);	}    }  p = n;  for (point=0,a=0; a<ktup; a++)    {      point+= *n++ *prod[a];    }  *pointt++ = point;  while( *n != END_ARRAY )    {      point -= *p++ * prod[0];      point *= ng;      point += *n++;      *pointt++ = point;    }  *pointt = END_ARRAY;  return pointt;}
开发者ID:cbcrg,项目名称:tcoffee,代码行数:35,


示例22: weight_motif

int weight_motif ( char *motif)   {   int l,a;   static int *lu;   float tot=1;      if (!lu)      {      lu=vcalloc (100, sizeof (int));      lu['A'-'*']=1;      lu['G'-'*']=1;      lu['C'-'*']=1;      lu['T'-'*']=1;      lu['U'-'*']=1;      lu['I'-'*']=2;      lu['Y'-'*']=2;      lu['*'-'*']=4;      }   l=strlen (motif);   for ( a=0; a< l; a++)       {       tot=lu[motif[a]-'*']*tot;       }   tot=(1/tot)*100;      return ((int)tot==0)?1:(int)tot;   }
开发者ID:B-Rich,项目名称:tcoffee,代码行数:28,


示例23: hcreate

HaschT * hcreate ( int n_elements,struct Hasch_data * declare_data(struct Hasch_entry *), struct Hasch_data *free_data(struct Hasch_data *) )       {	 HaschT *T;	 int a;	 	 n_elements=n_elements*2+1;	 	 T=vcalloc ( 1, sizeof (HaschT));	 T->ne=n_elements;	 	 T->p=vcalloc (n_elements,sizeof ( Hasch_entry*));	 for ( a=0; a<n_elements; a++)	   {	     T->p[a]=allocate_hasch_entry(NULL,DECLARE,declare_data, free_data);	   }	 return T;       }
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:16,


示例24: extract_N_diag

int * extract_N_diag (int l1, int l2, int **sorted_diag, int n_chosen_diag, int window)    {    int a, b, up, low,current_diag,n_diag;    int * slopes;    int *diag_list;    n_diag=l1+l2-1;    diag_list=(int*)vcalloc (l1+l2+1, sizeof (int));    slopes=(int*)vcalloc ( n_diag+1, sizeof (int));    for ( a=n_diag; a>0 && a>(n_diag-n_chosen_diag); a--)            {	    current_diag=sorted_diag[a][0];	    up=MAX(1,current_diag-window);	    low=MIN(n_diag, current_diag+window);	    for ( b=up; b<=low; b++)slopes[b]=1;	    }    /*flag bottom right*/    up=MAX(1,1-window);low=MIN(n_diag,1+window);    for ( a=up; a<=low; a++) slopes[a]=1;    /*flag top left */    up=MAX(1,(l1+l2-1)-window);low=MIN(n_diag,(l1+l2-1)+window);    for ( a=up; a<=low; a++) slopes[a]=1;    /*flag MAIN DIAG SEQ1*/    up=MAX(1,l1-window);low=MIN(n_diag,l1+window);    for ( a=up; a<=low; a++) slopes[a]=1;    /*flag MAIN DIAG SEQ2*/    up=MAX(1,l2-window);low=MIN(n_diag,l2+window);    for ( a=up; a<=low; a++) slopes[a]=1;    for (a=0; a<= (l1+l2-1); a++)	if ( slopes[a]){diag_list[++diag_list[0]]=a;}    vfree (slopes);    return diag_list;    }
开发者ID:cbcrg,项目名称:tcoffee,代码行数:46,


示例25: declare_structure

Structure* declare_structure ( int n, char **array)    {    Structure *S;    int a;    S=vcalloc (1, sizeof (Structure));    S->n_fields=1;    S->nseq=n;    S->struc=vcalloc ( n, sizeof (int**));    S->len=vcalloc ( n, sizeof (int));    for ( a=0; a< n; a++)        {	S->len[a]=strlen(array[a]);	S->struc[a]=declare_int ( strlen ( array[a])+2, 1);	}    return S;    }
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:18,


示例26: ktup_comparison_hasch

int ktup_comparison_hasch ( char *i_seq1, char *i_seq2, const int ktup){  /*Ktup comparison adapted from Rob Edgar, NAR, vol32, No1, 381, 2004*/  /*1: hasch sequence 1    2: Count the number of seq2 ktup found in seq1  */  char c;  int key;  static HaschT*H1;  static char *pseq;  Hasch_entry *e;  char *s;  int l, ls;  int p, a, max_dist=-1;  double score=0;  if (!strm (i_seq1, pseq))    {      if (H1)	{	  hdestroy (H1, declare_ktup_hasch_data, free_ktup_hasch_data);	  string2key (NULL, NULL);	}      H1=hasch_sequence ( i_seq1, ktup);      vfree (pseq);pseq=(char*)vcalloc ( strlen (i_seq1)+1, sizeof (char));      sprintf ( pseq, "%s", i_seq1);    }  ls=l=strlen (i_seq2);  s=i_seq2;  p=0;  while (ls>ktup)    {      c=s[ktup];s[ktup]='/0';      key=string2key (s, NULL);      e=hsearch (H1,key,FIND, declare_ktup_hasch_data, free_ktup_hasch_data);      if ( e==NULL);      else if ( max_dist==-1)score++;      else	{	  for ( a=1; a<=(e->data)->list[1]; a++)	    if (FABS((p-(e->data)->list[a]))<=max_dist)	      {score++; break;}	}      s[ktup]=c;s++;p++;ls--;    }  score/=(l-ktup);  score=(log(0.1+score)-log(0.1))/(log(1.1)-log(0.1));  if ( score>100) score=100;  return (int)(score*100);}
开发者ID:cbcrg,项目名称:tcoffee,代码行数:57,


示例27: vthread_create

int vthread_create(vthread_t *thread, vthread_attr_t *attr,	vthread_routine start_routine, void *arg, int argsize){	int ret = ESUCCESS;	vthread_t vthread;	/**	 * SIGCHLD must be catched to wake up the server when a client terminated.	 */	struct sigaction action;	action.sa_flags = SA_SIGINFO;	sigemptyset(&action.sa_mask);	//action.sa_sigaction = handler;	/**	 * ignore SIGCHLD allows the child to die without to create a zombie.	 * But the parent doesn't receive information.	 * See below about "waitpid"	 */	action.sa_handler = SIG_IGN;	sigaction(SIGCHLD, &action, NULL);	vthread = vcalloc(1, sizeof(struct vthread_s));	if (vthread && (vthread->pid = fork()) == 0)	{#ifdef TIME_PROFILER		struct timeval date1, date2;		gettimeofday(&date1, NULL);#endif		ret = (int)start_routine(arg);#ifdef TIME_PROFILER		gettimeofday(&date2, NULL);		date2.tv_sec -= date1.tv_sec;		if (date2.tv_usec > date1.tv_usec)			date2.tv_usec -= date1.tv_usec;		else		{			date2.tv_sec += 1;			date2.tv_usec = date1.tv_usec - date2.tv_usec;		}		printf("time %d:%d/n", date2.tv_sec, date2.tv_usec);#endif 		exit(ret);	}	else if ( (vthread == NULL) || (vthread->pid == -1))	{		err("fork error %s", strerror(errno));		ret = EREJECT;	}	else	{		sched_yield();		*thread = vthread;	}	return ret;}
开发者ID:mchalain,项目名称:libhttpserver,代码行数:56,


示例28: float_logB

double float_logB (float *i, int n)	{	static double *array;	int a;	 	if ( array==NULL)array=vcalloc ( 1000, sizeof (double));	for ( a=0; a< n; a++)		array[a]=(double)i[a];	return double_logB(array, n);	}
开发者ID:dalehamel,项目名称:birch-native-sources,代码行数:10,



注:本文中的vcalloc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ vcc_ErrWhere函数代码示例
C++ vc_dispmanx_update_start函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。