void get_x( void)
{
/* data setup for symbol values -m ... +m,  f(D) = 1 - D */

  N = 25;	/* N data samples */
  M = 5;	/* M symbol values */
  K = 1;	/* find K best completely unmerged paths */

  states = [ -(M-1)/2:(M-1)/2];	/* states like -2, -1, 0, 1, 2 */

  zstate = (M+1)/2;		/* zero state, states( zstate) == 0 */

  x = states( rand( 1, N, "int", M));	/* input sequence */

  y = x - [ 0 x(1:N-1)];		/* FSM output, f(D) = 1 - D */

  n = 0.1 * rand( 1, N, "gauss");	/* random noise */

  z = y + n;				/* signal plus noise */
}


double get_yval( int _cur, int _next)
{
/* get_yval() for f(D) = 1 - D */

  return states(_next) - states(_cur);
}

double get_cost( double _zz, int _cur, int _next, int _j)
{
  double yval = get_yval( _cur, _next);

  if( yval == HUGE_VAL)
    return yval;

  return pn( _zz - yval);
}

vector get_ex( vector _index)
{
/* get_ex() for f(D) = 1 - D */

  return states( _index);
}
