protected double[] svmlightToArray(String row) throws Exception {
    double[]		result;
    StringTokenizer	tok;
    int			index;
    int			max;
    String		col;
    double		value;

    // actual data
    try {
      // determine max index
      max = 0;
      tok = new StringTokenizer(row, " \t");
      tok.nextToken();  // skip class
      while (tok.hasMoreTokens()) {
	col = tok.nextToken();
	// finished?
	if (col.startsWith("#"))
	  break;
	// qid is not supported
	if (col.startsWith("qid:"))
	  continue;
	// actual value
	index = Integer.parseInt(col.substring(0, col.indexOf(":")));
	if (index > max)
	  max = index;
      }

      // read values into array
      tok    = new StringTokenizer(row, " \t");
      result = new double[max + 1];

      // 1. class
      result[result.length - 1] = Double.parseDouble(tok.nextToken());

      // 2. attributes
      while (tok.hasMoreTokens()) {
	col  = tok.nextToken();
	// finished?
	if (col.startsWith("#"))
	  break;
	// qid is not supported
	if (col.startsWith("qid:"))
	  continue;
	// actual value
	index = Integer.parseInt(col.substring(0, col.indexOf(":")));
	value = Double.parseDouble(col.substring(col.indexOf(":") + 1));
	result[index - 1] = value;
      }
    }
    catch (Exception e) {
      System.err.println("Error parsing line '" + row + "': " + e);
      throw new Exception(e);
    }
    
    return result;
  }