4445464748495051525354
TIntDoubleHashMap diff = new TIntDoubleHashMap(); for (int i = 0; i < a.numEntries(); i++) { int ind = a.getIndexAt(i); double val = a.getValueAt(i); if (!diff.containsKey(ind)) { diff.put(ind, 0); } diff.put(ind, diff.get(ind) + val); }
5354555657585960616263
} for (int i = 0; i < b.numEntries(); i++) { int ind = b.getIndexAt(i); double val = b.getValueAt(i); if (!diff.containsKey(ind)) { diff.put(ind, 0); } diff.put(ind, diff.get(ind) - val); }
4647484950515253545556
5556575859606162636465