Example #1
0
static void print_sparse_amp_error(struct AEXP *aexp, MODEL *model, float edB_thresh)
{
    int    m, index;
    float  edB, enormdB, error, dWo;
    float  sparse_pe[MAX_AMP];

    edB = frame_energy(model, &enormdB);
    //printf("%f\n", enormdB);
    dWo = fabs((aexp->model_uq[2].Wo - aexp->model_uq[1].Wo)/aexp->model_uq[2].Wo);

    if ((edB > edB_thresh) && (dWo < 0.1)) {
	for(m=0; m<MAX_AMP; m++) {
	    sparse_pe[m] = 0.0;
	}

	for(m=1; m<=model->L; m++) {
	    assert(model->A[m] > 0.0);
	    error = 20.0*log10(model->A[m]) - enormdB;

	    index = MAX_AMP*m*model->Wo/PI;
	    assert(index < MAX_AMP);
	    sparse_pe[index] = error;
	}

	/* dump sparse amp vector */

	for(m=0; m<MAX_AMP; m++)
	    printf("%f ", sparse_pe[m]);
	printf("\n");
    }
}
Example #2
0
void PrintStackTrace(int skipCount, const char* executableName)
{
	void* addresses[16];
	const int symbolCount = backtrace(addresses, UDT_COUNT_OF(addresses));
	if(skipCount >= symbolCount)
	{
		return;
	}

	char** const messages = backtrace_symbols(addresses, symbolCount);
	if(messages == NULL)
	{
		return;
	}

	printf("Stack trace:\n");
	for(int i = skipCount; i < symbolCount; ++i)
	{
		printf("#%d %s\n", i, messages[i]);

		if(executableName == NULL)
		{
			continue;
		}

		char callBuffer[256];
		sprintf(callBuffer,"addr2line %p -e %s", addresses[i], executableName);
		system(callBuffer);
	}

	free(messages);
}
Example #3
0
void foo()
{
#pragma xmp template_fix [gblock(m)] t[NSIZE]
  int *a;
#pragma xmp align a[i] with t[i]
#pragma xmp shadow a[2]

  a = (int*)xmp_malloc(xmp_desc_of(a), NSIZE);

#pragma xmp loop on t[i]
  for (int i = 0; i < N; i++)
    a[i] = i;

#pragma xmp reflect (a) width (/periodic/1:1) async (100)
#pragma xmp wait_async (100)

#pragma xmp loop on t[i]
  for (int i = 0; i < N; i++){
    if(a[i-1] != (i-1+N)%N){
      printf("ERROR Lower in %d (%06d) (%06d)\n", (int)i, a[i-1], (int)(i-1+N)%N);
      exit(1);
    }
    if(a[i+1] != (i+1+N)%N){
      printf("ERROR Upper in %d (%06d) (%06d)\n", (int)i, a[i+1], (int)(i+1+N)%N);
      exit(1);
    }
  }

#pragma xmp task on p[0]
  {
    printf("PASS\n");
  }
}
Example #4
0
void usage(char *prog) {
  printf("Usage: %s [cpv]\n", prog);
  printf("\t-c cell id [Default %d]\n", cell.id);
  printf("\t-p cell.nof_ports [Default %d]\n", cell.nof_ports);
  printf("\t-n cell.nof_prb [Default %d]\n", cell.nof_prb);
  printf("\t-v [set srslte_verbose to debug, default none]\n");
}
Example #5
0
int main(int argc, char *argv[])
{
		int a = 6;
		printf("%d\n", a);
		int *ptr1;
		int **ptr2;
		int ***ptr3;
		int ****ptr4;
		int *****ptr5;
		int ******ptr6;
		int *******ptr7;
		int ********ptr8;
		int *********ptr9;
		
		ptr1 = &a;
		ptr2 = &ptr1;
		ptr3 = &ptr2;
		ptr4 = &ptr3;
		ptr5 = &ptr4;
		ptr6 = &ptr5;
		ptr7 = &ptr6;
		ptr8 = &ptr7;
		ptr9 = &ptr8;
	
	ft_ultimate_ft(ptr9);
	printf("%d\n", a);
}
Example #6
0
//-----------------------------------------------------------------------------
// dump the map
//-----------------------------------------------------------------------------
void ddmap_dump(struct ddmap_data *map_data)
{
	int cols = 8;
	int i;
	u_int32_t *ptr = map_data->map;
	char *line;	

	line = malloc(132);
	if (!line)
		return;
	*line = '\0';
	
	for (i=0; i<map_data->map_size; i++)
	{
		if (i % cols == 0 && *line)
		{
			printf("%08llx: %s\n", (long long unsigned)i * DDMAP_U32_SIZE - (cols * DDMAP_U32_SIZE), line);
			*line = '\0';
		}
		snprintf(line+strlen(line), 10, "%08x ",*ptr);
		ptr++;
	}
	printf("%08llx: %s\n", (long long unsigned)i * DDMAP_U32_SIZE, line);
	free(line);
}
Example #7
0
int do_env_print (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	int i;
	int rcode = 0;

	if (argc == 1) {
		/* print all env vars */
		rcode = env_print(NULL);
		if (!rcode)
			return 1;
		printf("\nEnvironment size: %d/%ld bytes\n",
			rcode, (ulong)ENV_SIZE);
		return 0;
	}

	/* print selected env vars */
	for (i = 1; i < argc; ++i) {
		int rc = env_print(argv[i]);
		if (!rc) {
			printf("## Error: \"%s\" not defined\n", argv[i]);
			++rcode;
		}
	}

	return rcode;
}
Example #8
0
int main()
{
    int n;
    int Ans[60000];
    int cnt = 0;
    scanf("%d", &n);
    long long sum = (long long)n * (n + 1) / 2;
    puts(sum & 1 ? "1" : "0");
    sum /= 2;
    while(1) {
        if(sum >= n) {
            Ans[cnt++] = n;
            sum -= n;
        }
        if(sum == 0) {
            break;
        }
        --n;
    }
    printf("%d ", cnt);
    for(int i = 0; i < cnt; ++i) {
        printf("%d ", Ans[i]);
    }
    return 0;
}
Example #9
0
void alta(int proximo,int* codigo,char descripcion[][50],float* importe, int* cantidad, int maximo)
{
	int  i;
	
	for(i=1; i<=maximo; i++)
	 {
		codigo=i;
		
			printf("\nCodigo: %d", codigo);
			printf ("\nDescripcion: ");
			scanf("%s", & descripcion[i]);
		
			printf("Importe: ");
			scanf("%f", & importe[i]);
			
			printf("Cantidad: ");
			scanf("%d", & cantidad[i]);
			
			
			if(i==maximo)
			break;
	 }
	 
	
}
Example #10
0
void setuser(const char *user)
{
	uid_t uid;

	if (!strlen(user)) {
		return;
	}

	if (getuid() != 0 && geteuid() != 0) {
		printf("Error: User can only be set as root.\n");
		exit(EXIT_FAILURE);
	}

	if (isnumeric(user) && atoi(user) == 0) {
		return;
	}

	uid = getuser(user);

	if (debug)
		printf("switching to user id %d.\n", uid);

	if (setuid(uid) != 0) {
		perror("Error: setuid");
		exit(EXIT_FAILURE);
	}
}
Example #11
0
void setgroup(const char *group)
{
	gid_t gid;

	if (!strlen(group)) {
		return;
	}

	if (getuid() != 0 && geteuid() != 0) {
		printf("Error: Group can only be set as root.\n");
		exit(EXIT_FAILURE);
	}

	if (isnumeric(group) && atoi(group) == 0) {
		return;
	}

	gid = getgroup(group);

	if (debug)
		printf("switching to group id %d.\n", gid);

	if (setgid(gid) != 0) {
		perror("Error: setgid");
		exit(EXIT_FAILURE);
	}
}
Example #12
0
gid_t getgroup(const char *group)
{
	struct group *gr;
	gid_t gid;

	if (!strlen(group)) {
		return getgid();
	}

	if (isnumeric(group)) {
		gid = atoi(group);
		gr = getgrgid(gid);
	} else {
		gr = getgrnam(group);
	}

	if (gr == NULL) {
		printf("Error: No such group: \"%s\".\n", group);
		exit(EXIT_FAILURE);
	}

	gid = gr->gr_gid;

	if (debug)
		printf("getgroup(%s / %d): %s (%d)\n", group, atoi(group), gr->gr_name, (int)gid);

	return gid;
}
Example #13
0
uid_t getuser(const char *user)
{
	struct passwd *pw;
	uid_t uid;

	if (!strlen(user)) {
		return getuid();
	}

	if (isnumeric(user)) {
		uid = atoi(user);
		pw = getpwuid(uid);
	} else {
		pw = getpwnam(user);
	}

	if (pw == NULL) {
		printf("Error: No such user: \"%s\".\n", user);
		exit(EXIT_FAILURE);
	}

	uid = pw->pw_uid;

	if (debug)
		printf("getuser(%s / %d): %s (%d)\n", user, atoi(user), pw->pw_name, (int)uid);

	return uid;
}
Example #14
0
void smooth_amp(struct AEXP *aexp, MODEL *model) {
    int    m, i;
    int    nbins;
    int    b;
    float  f;
    float  av[MAX_BINS];
    int    nav[MAX_BINS];

    nbins = sizeof(bins)/sizeof(float);

    /* clear all bins */

    for(i=0; i<MAX_BINS; i++) {
	av[i] = 0.0;
	nav[i] = 0;
    }

    /* add amps into each bin */

    for(m=1; m<=model->L; m++) {
	f = m*model->Wo*FS/TWO_PI;
	if (f > bins[0]) {

	    /* find bin  */

	    for(i=0; i<nbins; i++)
		if ((f > bins[i]) && (f <= bins[i+1]))
		    b = i;
	    assert(b < MAX_BINS);

	    av[b] += model->A[m]*model->A[m];
	    nav[b]++;
	}

    }

    /* use averages to est amps */

    for(m=1; m<=model->L; m++) {
	f = m*model->Wo*FS/TWO_PI;
	if (f > bins[0]) {

	    /* find bin */

	    for(i=0; i<nbins; i++)
		if ((f > bins[i]) && (f <= bins[i+1]))
		    b = i;
	    assert(b < MAX_BINS);

	    /* add predicted phase error to this bin */

	    printf("L %d m %d f %4.f b %d\n", model->L, m, f, b);

	    printf(" %d: %4.3f -> ", m, 20*log10(model->A[m]));
	    model->A[m] = sqrt(av[b]/nav[b]);
	    printf("%4.3f\n", 20*log10(model->A[m]));
	}
    }
    printf("\n");
}
int main()
{
	PITEM pItem = NULL;
	DWORD dwBytesRead = 0;
	char buffer[32] = { 0 };

	pItem = (PITEM)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pItem));
	if (!pItem) {
		printf("Failed to allocate memory\n");
		return -1;
	}

	pItem->d = greetings;

	if (!ReadFile(GetStdHandle(STD_INPUT_HANDLE), &buffer, 32, &dwBytesRead, NULL)) {
		printf("Failed to read STDIN\n");
		HeapFree(GetProcessHeap(), 0, pItem);
		return -1;
	}

	strcpy((char *) pItem, buffer);
        // debug break to make taking memory dumps easier
        __debugbreak();


	if (pItem->d) {
		pItem->d();
	}

	if (pItem) {
		HeapFree(GetProcessHeap(), 0, pItem);
	}
    return 0;
}
int main(int argc , char **argv)
{
	if(argc>1 && strcmp(argv[1],"DEBUG")==0) debug=1;
	int t,m,n,i,j,**floor,val;scanf("%d",&t);
	while(t--){
		scanf("%d %d",&m,&n);
		floor=(int**)calloc(m,sizeof(int*));
		for(i=0;i<m;++i){
			floor[i]=(int*)calloc(n,sizeof(int));
			for(j=0;j<n;++j){
				scanf("%d",&floor[i][j]);
			}
		}
		for(i=1;i<m;++i){
			for(j=0;j<n;++j){
				val = floor[i-1][j];
				if(j>0)val = val>floor[i-1][j-1] ? val : floor[i-1][j-1] ;
				if(j<n-1)val = val>floor[i-1][j+1] ? val : floor[i-1][j+1];
				
				floor[i][j]+=val;
			}
		}
		if(debug){
			printf("\n\n");
			for(i=0;i<m;++i){
				for(j=0;j<n;++j)printf("%d ",floor[i][j]);
				printf("\n");
			}
		}
		for(i=0;i<n;++i)val=val>floor[m-1][i]?val:floor[m-1][i];
		printf("%d\n",val);
	}
	return 0;
}
inline bool Tensor4D<Tensor4DShape, float>::TestEq(Tensor4D<Tensor4DShape, float>& other) const {
  // Test equivalence, printing errors
  // First test the shapes are the same
  if (!_shape.TestEq(other.shape())) {
    printf("Tensors have different shapes.\n");
    return false;
  } else {
    int incorrects = 0;

    for (int n = 0; n < _shape.n_batches; n++) {
      for (int i = 0; i < _shape.n_rows; i++) {
        for (int j = 0; j < _shape.n_cols; j++) {
          for (int c = 0; c < _shape.n_channels; c++) {
            // Check elements for equivalence
            const auto a = this->element(n, i, j, c);
            const auto b = other.element(n, i, j, c);

            if (a != b) {
              printf("Difference at element {%d, %d, %d, %d}: %.3f != %.3f\n", n, i, j, c, a, b);

              if (++incorrects > 100) {
                printf("More than 100 incorrect values, stopping test.\n");
                return false;
              }
            }
          }
        }
      }
    }

    return incorrects == 0;
  }
}
void unpack(char const* buf, size_t len) {
    /* buf is allocated by client. */
    msgpack_unpacked result;
    size_t off = 0;
    msgpack_unpack_return ret;
    int i = 0;
    msgpack_unpacked_init(&result);
    ret = msgpack_unpack_next(&result, buf, len, &off);
    while (ret == MSGPACK_UNPACK_SUCCESS) {
        msgpack_object obj = result.data;

        /* Use obj. */
        printf("Object no %d:\n", ++i);
        msgpack_object_print(stdout, obj);
        printf("\n");
        /* If you want to allocate something on the zone, you can use zone. */
        /* msgpack_zone* zone = result.zone; */
        /* The lifetime of the obj and the zone,  */

        ret = msgpack_unpack_next(&result, buf, len, &off);
    }
    msgpack_unpacked_destroy(&result);

    if (ret == MSGPACK_UNPACK_CONTINUE) {
        printf("All msgpack_object in the buffer is consumed.\n");
    }
    else if (ret == MSGPACK_UNPACK_PARSE_ERROR) {
        printf("The data in the buf is invalid format.\n");
    }
}
Example #19
0
int main(int argc, char **argv)
{
  printf("Enter two end points of the line to be drawn:\n");
  printf("\n************************************");
  printf("\nEnter Point1( X1 , Y1):\n");
  scanf("%lf%lf",&X1,&Y1);
  printf("\n************************************");
  printf("\nEnter Point1( X2 , Y2):\n");
  scanf("%lf%lf",&X2,&Y2);
  
  /* Initialise GLUT library */
  glutInit(&argc,argv);
  /* Set the initial display mode */
  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  /* Set the initial window position and size */
  glutInitWindowPosition(0,0);
  glutInitWindowSize(640,480);
  /* Create the window with title "DDA_Line" */
  glutCreateWindow("DDA_Line");
  /* Initialize drawing colors */
  Init();
  /* Call the displaying function */
  glutDisplayFunc(LineDDA);
  /* Keep displaying untill the program is closed */
  glutMainLoop();
  return 0;
}
Example #20
0
File: example.c Project: wugsh/wgs
int main()
{
    int a[6],i = 1;

    while(i < 6)
    {
        scanf("%d", &a[i]);
        i++;
    }

    printf("Before sequence:\n");
    for (i = 1; i < 6; i++ )
    {
        printf("a[%d] = %d ", i, a[i]);
    }
    printf("\n");

    sequence(a, 5);

    printf("After sequence:\n");
    i = 1;
    do{
        printf("a[%d] = %d ", i, a[i]);
        i++;
    }while(i < 6);

    return 0;

}
Example #21
0
void   read4file(char *fname, float **s0, float **sinit, float **s, int nx, int nz)
{
    //int i;
    FILE *fp;

    if((fp=fopen(fname, "rb"))==NULL) {
	printf("Cannot open file.\n");
    }

    /* nm 
    if(fread(&i, sizeof(int), 1, fp) != 1) {
	if (feof(fp))
	    printf("File read error - nm.");
    }
    assert(i == nx*nz); */

    /* m0 */
    if(fread(s0[0], sizeof(float), nx*nz, fp) != nx*nz) {
	if (feof(fp))
	    printf("File read error - too small.");
    }

    /* minit */
    if(fread(sinit[0], sizeof(float), nx*nz, fp) != nx*nz) {
	if (feof(fp))
	    printf("File read error - too small.");
    }
    /* s */
    if(fread(s[0], sizeof(float), nx*nz, fp) != nx*nz) {
	if (!feof(fp))
	    printf("File read error - too big.");
    }

    fclose(fp);
}
Example #22
0
int main(void)
{
	int _T, _Check;
	double i = 0;
	double _Ln = 0;
	double _V = 0;

	printf("Please enter number of terms : ");
	scanf("%d", &_T);
	_Check = _T%2;

	for(i=1; i < _T; i++)
	{
		_V = 1 / i;
		if ( _Check == 1)
		{
			_Ln += _V;
		}
		else 
		{
			_V = -_V;
			_Ln += _V;
		}

		
	}
	_Ln = +_Ln;

	printf("Ln 2 value is %.6lf\n", _Ln);

	return 0;

}
Example #23
0
double op(double v1, char op, double v2)
{
	switch (op)
	{
	case '+':
		return v1 + v2;
		break;
	case '-':
		return v1 - v2;
		break;
	case '*':
		return v1 * v2;
		break;
	case '/':
		if (v2 != 0.0)
			return v1 / v2;
		else
			printf("error: zero division");
		return 0.0;
		break;
	case '%':
		return fmod(v1, v2);
		break;
	default:
		printf("Unknown operator");
		return 0.0;
		break;
	}
}
int drawCard(int player, struct gameState *state)
{
	int count;
	int deckCounter;
	if (state->deckCount[player] <= 0) {//Deck is empty

	  //Step 1 Shuffle the discard pile back into a deck
		int i;
		//Move discard to deck
		for (i = 0; i < state->discardCount[player]; i++) {
			state->deck[player][i] = state->discard[player][i];
			state->discard[player][i] = -1;
		}

		state->deckCount[player] = state->discardCount[player];
		state->discardCount[player] = 0;//Reset discard

		//Shufffle the deck
		shuffle(player, state);//Shuffle the deck up and make it so that we can draw

		if (DEBUG) {//Debug statements
			printf("Deck count now: %d\n", state->deckCount[player]);
		}

		state->discardCount[player] = 0;

		//Step 2 Draw Card
		count = state->handCount[player];//Get current player's hand count

		if (DEBUG) {//Debug statements
			printf("Current hand count: %d\n", count);
		}

		deckCounter = state->deckCount[player];//Create a holder for the deck count

		if (deckCounter == 0)
			return -1;

		state->hand[player][count] = state->deck[player][deckCounter - 1];//Add card to hand
		state->deck[player][deckCounter - 1] = -1;
		state->deckCount[player]--;
		state->handCount[player]++;//Increment hand count
	}

	else {
		int count = state->handCount[player];//Get current hand count for player
		int deckCounter;
		if (DEBUG) {//Debug statements
			printf("Current hand count: %d\n", count);
		}

		deckCounter = state->deckCount[player];//Create holder for the deck count
		state->hand[player][count] = state->deck[player][deckCounter - 1];//Add card to the hand
		state->deck[player][deckCounter - 1] = -1;
		state->deckCount[player]--;
		state->handCount[player]++;//Increment hand count
	}

	return 0;
}
Example #25
0
int main () {
  int count;
  int i, j, k;
  int n;

  scanf ("%d", &count);
  for (i=0; i<count; i++) {
    memset (flag, 0, sizeof(int)*N);
    scanf ("%d", &n);
    getchar();
    for (j=0; j<n; j++)
      fgets (s[j], sizeof(s[j][0])*M, stdin); 
    for (j=0; j<n; j++)
      fgets (d[j], sizeof(d[j][0])*M, stdin);

    /* find immobile sequence */
    for (j=n-1, k=n-1; j>=0; j--) {
      if (!strcmp (s[j],d[k])) { 
        flag[k] = 1;
        k -= 1;
      }
    }
    /* output mobile sequence */
    for (j=n-1; j>=0; j--) {
      if (flag[j] != 1)
        printf ("%s", d[j]);
    }

    printf ("\n");
  }
  return 0;
}
Example #26
0
static void process_js(char *cmd) {
  s_sjp.char_processor = interrupt_char_processor;
  char result_str[10];
  v7_val_t v;
  int res = v7_exec(s_sjp.v7, &v, cmd);

  if (res == V7_SYNTAX_ERROR) {
    printf("Syntax error: %s\n", v7_get_parser_error(s_sjp.v7));
  } else if (res == V7_STACK_OVERFLOW) {
    printf("Stack overflow: %s\n", v7_get_parser_error(s_sjp.v7));
  } else {
    char *p = v7_to_json(s_sjp.v7, v, result_str, sizeof(result_str));

    if (res == V7_EXEC_EXCEPTION) {
      printf("Exec error:");
    }

    printf("%s\n", p);

    if (p != result_str) {
      free(p);
    }
  }

  v7_gc(s_sjp.v7, 0 /* full */);
}
Example #27
0
void main(){
	int year,month, day,leap,sum_month;
	scanf("%d%d%d",&year,&month,&day);
	switch(month){
		case 1:sum_month=0;break;
		case 2:sum_month=31;break;
		case 3:sum_month=59;break;
		case 4:sum_month=90;break;
		case 5:sum_month=120;break;
		case 6:sum_month=151;break;
		case 7:sum_month=181;break;
		case 8:sum_month=212;break;
		case 9:sum_month=243;break;
		case 10:sum_month=273;break;
		case 11:sum_month=304;break;
		case 12:sum_month=334;break;
        default:printf("data error\n");break;
	}
	sum_month=sum_month+day;
	if(year%400==0||(year%4==0&&year%100!=0)) 
	   leap=1;
	else
		leap=0;
	if (leap==1&&month>2)
		sum_month++;                  /*用leap做为标志,根据标记再做运算*/
	printf("It is the %dth day.\n",sum_month);
	
}
Example #28
0
/* code to test */
int main()
{
    // Let us construct the BST shown in the above figure
    struct node *root        = newNode(20);
    root->left               = newNode(8);
    root->right              = newNode(22);
    root->left->left         = newNode(4);
    root->left->right        = newNode(12);
    root->left->right->left  = newNode(10);
    root->left->right->right = newNode(14);
 
    int n1 = 10, n2 = 14;
    struct node *t = lca(root, n1, n2);
    printf("LCA of %d and %d is %d \n", n1, n2, t->data);
 
    n1 = 14, n2 = 8;
    t = lca(root, n1, n2);
    printf("LCA of %d and %d is %d \n", n1, n2, t->data);
 
    n1 = 10, n2 = 22;
    t = lca(root, n1, n2);
    printf("LCA of %d and %d is %d \n", n1, n2, t->data);
 
    getchar();
    return 0;
}
Example #29
0
Stack CreateStack(int MaxElements)
{
    Stack S;

    S = (Stack) malloc (sizeof(struct StackRecord));
    if(S == 0) {
        printf("No memory for stack!\n");
        return 0;
    }

    S->Array = (ElementType*) malloc (sizeof(ElementType)*MaxElements);
    if(S->Array == 0) {
        printf("No memory for stack array\n");
        free(S);
        return 0;
    }

    S->MArray = (ElementType*) malloc (sizeof(ElementType)*MaxElements);
    if(S->MArray == 0) {
        printf("No memory for stack min array\n");
        free(S->Array);
        free(S);
        return 0;
    }

    S->TopOfStack = EmptyTOS;
    S->TopOfMStack = EmptyTOS;
    S->Capacity = MaxElements;

    return S;
}
Example #30
0
static void print_sparse_pred_error(struct AEXP *aexp, MODEL *model, float mag_thresh)
{
    int    m, index;
    float  mag, error;
    float  sparse_pe[MAX_AMP];

    mag = 0.0;
    for(m=1; m<=model->L; m++)
	mag += model->A[m]*model->A[m];
    mag = 10*log10(mag/model->L);

    if (mag > mag_thresh) {
	for(m=0; m<MAX_AMP; m++) {
	    sparse_pe[m] = 0.0;
	}

	for(m=1; m<=model->L; m++) {
	    assert(model->A[m] > 0.0);
	    error = PRED_COEFF*20.0*log10(aexp->A_prev[m]) - 20.0*log10(model->A[m]);
	    //error = 20.0*log10(model->A[m]) - mag;

	    index = MAX_AMP*m*model->Wo/PI;
	    assert(index < MAX_AMP);
	    sparse_pe[index] = error;
	}

	/* dump sparse amp vector */

	for(m=0; m<MAX_AMP; m++)
	    printf("%f ", sparse_pe[m]);
	printf("\n");
    }
}