# Class ThetaUtil

java.lang.Object
org.apache.datasketches.thetacommon.ThetaUtil

public final class ThetaUtil extends Object
Utility methods for the Theta Family of sketches

Author:
  Lee Rhodes

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DEFAULT_NOMINAL_ENTRIES`
The default nominal entries is provided as a convenience for those cases where the nominal sketch size in number of entries is not provided.
`static final int`
`MAX_LG_NOM_LONGS`
The largest Log2 nom entries allowed: 26.
`static final int`
`MIN_LG_ARR_LONGS`
The smallest Log2 cache size allowed: 5.
`static final int`
`MIN_LG_NOM_LONGS`
The smallest Log2 nom entries allowed: 4.
`static final double`
`REBUILD_THRESHOLD`
The hash table rebuild threshold = 15.0/16.0.
`static final double`
`RESIZE_THRESHOLD`
The resize threshold = 0.5; tuned for speed.

## Method Summary

Modifier and Type
Method
Description
`static int`
`checkNomLongs(int nomLongs)`
Checks that the given nomLongs is within bounds and returns the Log2 of the ceiling power of 2 of the given nomLongs.
`static int`
`startingSubMultiple(int lgTarget, int lgRF, int lgMin)`
Gets the smallest allowed exponent of 2 that it is a sub-multiple of the target by zero, one or more resize factors.

### Methods inherited from class Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### MIN_LG_NOM_LONGS

public static final int MIN_LG_NOM_LONGS
The smallest Log2 nom entries allowed: 4.

See Also:
  - Constant Field Values

### MAX_LG_NOM_LONGS

public static final int MAX_LG_NOM_LONGS
The largest Log2 nom entries allowed: 26.

See Also:
  - Constant Field Values

### REBUILD_THRESHOLD

public static final double REBUILD_THRESHOLD
The hash table rebuild threshold = 15.0/16.0.

See Also:
  - Constant Field Values

### RESIZE_THRESHOLD

public static final double RESIZE_THRESHOLD
The resize threshold = 0.5; tuned for speed.

See Also:
  - Constant Field Values

### DEFAULT_NOMINAL_ENTRIES

public static final int DEFAULT_NOMINAL_ENTRIES
The default nominal entries is provided as a convenience for those cases where the nominal sketch size in number of entries is not provided. A sketch of 4096 entries has a Relative Standard Error (RSE) of +/- 1.56% at a confidence of 68%; or equivalently, a Relative Error of +/- 3.1% at a confidence of 95.4%. See Default Nominal Entries

See Also:
  - Constant Field Values

### MIN_LG_ARR_LONGS

public static final int MIN_LG_ARR_LONGS
The smallest Log2 cache size allowed: 5.

See Also:
  - Constant Field Values

## Method Details

### startingSubMultiple

public static int startingSubMultiple(int lgTarget, int lgRF, int lgMin)
Gets the smallest allowed exponent of 2 that it is a sub-multiple of the target by zero, one or more resize factors.

Parameters:
  `lgTarget` - Log2 of the target size
  `lgRF` - Log_base2 of Resize Factor. See Resize Factor
  `lgMin` - Log2 of the minimum allowed starting size
Returns:
  The Log2 of the starting size

### checkNomLongs

public static int checkNomLongs(int nomLongs)
Checks that the given nomLongs is within bounds and returns the Log2 of the ceiling power of 2 of the given nomLongs.

Parameters:
  `nomLongs` - the given number of nominal longs. This can be any value from 16 to 67108864, inclusive.
Returns:
  The Log2 of the ceiling power of 2 of the given nomLongs.