private double naiveQueryDense(NumberVector obj,WritableDoubleDataStore scores,HashSetModifiableDBIDs cands){
  double len=0.;
  for (int dim=0, max=obj.getDimensionality(); dim < max; dim++) {
    final double val=obj.doubleValue(dim);
    if (val == 0. || val != val) {
      continue;
    }
    len+=val * val;
    if (dim >= index.size()) {
      continue;
    }
    ModifiableDoubleDBIDList column=index.get(dim);
    for (DoubleDBIDListIter n=column.iter(); n.valid(); n.advance()) {
      scores.increment(n,n.doubleValue() * val);
      cands.add(n);
    }
  }
  return Math.sqrt(len);
}

private double naiveQueryDense ( NumberVector obj , WritableDoubleDataStore scores , HashSetModifiableDBIDs cands ) { double len = 0. ; for ( int dim = 0 , max = obj . getDimensionality ( ) ; dim < max ; dim ++ ) { final double val = obj . doubleValue ( dim ) ; if ( val == 0. || val != val ) { continue ; } len += val * val ; if ( dim >= index . size ( ) ) { continue ; } ModifiableDoubleDBIDList column = index . get ( dim ) ; for ( DoubleDBIDListIter n = column . iter ( ) ; n . valid ( ) ; n . advance ( ) ) { scores . increment ( n , n . doubleValue ( ) * val ) ; cands . add ( n ) ; } } return Math . sqrt ( len ) ; }
query the most similar objects , dense version .
