Constructor and Description |
---|
PrefixSumImpl(double[] sum)
The ctor.
|
Modifier and Type | Method and Description |
---|---|
double |
get(int i)
The sum of weights up to item i, i.e., t_0 + t_1 + ...
|
double[] |
getArray()
The underlying core prefix-summed array.
|
double |
getAt(int p)
returns the actual value of the item at p.
|
double[] |
getOriginalValues()
The actual values.
|
double |
getSum()
sum of all items.
|
double |
getSum(int i,
int j)
Get a partial of the range (j, i], i.e.
|
int |
search(double v)
search for the prefix sum value.
|
int |
searchGreaterThan(double v)
returns the index of the smallest index that has a prefix sum not smaller than v.
|
int |
searchLessThan(double v)
returns the index of the largest index that has a prefix sum not larger than v.
|
int |
size()
The number of tasks.
|
java.lang.String |
toString() |
public PrefixSumImpl(double[] sum)
sum
- the prefix-summed array.public int size()
PrefixSum
public double get(int i)
PrefixSum
public double getSum(int i, int j)
PrefixSum
public double getSum()
PrefixSum
public int search(double v)
PrefixSum
public int searchLessThan(double v)
PrefixSum
searchLessThan
in interface PrefixSum
v
- the prefix sum value to be searched.public int searchGreaterThan(double v)
PrefixSum
searchGreaterThan
in interface PrefixSum
v
- the prefix sum value to be searched.public double getAt(int p)
PrefixSum
public double[] getArray()
PrefixSum
public double[] getOriginalValues()
PrefixSum
getOriginalValues
in interface PrefixSum
public java.lang.String toString()
toString
in class java.lang.Object