Tabnine Logo
HuffmanCodec.codeWords
Code IndexAdd Tabnine to your IDE (free)

How to use
codeWords
method
in
it.unimi.dsi.compression.HuffmanCodec

Best Java code snippets using it.unimi.dsi.compression.HuffmanCodec.codeWords (Showing top 12 results out of 315)

origin: blazegraph/database

/**
 * This verifies that a code book constructed from a given set of
 * frequencies may be reconstructed from the cord word bit lengths, given in
 * a non-decreasing order, together with the symbols in a correlated array.
 * 
 * @param frequency
 */
public void doRoundTripTest(final int[] frequency) {
  
  final DecoderInputs decoderInputs = new DecoderInputs();
  
  final HuffmanCodec codec = new HuffmanCodec(frequency, decoderInputs);
  if (log.isDebugEnabled()) {
    log.debug(printCodeBook(codec.codeWords()) + "\nlength[]="
        + Arrays.toString(decoderInputs.getLengths()) + "\nsymbol[]="
        + Arrays.toString(decoderInputs.getSymbols()));
  }
  
  final CanonicalFast64CodeWordDecoder actualDecoder = new CanonicalFast64CodeWordDecoder(
      decoderInputs.getLengths(), decoderInputs.getSymbols());
  for (int i = 0; i < frequency.length; i++) {
    final BooleanIterator coded = codec.coder().encode(i/*symbol*/);
    
    assertEquals(i, actualDecoder.decode(coded));
    
  }
}
origin: com.blazegraph/bigdata-core-test

/**
 * This verifies that a code book constructed from a given set of
 * frequencies may be reconstructed from the cord word bit lengths, given in
 * a non-decreasing order, together with the symbols in a correlated array.
 * 
 * @param frequency
 */
public void doRoundTripTest(final int[] frequency) {
  
  final DecoderInputs decoderInputs = new DecoderInputs();
  
  final HuffmanCodec codec = new HuffmanCodec(frequency, decoderInputs);
  if (log.isDebugEnabled()) {
    log.debug(printCodeBook(codec.codeWords()) + "\nlength[]="
        + Arrays.toString(decoderInputs.getLengths()) + "\nsymbol[]="
        + Arrays.toString(decoderInputs.getSymbols()));
  }
  
  final CanonicalFast64CodeWordDecoder actualDecoder = new CanonicalFast64CodeWordDecoder(
      decoderInputs.getLengths(), decoderInputs.getSymbols());
  for (int i = 0; i < frequency.length; i++) {
    final BooleanIterator coded = codec.coder().encode(i/*symbol*/);
    
    assertEquals(i, actualDecoder.decode(coded));
    
  }
}
origin: com.blazegraph/bigdata-core

log
    .debug("\n"
        + printCodeBook(codec.codeWords(), this/* Symbol2Byte */));
origin: blazegraph/database

log
    .debug("\n"
        + printCodeBook(codec.codeWords(), this/* Symbol2Byte */));
origin: blazegraph/database

final PrefixCoder actual = new Fast64CodeWordCoder(codec.codeWords());
  log.debug(printCodeBook(codec.codeWords()));
origin: com.blazegraph/bigdata-core-test

final PrefixCoder actual = new Fast64CodeWordCoder(codec.codeWords());
  log.debug(printCodeBook(codec.codeWords()));
origin: blazegraph/database

: getSumCodedValueBitLengths(setup.codec().codeWords(),
    raba, (Byte2Symbol) setup);
origin: com.blazegraph/bigdata-core

: getSumCodedValueBitLengths(setup.codec().codeWords(),
    raba, (Byte2Symbol) setup);
origin: blazegraph/database

/**
 * Unit test for processing an {@link IRaba} representing B+Tree values
 * suitable to setup the data for compression.
 * 
 * @throws IOException 
 * 
 * @todo test w/ nulls.
 */
