public void writeToLuceneStream(IndexOutput outputStream,int k){
  float[] coordsToWrite;
  if (isSparse) {
    RealVector copy=copy();
    copy.sparseToDense();
    coordsToWrite=copy.coordinates;
  }
 else {
    coordsToWrite=coordinates;
  }
  for (int i=0; i < k; ++i) {
    try {
      outputStream.writeInt(Float.floatToIntBits(coordsToWrite[i]));
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

public void writeToLuceneStream ( IndexOutput outputStream , int k ) { float [ ] coordsToWrite ; if ( isSparse ) { RealVector copy = copy ( ) ; copy . sparseToDense ( ) ; coordsToWrite = copy . coordinates ; } else { coordsToWrite = coordinates ; } for ( int i = 0 ; i < k ; ++ i ) { try { outputStream . writeInt ( Float . floatToIntBits ( coordsToWrite [ i ] ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } }
writes vector out in dense format . if vector is originally sparse , writes out a copy so that vector remains sparse . truncates to length k .
