Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PartialSum ¶
type PartialSum interface { // Increment add V[ind] += val // ind should hold ind >= KeysNum IncTail(ind uint64, val uint64) // KeysNum returns the number of vals Num() uint64 // AllSum returns the sum of all vals AllSum() uint64 // Lookup returns V[i] in O(1) time Lookup(ind uint64) (val uint64) // Sum returns V[0]+V[1]+...+V[ind-1] in O(1) time Sum(ind uint64) (sum uint64) // Lookup returns V[i] and V[0]+V[1]+...+V[i-1] in O(1) time LookupAndSum(ind uint64) (val uint64, sum uint64) // Find returns ind satisfying Sum(ind) <= val < Sum(ind+1) // and val - Sum(ind). If there are multiple inds // satisfiying this condition, return the minimum one. Find(val uint64) (ind uint64, offset uint64) // MarshalBinary encodes VecString into a binary form and returns the result. MarshalBinary() ([]byte, error) // UnmarshalBinary decodes the FixVec form a binary from generated MarshalBinary UnmarshalBinary([]byte) error }
PartialSum stores non-negative integers V[0...N) and supports Sum, Find in O(1) time using at most (S + N) bits where S is the sum of V[0...N)
func New ¶
func New() PartialSum
Click to show internal directories.
Click to hide internal directories.