405406407408409410411412413414415416417418419
/** @return all indexes whose values are minVal <= val < maxVal */ public IIntArray withinIndexes(IDoubleArray arr, double minVal, double maxVal) { IIntList res = Ints.create.list(arr.size() / 2); for (int i = 0; i < arr.size(); i++) { if (minVal <= arr.get(i) && arr.get(i) < maxVal) { res.append(i); } } return (res); }
473474475476477478479480481
} } public IIntList findAll(IDoubleArray arr, double val) { IIntList res = Ints.create.list(0); findAll(arr, val, res); return (res); }
480481482483484485486487488489490
return (res); } public IIntList findAll(IDoubleArray arr, IDoubleArray vals) { IIntList res = Ints.create.list(0); for (int i = 0; i < vals.size(); i++) { findAll(arr, vals.get(i), res); } return (res);
962963964965966967968969970971972973974975976
return (findBackwards(arr, val, 0)); } public IIntArray findAllRows(IDoubleArray arr, IDoubleArray val) { IIntList res = Ints.create.list(0); for (int i = 0; i < arr.size(); i++) { if (equal(arr.viewRow(i), val)) { res.append(i); } } return (res); }
1003100410051006100710081009101010111012101310141015
return res; } public int[] nonzeroIndexes1D(IDoubleArray arr) { IIntList list = intsNew.list(arr.rows()); for (IDoubleIterator it = arr.nonzeroIterator(); it.hasNext();) { IDoubleElement de = it.next(); list.append(de.index()); } return list.getArray(); }