use of com.tencent.angel.ml.math2.storage.IntIntVectorStorage in project angel by Tencent.
the class IntIntVector method numZeros.
public int numZeros() {
IntIntVectorStorage dstorage = (IntIntVectorStorage) storage;
if (dstorage.size() == 0)
return (int) dim;
int numZero = 0;
if (dstorage.isSparse()) {
IntIterator iter = dstorage.valueIterator();
while (iter.hasNext()) {
if (iter.nextInt() != 0) {
numZero += 1;
}
}
} else {
for (int val : dstorage.getValues()) {
if (val != 0) {
numZero += 1;
}
}
}
return (int) getDim() - numZero;
}
Aggregations