void get_x( void) 
{
/*
 * data setup for symbol values  1, 2
 * 3 memory elements
 */

  K = 1;	/* find K best completely unmerged paths */

  N = 15;			/* N data samples */

  states = FSM( [1:2], 3);

  M = rows( states);		/* M states */

  zstate = 1;			/* zero state */

  /* x = [ -1 1 1 -1 -1];		/* input sequence */

  x = rand( 1, N, "int", 2);

  f = [ 0.1 -0.2 0.5 -0.9]';

  trans = FSM_trans( states, f);	/* get state transition matrix */

  y = FSM_out( x, states, zstate, f);	/* get FSM output */

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

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


double get_yval( int _cur, int _next)
{
  return trans( _cur, _next);
}

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)
{
  vector t = states(:,1)';

  return t( _index);
}
