public class LogLog extends Object implements ICardinality
Modifier and Type | Class and Description |
---|---|
static class |
LogLog.Builder |
protected static class |
LogLog.LogLogMergeException |
Modifier and Type | Field and Description |
---|---|
protected double |
Ca |
protected int |
k |
protected int |
m |
protected byte[] |
M |
protected static double[] |
mAlpha
Gamma function computed using Mathematica
AccountingForm[
N[With[{m = 2^Range[0, 31]},
m (Gamma[-1/m]*(1 - 2^(1/m))/Log[2])^-m], 14]]
|
protected int |
Rsum |
Modifier and Type | Method and Description |
---|---|
long |
cardinality() |
byte[] |
getBytes() |
ICardinality |
merge(ICardinality... estimators)
Merges estimators to produce a new estimator for the combined streams
of this estimator and those passed as arguments.
|
static LogLog |
mergeEstimators(LogLog... estimators)
Merges estimators to produce an estimator for their combined streams
|
boolean |
offer(Object o) |
boolean |
offerHashed(int hashedInt)
Offer the value as a hashed long value
|
boolean |
offerHashed(long hashedLong)
Offer the value as a hashed long value
|
protected static int |
rho(int x,
int k)
Computes the position of the first set bit of the last Integer.SIZE-k bits
|
int |
sizeof() |
protected static final double[] mAlpha
protected final int k
protected int m
protected double Ca
protected byte[] M
protected int Rsum
public byte[] getBytes()
getBytes
in interface ICardinality
public int sizeof()
sizeof
in interface ICardinality
public long cardinality()
cardinality
in interface ICardinality
public boolean offerHashed(long hashedLong)
ICardinality
offerHashed
in interface ICardinality
hashedLong
- - the hash of the item to offer to the estimatorpublic boolean offerHashed(int hashedInt)
ICardinality
offerHashed
in interface ICardinality
hashedInt
- - the hash of the item to offer to the estimatorpublic boolean offer(Object o)
offer
in interface ICardinality
o
- stream elementprotected static int rho(int x, int k)
public ICardinality merge(ICardinality... estimators) throws LogLog.LogLogMergeException
ICardinality
merge
in interface ICardinality
estimators
- Zero or more compatible estimatorsLogLog.LogLogMergeException
- if estimators are not mergeable (all estimators must be instances of LogLog of the same size)public static LogLog mergeEstimators(LogLog... estimators) throws LogLog.LogLogMergeException
estimators
- LogLog.LogLogMergeException
- if estimators are not mergeable (all estimators must be the same size)Copyright © 2019. All rights reserved.