Package it.unimi.dsi.fastutil.ints

Examples of it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap


    for ( d = k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) d += ( cachePointer[k].writtenBits() + cacheDataLength[ k ] );
    quantumBitLength = (int)( ( ( d * quantum ) + ( cache - 1 ) ) / cache );

    final TowerData td = new TowerData();
    final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap();

    /* As a first try, we compute the tower costs using 0 as average entry bit length. */
    tryTower( quantumBitLength, positionsQuantumBitLength, 0, toTheEnd, cacheSkipBitCount, td, false );
   
    if ( td.numberOfSkipTowers > 0 ) { // There actually is at least a tower.
      /* Now we repeat this operation, trying to obtain the best value for the
       * average entry bit length.
       */

      while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) {
        td.clear();
        tryTower( quantumBitLength, positionsQuantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false );
        candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength );
      }

      if ( ASSERTS ) assert candidates.size() < MAX_TRY;

      entryBitLength = candidates.get( candidates.firstIntKey() );

      if ( DEBUG ) System.err.println( "Going to write tower at position " + obs.writtenBits() );
      tryTower( quantumBitLength, positionsQuantumBitLength, entryBitLength, toTheEnd, cacheSkip, towerData, true );
    }

View Full Code Here


    for ( d = k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) d += ( cachePointer[k].writtenBits() + cacheDataLength[ k ] );
    quantumBitLength = (int)( ( ( d * quantum ) + ( cache - 1 ) ) / cache );

    final TowerData td = new TowerData();
    final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap();

    /* As a first try, we compute the tower costs using 0 as average entry bit length. */
    tryTower( quantumBitLength, 0, toTheEnd, cacheSkipBitCount, td, false );
   
    if ( td.numberOfSkipTowers > 0 ) { // There actually is at least a tower.
      /* Now we repeat this operation, trying to obtain the best value for the
       * average entry bit length.
       */

      while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) {
        td.clear();
        tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false );
        candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength );
      }

      if ( ASSERTS ) assert candidates.size() < MAX_TRY;

      entryBitLength = candidates.get( candidates.firstIntKey() );

      if ( STATS ) if ( System.getProperty( "freq" ) != null ) {
        final double freq = Double.parseDouble( System.getProperty( "freq" ) );
        final double error = Integer.getInteger( "error" ).intValue() / 100.0;
        final double relativeFrequency = (double)frequency / numberOfDocuments;
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.