private static List<FeatureItem> convert2SortedFeatureNodeArray( FeatureVector fv) { List<FeatureItem> res = new ArrayList<FeatureItem>(); for (int i = 0; i < fv.idx.length; i++) { res.add(new FeatureItem(fv.idx[i], fv.value[i])); } Collections.sort(res, new Comparator<FeatureItem>() { // @Override public int compare(FeatureItem o1, FeatureItem o2) { if (o1.index < o2.index) return -1; else if (o1.index > o2.index) return 1; else return 0; } }); return res; }
a_idx++; } else if (af.index > bf.index) { tmp.add(new FeatureItem(bf.index, -bf.value)); b_idx++; } else { tmp.add(new FeatureItem(bf.index, af.value - bf.value)); a_idx++; b_idx++; tmp.add(new FeatureItem(bf.index, -bf.value)); b_idx++;
b_idx++; } else { tmp.add(new FeatureItem(bf.index, af.value + bf.value)); a_idx++; b_idx++;