public void test_valueRabaSetup() throws IOException {
  final int n = 3;
  final byte[][] a = new byte[n][];
  a[0] = new byte[]{2,3};
  a[1] = new byte[]{3,5};
  a[2] = new byte[]{'m','i','k','e'};
  
  final IRaba raba = new ReadOnlyValuesRaba(a);
  final RabaCodingSetup setup = new RabaCodingSetup(raba);
  
  // verify that we can re-create the decoder.
  doDecoderInputRoundTripTest(setup.getSymbolCount(), setup
      .decoderInputs());
  // verify that we can re-create the coder.
  doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs()
      .getShortestCodeWord(), setup.decoderInputs().getLengths(),
      setup.decoderInputs().getSymbols());
}
origin: blazegraph/database

/**
 * Unit test for processing an {@link IRaba} representing B+Tree keys
 * suitable to setup the data for compression.
 * 
 * @throws IOException 
 */
public void test_keyRabaSetup() throws IOException {
  final int n = 8;
  final byte[][] a = new byte[n][];
  a[0] = new byte[]{1,2};
  a[1] = new byte[]{1,2,3};
  a[2] = new byte[]{1,3};
  a[3] = new byte[]{1,3,1};
  a[4] = new byte[]{1,3,3};
  a[5] = new byte[]{1,3,7};
  a[6] = new byte[]{1,5};
  a[7] = new byte[]{1,6,0};
  
  final IRaba raba = new ReadOnlyKeysRaba(a);
  final AbstractCodingSetup setup = new RabaCodingSetup(raba);
  doDecoderInputRoundTripTest(setup.getSymbolCount(), setup
      .decoderInputs());
  // verify that we can re-create the coder.
  doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs()
      .getShortestCodeWord(), setup.decoderInputs().getLengths(),
      setup.decoderInputs().getSymbols());
}
origin: com.blazegraph/bigdata-core-test

/**
 * Unit test for processing an {@link IRaba} representing B+Tree values
 * suitable to setup the data for compression.
 * 
 * @throws IOException 
 * 
 * @todo test w/ nulls.
 */
public void test_valueRabaSetup() throws IOException {
  final int n = 3;
  final byte[][] a = new byte[n][];
  a[0] = new byte[]{2,3};
  a[1] = new byte[]{3,5};
  a[2] = new byte[]{'m','i','k','e'};
  
  final IRaba raba = new ReadOnlyValuesRaba(a);
  final RabaCodingSetup setup = new RabaCodingSetup(raba);
  
  // verify that we can re-create the decoder.
  doDecoderInputRoundTripTest(setup.getSymbolCount(), setup
      .decoderInputs());
  // verify that we can re-create the coder.
  doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs()
      .getShortestCodeWord(), setup.decoderInputs().getLengths(),
      setup.decoderInputs().getSymbols());
}
origin: com.blazegraph/bigdata-core-test

/**
 * Unit test for processing an {@link IRaba} representing B+Tree keys
 * suitable to setup the data for compression.
 * 
 * @throws IOException 
 */
public void test_keyRabaSetup() throws IOException {
  final int n = 8;
  final byte[][] a = new byte[n][];
  a[0] = new byte[]{1,2};
  a[1] = new byte[]{1,2,3};
  a[2] = new byte[]{1,3};
  a[3] = new byte[]{1,3,1};
  a[4] = new byte[]{1,3,3};
  a[5] = new byte[]{1,3,7};
  a[6] = new byte[]{1,5};
  a[7] = new byte[]{1,6,0};
  
  final IRaba raba = new ReadOnlyKeysRaba(a);
  final AbstractCodingSetup setup = new RabaCodingSetup(raba);
  doDecoderInputRoundTripTest(setup.getSymbolCount(), setup
      .decoderInputs());
  // verify that we can re-create the coder.
  doCoderRoundTripTest(setup.codec().codeWords(), setup.decoderInputs()
      .getShortestCodeWord(), setup.decoderInputs().getLengths(),
      setup.decoderInputs().getSymbols());
}
it.unimi.dsi.compressionHuffmanCodeccodeWords

Popular methods of HuffmanCodec

  • <init>
    Creates a new Huffman codec using the given vector of frequencies.
  • coder
  • newCoder
    (Re-)constructs the canonical huffman code from the shortest code word, the non-decreasing bit lengt
  • decoder
  • intArray2LongArray

Popular in Java

  • Running tasks concurrently on multiple threads
  • getResourceAsStream (ClassLoader)
  • compareTo (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now