diff --git a/adix.html b/adix.html new file mode 100644 index 0000000..61608f7 --- /dev/null +++ b/adix.html @@ -0,0 +1,86 @@ + + + + + + + +adix + + + + + + + + + + + + +
+
+

adix

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+ +
+ + +
+
+ + + + + + diff --git a/adix.idx b/adix.idx new file mode 100644 index 0000000..dd8e89d --- /dev/null +++ b/adix.idx @@ -0,0 +1 @@ +nimTitle adix adix.html module adix 0 diff --git a/adix/althash.html b/adix/althash.html new file mode 100644 index 0000000..12e0936 --- /dev/null +++ b/adix/althash.html @@ -0,0 +1,485 @@ + + + + + + + +adix/althash + + + + + + + + + + + + +
+
+

adix/althash

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This module provides several alternative hashes to the Nim stdlib targeting high entropy in low order bits for and mask conversion to a table index. Activate via e.g., proc hash(x: K): Hash {.inline.} = hashRoMu1(x), where K is your integer key type.

+

The fastest hash used here is a likely the multiply & rotate hash (lately called a "Fibonacci hash", after Knuth's golden ratio fascination. Knuth immediately, in context, shows it works for any irrational number and then computer arithmetic is finite anyway). This propagates entropy in key bits to the double-width product in a Pascal's Binomial Triangle sort of pattern. Middle bits have the most key related entropy (there is even a PRNG method called "middle square" based on this pattern). More specifically, consider the product of a pair of 2 digit decimal numbers: (a1*10+a0)*(b1*10+b0) = a1*b1*100 + (a1*b0+b0*a1)*10 + a0*b0. This shows the "triangle" kind of pattern that makes the mixing strongest in the middle.

+

The full product is easily accessed for half CPU register width and narrower numbers. For the widest integer type, C/backend arithmetic rules only give the modulus|lower order bits of said product (x86/amd64 does make the upper word available in another register). hashRoMu1 takes the simple portable way out and discards half of key entropy, just rotating down the more well mixed bits (bit reversal might be better, though expensive compared to rotr). Reducing hash codes to table address via shr is another way out. Getting high order avalanche is more natural than the low order avalanche needed for and mask, both may be https://burtleburtle.net/bob/hash/integer.html's "half avalanche". Anyway, rotating is portably fast (often 1 cycle latency, 1-per cycle tput for an immediate constant number of bits). Bit reversal is not so slow using a fully unrolled loop and 16 entry nibble lookup table. Different hashes will perform more/less well on different data. So, we just provide a few here, and one is based upon highly non-linear bit reversal.

+

A stronger hash is hashWangYi1 which passes SMHasher's entropy tests, but "funnels" 64 inputs into about 62-bits of output entropy. It is still the default Hash-rehasher since it is fast & tables with 2^62 entries are rare. WangYi1's primitive is the xor of the high & low parts of a double-width product of a salt with a key. The xor blends well-mixed low order bits of the high output product word with less well-mixed low order bits of the low output product word, yielding "mostly level" mixing across all bits of the hash. WangYi1 takes two rounds of such mixing to achieve avalanche. It may be possible to "nearly pass" in only one round. hashWY0 is one attempt at that, but the salt may need to be re-optimized to have any hope of doing well on SMHasher. This hash became the default hash(int) in Nim stdlib.

+

There is a motley selection of other hashes here. The strongest fast hash is Pelle Evensen's bijective (64-bits -> 64-bits) hashNASAM. It's 2-3x slower than WangYi1 on some CPU architectures, but has no known statistical flaws.

+

Incidentally, most "fast in GB/s" hashes are far too slow for just one int. Even assessing them so is misleading for lookup tables. You want time =~ a + b*nBytes where a & b maybe come from line regressions. 1/b alone says too little, especially for integer keys where a dominates. Short string hashes or a alone can similarly mislead. TLDR, want >=2 "summary numbers" not one & whole curves are best.

+

+
+

Imports

+
+ bitop +
+
+
+

Vars

+
+
+
getSalt = vmaddrSalt
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc hash(hsh, salt: Hash): Hash {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hashDegski[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + https://gist.github.com/degski/6e2069d6035ae04d5d6f64981c995ec2 + Source   +Edit   + +
+
+ +
+
+
+
proc hashIdentity[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hashMoreMur[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + This is from https://github.com/tommyettinger + Source   +Edit   + +
+
+ +
+
+
+
proc hashNASAM[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hashRevFib(x: int32 | uint32): Hash {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc hashRevFib(x: int64 | uint64): Hash {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc hashRevFib(x: uint): Hash {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hashRoMu1(x: SomeOrdinal | Hash): Hash {.inline.}
+
+ + 1-hop of Romul-DuoJr using x as seed + Source   +Edit   + +
+
+
+
proc hashRoMu1(x: uint): Hash {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hashRoMu2(x: SomeOrdinal | Hash): Hash {.inline.}
+
+ + Just the cross terms of 128-bit whole product + Source   +Edit   + +
+
+ +
+
+
+
proc hashSplit64[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + https://nullprogram.com/blog/2018/07/31/ + Source   +Edit   + +
+
+ +
+
+
+
proc hashSplitMix[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + This is one hop of a PRNG. For more information on the PRNG part see http://docs.oracle.com/javase/8/docs/api/java/util/SplittableRandom.html + Source   +Edit   + +
+
+ +
+
+
+
proc hashWangYi1[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + Wang Yi's hash_v1 for 8B int. https://github.com/rurban/smhasher has more details. This passed all scrambling tests in Spring 2019 and is simple. NOTE: It's ok to define proc(x:int16): Hash=hashWangYi1(cast[Hash](x)). + Source   +Edit   + +
+
+ +
+
+
+
proc hashWY0[T: Ordinal | enum](x: T): Hash {.inline.}
+
+ + A slightly simplified/early version of Wang Yi's hash for 8B ints. Faster, but less scrambling. Definitely has some easy weak spots. + Source   +Edit   + +
+
+ +
+
+
+
proc normalized[T](x: openArray[T]): seq[float]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc raiseNotFound[K](key: K)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc secureSalt(x: pointer): Hash {.inline, ...raises: [OSError], tags: [],
+                                    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc vmaddrSalt(x: pointer): Hash {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc zeroSalt(x: pointer): Hash {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template dbg(x)
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/althash.idx b/adix/althash.idx new file mode 100644 index 0000000..aaaea6d --- /dev/null +++ b/adix/althash.idx @@ -0,0 +1,25 @@ +nimTitle althash adix/althash.html module adix/althash 0 +nim hashRoMu1 adix/althash.html#hashRoMu1 proc hashRoMu1(x: SomeOrdinal | Hash): Hash 58 +nim hashRoMu2 adix/althash.html#hashRoMu2 proc hashRoMu2(x: SomeOrdinal | Hash): Hash 62 +nim hashWangYi1 adix/althash.html#hashWangYi1,T proc hashWangYi1[T: Ordinal | enum](x: T): Hash 125 +nim hashWY0 adix/althash.html#hashWY0,T proc hashWY0[T: Ordinal | enum](x: T): Hash 154 +nim hashMoreMur adix/althash.html#hashMoreMur,T proc hashMoreMur[T: Ordinal | enum](x: T): Hash 162 +nim hashNASAM adix/althash.html#hashNASAM,T proc hashNASAM[T: Ordinal | enum](x: T): Hash 172 +nim hashIdentity adix/althash.html#hashIdentity,T proc hashIdentity[T: Ordinal | enum](x: T): Hash 184 +nim hashSplitMix adix/althash.html#hashSplitMix,T proc hashSplitMix[T: Ordinal | enum](x: T): Hash 186 +nim hashSplit64 adix/althash.html#hashSplit64,T proc hashSplit64[T: Ordinal | enum](x: T): Hash 194 +nim hashDegski adix/althash.html#hashDegski,T proc hashDegski[T: Ordinal | enum](x: T): Hash 204 +nim hashRevFib adix/althash.html#hashRevFib proc hashRevFib(x: int32 | uint32): Hash 214 +nim hashRevFib adix/althash.html#hashRevFib_2 proc hashRevFib(x: int64 | uint64): Hash 217 +nim secureSalt adix/althash.html#secureSalt,pointer proc secureSalt(x: pointer): Hash 221 +nim vmaddrSalt adix/althash.html#vmaddrSalt,pointer proc vmaddrSalt(x: pointer): Hash 225 +nim zeroSalt adix/althash.html#zeroSalt,pointer proc zeroSalt(x: pointer): Hash 229 +nim getSalt adix/althash.html#getSalt var getSalt 234 +nim hashRoMu1 adix/althash.html#hashRoMu1,uint proc hashRoMu1(x: uint): Hash 237 +nim hashRevFib adix/althash.html#hashRevFib,uint proc hashRevFib(x: uint): Hash 238 +nim hash adix/althash.html#hash,Hash,Hash proc hash(hsh, salt: Hash): Hash 243 +nim dbg adix/althash.html#dbg.t template dbg(x) 248 +nim raiseNotFound adix/althash.html#raiseNotFound,K proc raiseNotFound[K](key: K) 251 +nim normalized adix/althash.html#normalized,openArray[T] proc normalized[T](x: openArray[T]): seq[float] 257 +nimgrp hashromu1 adix/althash.html#hashRoMu1-procs-all proc 58 +nimgrp hashrevfib adix/althash.html#hashRevFib-procs-all proc 214 diff --git a/adix/amoft.html b/adix/amoft.html new file mode 100644 index 0000000..92f431b --- /dev/null +++ b/adix/amoft.html @@ -0,0 +1,222 @@ + + + + + + + +adix/amoft + + + + + + + + + + + + +
+
+

adix/amoft

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

Approximately k-Most Oft. This is constant space & constant inc&query time with adjustably small error. AMOft[K,C] augments the sketch with an O(k) paired Table & HeapQueue. Present impl does NOT scale well to very large k (past ~top-1000). E.g.:

var amo = initAMOft[int, uint32](k=10)
+for i in 0..<500: amo.inc i, i # Not v.skewed => not v.accurate
+for (i, c) in amo.mostCommon(5): echo i, " ", c

+
+

Types

+
+
+
AMOft[K; C] = object
+
+ + Track most often hashable K with counters C. + Source   +Edit   + +
+
+
+
CtMnSketch[K; C] = object
+
+ + CountMinSketch over hashable K & counters C. + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc inc[K, C](a: var AMOft[K, C]; key: K; r = 1)
+
+ + Count key as being seen r times. + Source   +Edit   + +
+
+
+
proc inc[K, C](cs: var CtMnSketch[K, C]; key: K; r = 1): C {.discardable.}
+
+ + Count key r times; Gives new counts; I.e., (key, r=0) can query. + Source   +Edit   + +
+
+ +
+
+
+
proc initAMOft[K, C](k, w: int; d = 4; salts: seq[int] = @[]): AMOft[K, C]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc initCtMnSketch[K, C](w: int; d = 4; salts: seq[int] = @[]): CtMnSketch[K, C]
+
+ + w=Size(count tables), larger implies less overestimation. d=nTables, larger implies less P(overEst). salts=Override default generated salts. + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator mostCommon[K, C](a: AMOft[K, C]; k = 0): (K, C)
+
+ + Yield (k-most common values in a, each count) tuples; k<=0 => known. + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/amoft.idx b/adix/amoft.idx new file mode 100644 index 0000000..ad5e05e --- /dev/null +++ b/adix/amoft.idx @@ -0,0 +1,9 @@ +nimTitle amoft adix/amoft.html module adix/amoft 0 +nim CtMnSketch adix/amoft.html#CtMnSketch object CtMnSketch 13 +nim AMOft adix/amoft.html#AMOft object AMOft 18 +nim initCtMnSketch adix/amoft.html#initCtMnSketch,int,int,seq[int] proc initCtMnSketch[K, C](w: int; d = 4; salts: seq[int] = @[]): CtMnSketch[K, C] 25 +nim inc adix/amoft.html#inc,CtMnSketch[K,C],K,int proc inc[K, C](cs: var CtMnSketch[K, C]; key: K; r = 1): C 38 +nim initAMOft adix/amoft.html#initAMOft,int,int,int,seq[int] proc initAMOft[K, C](k, w: int; d = 4; salts: seq[int] = @[]): AMOft[K, C] 58 +nim inc adix/amoft.html#inc,AMOft[K,C],K,int proc inc[K, C](a: var AMOft[K, C]; key: K; r = 1) 68 +nim mostCommon adix/amoft.html#mostCommon.i,AMOft[K,C],int iterator mostCommon[K, C](a: AMOft[K, C]; k = 0): (K, C) 87 +nimgrp inc adix/amoft.html#inc-procs-all proc 38 diff --git a/adix/bist.html b/adix/bist.html new file mode 100644 index 0000000..9976ba8 --- /dev/null +++ b/adix/bist.html @@ -0,0 +1,433 @@ + + + + + + + +adix/bist + + + + + + + + + + + + +
+
+

adix/bist

+
+ +
+ Source   +Edit   + +
+ +

Binary Indexed Sum Tree (BIST); Invented by P.Fenwick in 1994. { Fenwick proposed "BIT" but that A) collides with many uses, B) takes partial sums as implied, but explicit is better (though products could work), and C) does not rhyme with "dist" (for distribution, which is what this is mostly about). } While the Internet has many tutorials, to my knowledge, no one (yet) collects these algorithms all in one place. Fenwick1994 itself messed up on what we here call invCDF, correcting with a tech report a year later. This implementation is also careful to only allocate needed space/handle [0].

+

The basic idea of a standard binary heap with kids(k)@[2k],[2k+1] for dynamic distributions goes back to Wong&Easton 1980 (or earlier?). Fenwick's clever index encoding/overlaid trees trick allows using 1/4 to 1/2 that space (only max index+1 array elements vs 2*lgCeil(n)). Meaningful explanations really need figures as in the original Fenwick paper or another take over at https://notes.tweakblogs.net/blog/9835/fenwick-trees-demystified.html.

+

The Bist[T] type in this module is generic over the type of counters used for partial sums|counts. For few total items, you can use a Bist[uint8] while for many you want to use Bist[uint32]. This can be space-optimized up to 2X further with a sequint specialized to store an array of B-bit counters. Also, ranked B-trees start being faster for >28-bit index spaces.

+

+
+

Imports

+
+ xlang, bitop +
+
+
+

Types

+
+
+
Bist[T] = object
+
+ + A razor thin wrapper around seq[T] + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc `[]`[T](t: Bist[T]; i: int): T {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc `[]`[T](t: var Bist[T]; i: int): var T {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]=`[T](t: var Bist[T]; i: int; x: T) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc cdf[T](t: Bist[T]; i: int): T {.inline.}
+
+ + Inclusive sum(pmf[0..i]), (rank,EDF,prefix sum,scan,..); Tm~1 bits in i + Source   +Edit   + +
+
+ +
+
+
+
proc clear[T](t: var Bist[T]) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc count[T](t: Bist[T]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc fromCnts[T](t: var Bist[T])
+
+ + In-place bulk convert/reformat t[] from counts to BIST; Max time ~1*n. + Source   +Edit   + +
+
+ +
+
+
+
proc inc[T](t: var Bist[T]; i, d: SomeInteger) {.inline.}
+
+ + Adjust for count update; Eg. inc(T,i,-1) decs count@i; Tm ~ 1/2..3/4 lg n + Source   +Edit   + +
+
+ +
+
+
+
proc initBist[T](len: int): Bist[T] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc invCDF[T](t: Bist[T]; s: T; s0, s1: var T): int {.inline.}
+
+ + Find i0,s0,s1 in sum(i0..i?)==s1; s0+pmf(i0)==s1 for 0<s<=tot. + Source   +Edit   + +
+
+
+
proc invCDF[T](t: Bist[T]; s: T; s0: var T): int {.inline.}
+
+ + Find i0,s0 when sum(i0..i?)==s1; s0+pmf(i0)==s1 for 0<s<=tot in lgCeil(n) array probes. (sum jumps from s0@i0-1 to s1@i0). + Source   +Edit   + +
+
+ +
+
+
+
proc len[T](t: Bist[T]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc max[T](t: Bist[T]): int {.inline.}
+
+ + Convenience wrapper returning invCDF(t, t.count). + Source   +Edit   + +
+
+ +
+
+
+
proc min[T](t: Bist[T]): int {.inline.}
+
+ + Convenience wrapper returning invCDF(t, 1) + Source   +Edit   + +
+
+ +
+
+
+
proc pmf[T](t: Bist[T]; i: int): T {.inline.}
+
+ + Probability Mass Function @i; Avg Tm ~ 2 probes; Max Tm ~ lg n + Source   +Edit   + +
+
+ +
+
+
+
proc quantile[T](t: Bist[T]; q: float): float {.inline.}
+
+ + Parzen-interpolated quantile when no caller index mapping is needed + Source   +Edit   + +
+
+
+
proc quantile[T](t: Bist[T]; q: float; iL, iH: var int): float {.inline.}
+
+ + Parzen-interpolated quantile; E.g., q=0.9 => 90th percentile. answer = result*iL + (1-result)*iH, but is left to caller to do { in case it is mapping larger numeric ranges to/from iL,iH }. Tm ~ 2*lg(addrSpace). Unlike other (broken!) quantile-interpolation methods, Parzen's connects midpoints of vertical CDF jumps, not horizontal. This makes far more sense with ties, corresponding to age-old "tie mid-ranking" recommendations. + Source   +Edit   + +
+
+ +
+
+
+
func space[T](t: Bist[T]): int
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc toCnts[T](t: var Bist[T])
+
+ + In-place bulk convert/reformat t[] from BIST to counts; Max time ~1n *Unlike the others, this routine only works for power of 2-sized arrays. + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/bist.idx b/adix/bist.idx new file mode 100644 index 0000000..3a66f67 --- /dev/null +++ b/adix/bist.idx @@ -0,0 +1,24 @@ +nimTitle bist adix/bist.html module adix/bist 0 +nim Bist adix/bist.html#Bist object Bist 25 +nim initBist adix/bist.html#initBist,int proc initBist[T](len: int): Bist[T] 29 +nim len adix/bist.html#len,Bist[T] proc len[T](t: Bist[T]): int 30 +nim space adix/bist.html#space,Bist[T] proc space[T](t: Bist[T]): int 31 +nim count adix/bist.html#count,Bist[T] proc count[T](t: Bist[T]): int 32 +nim `[]` adix/bist.html#[],Bist[T],int proc `[]`[T](t: Bist[T]; i: int): T 33 +nim `[]` adix/bist.html#[],Bist[T],int_2 proc `[]`[T](t: var Bist[T]; i: int): var T 34 +nim `[]=` adix/bist.html#[]=,Bist[T],int,T proc `[]=`[T](t: var Bist[T]; i: int; x: T) 35 +nim clear adix/bist.html#clear,Bist[T] proc clear[T](t: var Bist[T]) 36 +nim inc adix/bist.html#inc,Bist[T],SomeInteger,SomeInteger proc inc[T](t: var Bist[T]; i, d: SomeInteger) 39 +nim cdf adix/bist.html#cdf,Bist[T],int proc cdf[T](t: Bist[T]; i: int): T 45 +nim pmf adix/bist.html#pmf,Bist[T],int proc pmf[T](t: Bist[T]; i: int): T 50 +nim fromCnts adix/bist.html#fromCnts,Bist[T] proc fromCnts[T](t: var Bist[T]) 56 +nim toCnts adix/bist.html#toCnts,Bist[T] proc toCnts[T](t: var Bist[T]) 65 +nim invCDF adix/bist.html#invCDF,Bist[T],T,T proc invCDF[T](t: Bist[T]; s: T; s0: var T): int 72 +nim invCDF adix/bist.html#invCDF,Bist[T],T,T,T proc invCDF[T](t: Bist[T]; s: T; s0, s1: var T): int 83 +nim min adix/bist.html#min,Bist[T] proc min[T](t: Bist[T]): int 88 +nim max adix/bist.html#max,Bist[T] proc max[T](t: Bist[T]): int 93 +nim quantile adix/bist.html#quantile,Bist[T],float,int,int proc quantile[T](t: Bist[T]; q: float; iL, iH: var int): float 98 +nim quantile adix/bist.html#quantile,Bist[T],float proc quantile[T](t: Bist[T]; q: float): float 126 +nimgrp quantile adix/bist.html#quantile-procs-all proc 98 +nimgrp invcdf adix/bist.html#invCDF-procs-all proc 72 +nimgrp [] adix/bist.html#[]-procs-all proc 33 diff --git a/adix/bitop.html b/adix/bitop.html new file mode 100644 index 0000000..f3dc910 --- /dev/null +++ b/adix/bitop.html @@ -0,0 +1,294 @@ + + + + + + + +adix/bitop + + + + + + + + + + + + +
+
+

adix/bitop

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This is a reimplementation of some things we need from bitops which has CT trouble due to importc's. (I feel it's a better naming/factoring, too).

+
+

Procs

+
+
+
+
proc ceilPow2(x: int): int {.noSideEffect, inline, ...raises: [], tags: [],
+                             forbids: [].}
+
+ + Returns x rounded up to the nearest power of two. <= 0 get 1. + Source   +Edit   + +
+
+ +
+
+
+
proc floorPow2(x: int): int {.noSideEffect, inline, ...raises: [], tags: [],
+                              forbids: [].}
+
+ + Returns x rounded down to the nearest power of two. + Source   +Edit   + +
+
+ +
+
+
+
proc isPow2(x: int): bool {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc lg(x: int): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + short alias for lgCeil + Source   +Edit   + +
+
+ +
+
+
+
proc lgCeil(x: int): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + integer-math only impl of ceil(log2(x)) + Source   +Edit   + +
+
+ +
+
+
+
proc lgFloor(x: int): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + integer-math only impl of floor(log2(x)) + Source   +Edit   + +
+
+ +
+
+
+
proc lgPow2(x: int): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc reverseBits(x: uint32): uint32 {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc reverseBits(x: uint64): uint64 {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc reverseBitsByte(x: uint8): uint8 {.inline, ...raises: [], tags: [],
+                                        forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc rotateLeftBits(a: uint64; numBits: int): uint64 {.inline, ...raises: [],
+    tags: [], forbids: [].}
+
+ + like bitops + Source   +Edit   + +
+
+ +
+
+
+
proc rotateRightBits(a: uint64; numBits: int): uint64 {.inline, ...raises: [],
+    tags: [], forbids: [].}
+
+ + like bitops + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/bitop.idx b/adix/bitop.idx new file mode 100644 index 0000000..30da42c --- /dev/null +++ b/adix/bitop.idx @@ -0,0 +1,14 @@ +nimTitle bitop adix/bitop.html module adix/bitop 0 +nim ceilPow2 adix/bitop.html#ceilPow2,int proc ceilPow2(x: int): int 4 +nim floorPow2 adix/bitop.html#floorPow2,int proc floorPow2(x: int): int 17 +nim lgPow2 adix/bitop.html#lgPow2,int proc lgPow2(x: int): int 40 +nim lgCeil adix/bitop.html#lgCeil,int proc lgCeil(x: int): int 46 +nim lgFloor adix/bitop.html#lgFloor,int proc lgFloor(x: int): int 50 +nim lg adix/bitop.html#lg,int proc lg(x: int): int 54 +nim rotateLeftBits adix/bitop.html#rotateLeftBits,uint64,int proc rotateLeftBits(a: uint64; numBits: int): uint64 58 +nim rotateRightBits adix/bitop.html#rotateRightBits,uint64,int proc rotateRightBits(a: uint64; numBits: int): uint64 62 +nim reverseBitsByte adix/bitop.html#reverseBitsByte,uint8 proc reverseBitsByte(x: uint8): uint8 66 +nim reverseBits adix/bitop.html#reverseBits,uint32 proc reverseBits(x: uint32): uint32 79 +nim reverseBits adix/bitop.html#reverseBits,uint64 proc reverseBits(x: uint64): uint64 85 +nim isPow2 adix/bitop.html#isPow2,int proc isPow2(x: int): bool 95 +nimgrp reversebits adix/bitop.html#reverseBits-procs-all proc 79 diff --git a/adix/bltab.html b/adix/bltab.html new file mode 100644 index 0000000..a19ca30 --- /dev/null +++ b/adix/bltab.html @@ -0,0 +1,530 @@ + + + + + + + +adix/bltab + + + + + + + + + + + + +
+
+

adix/bltab

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This module specializes to the case where keys are 1..k-bit ints & values are 0..v-bit ints (k+v<=8*int.sizeof) using one SeqUInt as backing store. (Mnemonically, "BL" = "Bit Level" or start of "BLoom Filter", a sometimes competing data structure.) Users must give a number of bits for the key. Bits for values and the sentinel key default to 0. BLTab otherwise tries to be similar to hash variants of multisets.

+
+

Imports

+
+ althash, sequint +
+
+
+

Types

+
+
+
BLTab = object
+
+ + RobinHoodLP set of B-bit int keys w/small false pos. rate + Source   +Edit   + +
+
+ +
+
+
+

Vars

+
+
+
blDenom = 1'u8
+
+ + default denominator for lg(n) probe depth limit + Source   +Edit   + +
+
+
+
blGrowPow2 = 1'u8
+
+ + default growth power of 2; 1 means double + Source   +Edit   + +
+
+
+
blInitialSize = 2
+
+ + default initial size aka capacity aka cap + Source   +Edit   + +
+
+
+
blMinFree = 1'u8
+
+ + default min free slots; (>= 1) + Source   +Edit   + +
+
+
+
blNumer = 3'u8
+
+ + default numerator for lg(n) probe depth limit + Source   +Edit   + +
+
+
+
blRehash = false
+
+ + default hcode rehashing behavior; auto-activated + Source   +Edit   + +
+
+
+
blRobinHood = false
+
+ + default to Robin Hood re-org; auto-activated + Source   +Edit   + +
+
+
+
blSentinel = 0'u8
+
+ + default sentinel value for k+v-bit uint + Source   +Edit   + +
+
+
+
blValueBits = 0'u8
+
+ + default bits for value in k+v-bit uint + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc clear(s: var BLTab) {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc contains(s: BLTab; hc: Hash): bool {.inline, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc containsOrIncl(s: var BLTab; hc: Hash): bool {.inline,
+    ...raises: [ResourceExhaustedError], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc debugDump(s: BLTab; label = "") {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc depths(s: BLTab): seq[int] {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getCap(s: BLTab): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc init(s: var BLTab; size, mask: int) {.inline, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc initBLTab(size, mask: int): BLTab {.inline, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc len(s: BLTab): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc load(t: var BLTab; path: string) {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc loadBLTab(path: string): BLTab {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc missingOrExcl(s: var BLTab; hc: Hash): bool {.inline, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc mmap(t: var BLTab; path: string) {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc save(t: BLTab; pathStub: string) {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator items(s: BLTab): Hash {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator pairs(s: BLTab): tuple[a: int, b: Hash] {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/bltab.idx b/adix/bltab.idx new file mode 100644 index 0000000..39704cc --- /dev/null +++ b/adix/bltab.idx @@ -0,0 +1,27 @@ +nimTitle bltab adix/bltab.html module adix/bltab 0 +nim BLTab adix/bltab.html#BLTab object BLTab 11 +nim blInitialSize adix/bltab.html#blInitialSize var blInitialSize 19 +nim blValueBits adix/bltab.html#blValueBits var blValueBits 20 +nim blSentinel adix/bltab.html#blSentinel var blSentinel 21 +nim blNumer adix/bltab.html#blNumer var blNumer 22 +nim blDenom adix/bltab.html#blDenom var blDenom 23 +nim blMinFree adix/bltab.html#blMinFree var blMinFree 24 +nim blGrowPow2 adix/bltab.html#blGrowPow2 var blGrowPow2 25 +nim blRobinHood adix/bltab.html#blRobinHood var blRobinHood 26 +nim blRehash adix/bltab.html#blRehash var blRehash 27 +nim len adix/bltab.html#len,BLTab proc len(s: BLTab): int 38 +nim getCap adix/bltab.html#getCap,BLTab proc getCap(s: BLTab): int 39 +nim save adix/bltab.html#save,BLTab,string proc save(t: BLTab; pathStub: string) 41 +nim load adix/bltab.html#load,BLTab,string proc load(t: var BLTab; path: string) 42 +nim loadBLTab adix/bltab.html#loadBLTab,string proc loadBLTab(path: string): BLTab 43 +nim mmap adix/bltab.html#mmap,BLTab,string proc mmap(t: var BLTab; path: string) 44 +nim init adix/bltab.html#init,BLTab,int,int proc init(s: var BLTab; size, mask: int) 126 +nim initBLTab adix/bltab.html#initBLTab,int,int proc initBLTab(size, mask: int): BLTab 130 +nim contains adix/bltab.html#contains,BLTab,Hash proc contains(s: BLTab; hc: Hash): bool 132 +nim containsOrIncl adix/bltab.html#containsOrIncl,BLTab,Hash proc containsOrIncl(s: var BLTab; hc: Hash): bool 136 +nim missingOrExcl adix/bltab.html#missingOrExcl,BLTab,Hash proc missingOrExcl(s: var BLTab; hc: Hash): bool 148 +nim clear adix/bltab.html#clear,BLTab proc clear(s: var BLTab) 158 +nim items adix/bltab.html#items.i,BLTab iterator items(s: BLTab): Hash 162 +nim pairs adix/bltab.html#pairs.i,BLTab iterator pairs(s: BLTab): tuple[a: int, b: Hash] 168 +nim depths adix/bltab.html#depths,BLTab proc depths(s: BLTab): seq[int] 176 +nim debugDump adix/bltab.html#debugDump,BLTab,string proc debugDump(s: BLTab; label = "") 182 diff --git a/adix/btree.html b/adix/btree.html new file mode 100644 index 0000000..339a924 --- /dev/null +++ b/adix/btree.html @@ -0,0 +1,212 @@ + + + + + + + +adix/btree + + + + + + + + + + + + +
+
+

adix/btree

+
+ +
+ Source   +Edit   + +
+ +

I know of no other as-simple/general FOSS B-Tree (in any prog.langs|books). Theory people recurse; DB code clutters w/sync; Other APIs are less general. Correct me if I am wrong/cite this if it be your starting point. Little effort is made to explain these algos in comments as it's impractical to cram a course into this file with no figures. More details & resources are at https://en.wikipedia.org/wiki/B-tree or in Graefe & Kuno 2011.

+

This module defines a template that defines procs on a pretty general B-Tree. The tree can be positional-only, keyed-only or keyed-ranked, be either set of keyed rows or (key,value)-style, have its nodes allocated in any way (via abstract ptrs & deref, eg. on disk via memfiles, via node pools hanging off another object, or GC'd refs), & manage dup keys either inlined into the structure or handled externally (within the same rank space!). This is >36 (3rk*2kv*3alloc*2du) styles from 1 instantiation harness. The template has many parameters to control all these choices. All but Ob are defaulted:

+
  • K: Key type; Caller provides getKey(Ob):K; void if positional-only
  • +
  • Pos: type for node weight/position augmentation; void if keyed-only
  • +
  • ObSize: type for dup chain size if handled externally; void if embedded
  • +
  • nodeSize: size in bytes of a node. B-Tree Order m is inferred from this. Our notation is m..2m links split by m-1..2m-1 obs; 2 => a 234-tree; 2*m**(h-1)-1 <= numNodes <= (2m)**h-1 where h=height of tree.
  • +
  • Ix: type for object/link indices into node arrays
  • +
  • Ln: type for the link array in nodes
  • +
+

Common notation/abbreviations in this code/APiS:

+
  • s|side: 0|1 bool side of an op. Eg. successor = path.seekAdj(true).
  • +
  • Ob|ob: abstract object type being stored or an instance/array of it.
  • +
  • Ln|ln: abstract link type being stored or an instance/array of it.
  • +
  • allocProcs (btPool|btRef|btFile): allocation style for outer Nodes
  • +
  • nodeProcs (btLinearNode|btNestedNode): in-Node organization style
  • +
+ +

Notable implementation choices:

There is no "Tree" type distinct from the "SubTree/Node" type. Once made a root node never moves. That root address is the only handle needed. "nil" ptrs (in whatever allocation arena is used) are just empty trees. Because linear ordering always has exactly 2 sides, parameterization into s|side often keeps life simple/organized (cf. Mehlhorn DS&Algos|common sense).

+

Routines are all non-recursive. Instead a Path object is central to the API & we clearly separate cursor manipulation from mutation. This also makes the 3 main styles (ranked-only, keyed-only, keyed-ranked) symmetric & removes recursion overhead (big for tall trees/small m). Each instance can be a multiset/table with "sided" edits (stack/queue) of duplicate key series.

+

Victim replacement selection in internal deletes biases toward uniform node occupancy rather than minimum node count. The bulk loader to build a minimum height tree from pre-ordered inputs also allows leaving 1 (generalizable to x?) spare slot in each node to speed early inserts later. A property check routine is provided for would-be extenders. There is presently no provision for for concurrent access as the focus is just a good single-threaded tree.

+ +

Limitations/future work:

One limitation is that leaf&internal nodes have the same size&representation, wasting ~4..8*m B/leaf. This is <33% waste for Ob >=8..16 bytes. (Post aging, occupancy =~69% anyway.) This cost is spent to avoid complexity of either two node allocation pools with dynamic conversion or different-m orders for leaf & internal nodes. Max data density means wider 4..7 node split-merges (not 2..3) & specializing on key types, anyway; Eg. for string keys not duplicating prefixes in a leaf between ("aab1", "aab2").

+

This is a work in progress. Algorithmically, we should (maybe) do

+
  1. Node Structure (eg. RB tree w/1B ptr); moveMem has good const factors, but even DRAM has ideal node sz ~ 70ns*40GB/s = 2800B/(2+4)=~466
  2. +
  3. Whole tree catenate (helpful for seq style &)
  4. +
  5. More complex whole tree split
  6. +
  7. Optimizations for giant dup blocks
  8. +
+

Nim TODOs incl: make easy to include inside other generic types, add easy HashSet & Table use in terms of this lower-level core, run-tm ->CT errs, do GC'd&memfiles Ln variants, do distinct int Ln for ovrld/figure out exports.

+

+
+

Procs

+
+
+
+
proc orderFit(target, wtSz, ixSz, obSz, lnSz: int): int {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template btLinearNode(Ob, K, Pos: type; M: untyped; Ix, Ln: type)
+
+ + Node ops + Source   +Edit   + +
+
+ +
+
+
+
template btPool(Ob, Pos: type; nodeSize: int; Ix, Ln: type)
+
+ + A simple pool allocator. Easily adapted to memfiles | GC'd allocators. + Source   +Edit   + +
+
+ +
+
+
+
template defBTree(Ob: type; K: type = void; Pos: type = void;
+                  ObSize: type = void; nodeSize: int = 16; Ix: type = int16;
+                  Ln: type = uint16; allocProcs = btPool;
+                  nodeProcs = btLinearNode)
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/btree.idx b/adix/btree.idx new file mode 100644 index 0000000..f0d990c --- /dev/null +++ b/adix/btree.idx @@ -0,0 +1,7 @@ +nimTitle btree adix/btree.html module adix/btree 0 +nim orderFit adix/btree.html#orderFit,int,int,int,int,int proc orderFit(target, wtSz, ixSz, obSz, lnSz: int): int 74 +nim btPool adix/btree.html#btPool.t,type,type,int,type,type template btPool(Ob, Pos: type; nodeSize: int; Ix, Ln: type) 79 +nim btLinearNode adix/btree.html#btLinearNode.t,type,type,type,untyped,type,type template btLinearNode(Ob, K, Pos: type; M: untyped; Ix, Ln: type) 140 +nim defBTree adix/btree.html#defBTree.t,type,type,type,type,int,type,type template defBTree(Ob: type; K: type = void; Pos: type = void; ObSize: type = void;\n nodeSize: int = 16; Ix: type = int16; Ln: type = uint16;\n allocProcs = btPool; nodeProcs = btLinearNode) 212 +heading Notable implementation choices: adix/btree.html#notable-implementation-choicescolon Notable implementation choices: 0 +heading Limitations/future work: adix/btree.html#limitationsslashfuture-workcolon Limitations/future work: 0 diff --git a/adix/cpuCT.html b/adix/cpuCT.html new file mode 100644 index 0000000..9c761e0 --- /dev/null +++ b/adix/cpuCT.html @@ -0,0 +1,140 @@ + + + + + + + +adix/cpuCT + + + + + + + + + + + + +
+
+

adix/cpuCT

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

gcc/clang error out if the generated C includes a tmmintrin.h header on CPUs without -march=enabling the instructions. An admittedly expensive staticExec lets us probe a build-time system for all pre-defined C preprocessor macros in one execution. We then postprocess these into a set of flags for Nim compile-time when checks to make "fall back" easy/natural.

+
+

Types

+
+
+
X86Feature = enum
+  x86sse2, x86ssse3, x86bmi2
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Consts

+
+
+
ccPreDefs = "#define __SSP_STRONG__ 3\n#define __UINT_LEAST16_MAX__ 0xffff\n#define __ATOMIC_ACQUIRE 2\n#define __FLT128_MAX_10_EXP__ 4932\n#define __GCC_IEC_559_COMPLEX 2\n#define __UINT_LEAST8_TYPE__ unsigned char\n#define __SIZEOF_FLOAT80__ 16\n#define __INTMAX_C(c) c ## L\n#define __MOVBE__ 1\n#define __UINT8_MAX__ 0xff\n#define __SCHAR_WIDTH__ 8\n#define __WINT_MAX__ 0xffffffffU\n#define __ORDER_LITTLE_ENDIAN__ 1234\n#define __SIZE_MAX__ 0xffffffffffffffffUL\n#define __SSE4_1__ 1\n#define __WCHAR_MAX__ 0x7fffffff\n#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1\n#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1\n#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1\n#define __DBL_DENORM_MIN__ ((double)4.94065645841246544176568792868221372e-324L)\n#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1\n#define __GCC_ATOMIC_CHAR_LOCK_FREE 2\n#define __GCC_IEC_559 2\n#define __FLT32X_DECIMAL_DIG__ 17\n#define __znver3 1\n#define __FLT_EVAL_METHOD__ 0\n#define __FLT64_DECIMAL_DIG__ 17\n#define __CET__ 3\n#define __DBL_MIN_EXP__ (-1021)\n#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2\n#define __RDPID__ 1\n#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL\n#define __SIG_ATOMIC_TYPE__ int\n#define __DBL_MIN_10_EXP__ (-307)\n#define __FINITE_MATH_ONLY__ 0\n#define __FLT32X_MAX_EXP__ 1024\n#define __FLT32_HAS_DENORM__ 1\n#define __UINT_FAST8_MAX__ 0xff\n#define __FLT32_MAX_10_EXP__ 38\n#define __DEC64_MAX_EXP__ 385\n#define __INT8_C(c) c\n#define __INT_LEAST8_WIDTH__ 8\n#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL\n#define __SHRT_MAX__ 0x7fff\n#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L\n#define __FLT64X_MAX_10_EXP__ 4932\n#define __LDBL_IS_IEC_60559__ 2\n#define __FLT64X_HAS_QUIET_NAN__ 1\n#define __UINT_LEAST8_MAX__ 0xff\n#define __GCC_ATOMIC_BOOL_LOCK_FREE 2\n#define __LAHF_SAHF__ 1\n#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128\n#define __UINTMAX_TYPE__ long unsigned int\n#define __linux 1\n#define __DEC32_EPSILON__ 1E-6DF\n#define __FLT_EVAL_METHOD_TS_18661_3__ 0\n#define __unix 1\n#define __UINT32_MAX__ 0xffffffffU\n#define __FLT128_MIN_EXP__ (-16381)\n#define __WINT_MIN__ 0U\n#define __CHAR_BIT__ 8\n#define __FLT128_MIN_10_EXP__ (-4931)\n#define __FLT32X_IS_IEC_60559__ 2\n#define __INT_LEAST16_WIDTH__ 16\n#define __SCHAR_MAX__ 0x7f\n#define __FLT128_MANT_DIG__ 113\n#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1)\n#define __INT64_C(c) c ## L\n#define __GCC_ATOMIC_POINTER_LOCK_FREE 2\n#define __FLT32X_MANT_DIG__ 53\n#define __USER_LABEL_PREFIX__ \n#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x\n#define __STDC_HOSTED__ 1\n#define __FLT32_DIG__ 6\n#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F\n#define __ABM__ 1\n#define __SHRT_WIDTH__ 16\n#define __FLT32_IS_IEC_60559__ 2\n#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L\n#define __STDC_UTF_16__ 1\n#define __DBL_IS_IEC_60559__ 2\n#define __DEC32_MAX__ 9.999999E96DF\n#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x\n#define __FP_FAST_FMA 1\n#define __CRC32__ 1\n#define __tune_znver3__ 1\n#define __FLT32X_HAS_INFINITY__ 1\n#define __INT32_MAX__ 0x7fffffff\n#define __unix__ 1\n#define __INT_WIDTH__ 32\n#define __SIZEOF_LONG__ 8\n#define __STDC_IEC_559__ 1\n#define __STDC_ISO_10646__ 201706L\n#define __UINT16_C(c) c\n#define __DECIMAL_DIG__ 21\n#define __STDC_IEC_559_COMPLEX__ 1\n#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64\n#define __DBL_DIG__ 15\n#define __gnu_linux__ 1\n#define __FLT128_IS_IEC_60559__ 2\n#define __FLT64X_MIN_10_EXP__ (-4931)\n#define __LDBL_HAS_QUIET_NAN__ 1\n#define __FLT64_MANT_DIG__ 53\n#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F\n#define __FLT64X_MANT_DIG__ 64\n#define __GNUC__ 11\n#define __pie__ 2\n#define __MMX__ 1\n#define __XSAVES__ 1\n#define __FLT_HAS_DENORM__ 1\n#define __SIZEOF_LONG_DOUBLE__ 16\n#define __XSAVEOPT__ 1\n#define __BIGGEST_ALIGNMENT__ 32\n#define __PRFCHW__ 1\n#define __FLT64_MAX_10_EXP__ 308\n#define __DBL_MAX__ ((double)1.79769313486231570814527423731704357e+308L)\n#define __INT_FAST32_MAX__ 0x7fffffffffffffffL\n#define __DBL_HAS_INFINITY__ 1\n#define __SSE4_2__ 1\n#define __SIZEOF_FLOAT__ 4\n#define __DEC32_MIN_EXP__ (-94)\n#define __INTPTR_WIDTH__ 64\n#define __FLT64X_HAS_INFINITY__ 1\n#define __UINT_LEAST32_MAX__ 0xffffffffU\n#define __FLT32X_HAS_DENORM__ 1\n#define __INT_FAST16_TYPE__ long int\n#define __MMX_WITH_SSE__ 1\n#define __LDBL_HAS_DENORM__ 1\n#define __FLT_DIG__ 6\n#define __FLT128_HAS_INFINITY__ 1\n#define __DEC32_MIN__ 1E-95DF\n#define __POPCNT__ 1\n#define __DBL_MAX_EXP__ 1024\n#define __VAES__ 1\n#define __WCHAR_WIDTH__ 32\n#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32\n#define __DEC128_EPSILON__ 1E-33DL\n#define __SSE2_MATH__ 1\n#define __ATOMIC_HLE_RELEASE 131072\n#define __PTRDIFF_MAX__ 0x7fffffffffffffffL\n#define __FLT128_MAX_EXP__ 16384\n#define __amd64 1\n#define __AVX__ 1\n#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL\n#define __SIZEOF_SIZE_T__ 8\n#define __LZCNT__ 1\n#define __FLT64X_MIN_EXP__ (-16381)\n#define __SIZEOF_WINT_T__ 4\n#define __LONG_LONG_WIDTH__ 64\n#define __FLT32_MAX_EXP__ 128\n#define __GXX_ABI_VERSION 1016\n#define __FLT_MIN_EXP__ (-125)\n#define __GCC_HAVE_DWARF2_CFI_ASM 1\n#define __INT16_MAX__ 0x7fff\n#define __x86_64 1\n#define __INT_FAST64_TYPE__ long int\n#define __FP_FAST_FMAF 1\n#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64\n#define __DBL_MIN__ ((double)2.22507385850720138309023271733240406e-308L)\n#define __CLFLUSHOPT__ 1\n#define __PCLMUL__ 1\n#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128\n#define __FLT64X_NORM_MAX__ 1.18973149535723176502126385303097021e+4932F64x\n#define __SIZEOF_POINTER__ 8\n#define __F16C__ 1\n#define __LP64__ 1\n#define __DBL_HAS_QUIET_NAN__ 1\n#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x\n#define __DECIMAL_BID_FORMAT__ 1\n#define __FLT64_MIN_EXP__ (-1021)\n#define __FLT64_MIN_10_EXP__ (-307)\n#define __FLT64X_DECIMAL_DIG__ 21\n#define __DEC128_MIN__ 1E-6143DL\n#define __REGISTER_PREFIX__ \n#define __UINT16_MAX__ 0xffff\n#define __DBL_HAS_DENORM__ 1\n#define __LDBL_HAS_INFINITY__ 1\n#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32\n#define __UINT8_TYPE__ unsigned char\n#define __XSAVE__ 1\n#define __NO_INLINE__ 1\n#define __CLWB__ 1\n#define __DEC_EVAL_METHOD__ 2\n#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL\n#define __FLT32X_MAX_10_EXP__ 308\n#define __LDBL_DECIMAL_DIG__ 21\n#define __VERSION__ \"11.4.0\"\n#define __UINT64_C(c) c ## UL\n#define __VPCLMULQDQ__ 1\n#define __FMA__ 1\n#define _STDC_PREDEF_H 1\n#define __znver3__ 1\n#define __INT_LEAST32_MAX__ 0x7fffffff\n#define __GCC_ATOMIC_INT_LOCK_FREE 2\n#define __SHSTK__ 1\n#define __FLT32_MANT_DIG__ 24\n#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__\n#define __STDC_IEC_60559_COMPLEX__ 201404L\n#define __ATOMIC_HLE_ACQUIRE 65536\n#define __FLT128_HAS_DENORM__ 1\n#define __FLT32_DECIMAL_DIG__ 9\n#define __FLT128_DIG__ 33\n#define __INT32_C(c) c\n#define __DEC64_EPSILON__ 1E-15DD\n#define __ORDER_PDP_ENDIAN__ 3412\n#define __DEC128_MIN_EXP__ (-6142)\n#define __INT_FAST32_TYPE__ long int\n#define __linux__ 1\n#define __UINT_LEAST16_TYPE__ short unsigned int\n#define unix 1\n#define __SIZE_TYPE__ long unsigned int\n#define __UINT64_MAX__ 0xffffffffffffffffUL\n#define __FLT_IS_IEC_60559__ 2\n#define __GNUC_WIDE_EXECUTION_CHARSET_NAME \"UTF-32LE\"\n#define __FLT64X_DIG__ 18\n#define __INT8_TYPE__ signed char\n#define __ELF__ 1\n#define __GCC_ASM_FLAG_OUTPUTS__ 1\n#define __UINT32_TYPE__ unsigned int\n#define __FLT_RADIX__ 2\n#define __INT_LEAST16_TYPE__ short int\n#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L\n#define __UINTMAX_C(c) c ## UL\n#define __SSE_MATH__ 1\n#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x\n#define __SIG_ATOMIC_MAX__ 0x7fffffff\n#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2\n#define __STDC_IEC_60559_BFP__ 201404L\n#define __SIZEOF_PTRDIFF_T__ 8\n#define __RDSEED__ 1\n#define __BMI__ 1\n#define __LDBL_DIG__ 18\n#define __FLT64_IS_IEC_60559__ 2\n#define __x86_64__ 1\n#define __FLT32X_MIN_EXP__ (-1021)\n#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF\n#define __INT_FAST16_MAX__ 0x7fffffffffffffffL\n#define __FLT64_DIG__ 15\n#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL\n#define __UINT_LEAST64_TYPE__ long unsigned int\n#define __FLT_HAS_QUIET_NAN__ 1\n#define __FLT_MAX_10_EXP__ 38\n#define __LONG_MAX__ 0x7fffffffffffffffL\n#define __FLT64X_HAS_DENORM__ 1\n#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL\n#define __FLT_HAS_INFINITY__ 1\n#define __GNUC_EXECUTION_CHARSET_NAME \"UTF-8\"\n#define __UINT_FAST16_TYPE__ long unsigned int\n#define __DEC64_MAX__ 9.999999999999999E384DD\n#define __INT_FAST32_WIDTH__ 64\n#define __CHAR16_TYPE__ short unsigned int\n#define __PRAGMA_REDEFINE_EXTNAME 1\n#define __SIZE_WIDTH__ 64\n#define __SEG_FS 1\n#define __INT_LEAST16_MAX__ 0x7fff\n#define __DEC64_MANT_DIG__ 16\n#define __INT64_MAX__ 0x7fffffffffffffffL\n#define __SEG_GS 1\n#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32\n#define __SIG_ATOMIC_WIDTH__ 32\n#define __INT_LEAST64_TYPE__ long int\n#define __INT16_TYPE__ short int\n#define __INT_LEAST8_TYPE__ signed char\n#define __STDC_VERSION__ 201710L\n#define __SIZEOF_INT__ 4\n#define __DEC32_MAX_EXP__ 97\n#define __INT_FAST8_MAX__ 0x7f\n#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128\n#define __INTPTR_MAX__ 0x7fffffffffffffffL\n#define linux 1\n#define __AVX2__ 1\n#define __FLT64_HAS_QUIET_NAN__ 1\n#define __FLT32_MIN_10_EXP__ (-37)\n#define __SSSE3__ 1\n#define __FLT32X_DIG__ 15\n#define __RDRND__ 1\n#define __PTRDIFF_WIDTH__ 64\n#define __LDBL_MANT_DIG__ 64\n#define __FLT64_HAS_INFINITY__ 1\n#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x\n#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)\n#define __code_model_small__ 1\n#define __GCC_ATOMIC_LONG_LOCK_FREE 2\n#define __DEC32_MANT_DIG__ 7\n#define __INTPTR_TYPE__ long int\n#define __UINT16_TYPE__ short unsigned int\n#define __WCHAR_TYPE__ int\n#define __pic__ 2\n#define __UINTPTR_MAX__ 0xffffffffffffffffUL\n#define __INT_FAST64_WIDTH__ 64\n#define __SSE4A__ 1\n#define __INT_FAST64_MAX__ 0x7fffffffffffffffL\n#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1\n#define __FLT_NORM_MAX__ 3.40282346638528859811704183484516925e+38F\n#define __FLT32_HAS_INFINITY__ 1\n#define __FLT64X_MAX_EXP__ 16384\n#define __UINT_FAST64_TYPE__ long unsigned int\n#define __INT_MAX__ 0x7fffffff\n#define __SHA__ 1\n#define __INT64_TYPE__ long int\n#define __FLT_MAX_EXP__ 128\n#define __ORDER_BIG_ENDIAN__ 4321\n#define __DBL_MANT_DIG__ 53\n#define __SIZEOF_FLOAT128__ 16\n#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL\n#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2\n#define __FP_FAST_FMAF32 1\n#define __DEC64_MIN__ 1E-383DD\n#define __WINT_TYPE__ unsigned int\n#define __UINT_LEAST32_TYPE__ unsigned int\n#define __SIZEOF_SHORT__ 2\n#define __FLT32_NORM_MAX__ 3.40282346638528859811704183484516925e+38F32\n#define __SSE__ 1\n#define __LDBL_MIN_EXP__ (-16381)\n#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64\n#define __WINT_WIDTH__ 32\n#define __FP_FAST_FMAF64 1\n#define __INT_LEAST8_MAX__ 0x7f\n#define __INT_LEAST64_WIDTH__ 64\n#define __LDBL_MAX_EXP__ 16384\n#define __SIZEOF_INT128__ 16\n#define __FLT64X_IS_IEC_60559__ 2\n#define __LDBL_MAX_10_EXP__ 4932\n#define __ATOMIC_RELAXED 0\n#define __DBL_EPSILON__ ((double)2.22044604925031308084726333618164062e-16L)\n#define __FLT32_MIN_EXP__ (-125)\n#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128\n#define _LP64 1\n#define __UINT8_C(c) c\n#define __FLT64_MAX_EXP__ 1024\n#define __INT_LEAST32_TYPE__ int\n#define __SIZEOF_WCHAR_T__ 4\n#define __UINT64_TYPE__ long unsigned int\n#define __GNUC_PATCHLEVEL__ 0\n#define __FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128\n#define __amd64__ 1\n#define __FLT64_NORM_MAX__ 1.79769313486231570814527423731704357e+308F64\n#define __FLT128_HAS_QUIET_NAN__ 1\n#define __INTMAX_MAX__ 0x7fffffffffffffffL\n#define __INT_FAST8_TYPE__ signed char\n#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x\n#define __GNUC_STDC_INLINE__ 1\n#define __FLT64_HAS_DENORM__ 1\n#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32\n#define __FP_FAST_FMAF32x 1\n#define __DBL_DECIMAL_DIG__ 17\n#define __STDC_UTF_32__ 1\n#define __INT_FAST8_WIDTH__ 8\n#define __FXSR__ 1\n#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x\n#define __DBL_NORM_MAX__ ((double)1.79769313486231570814527423731704357e+308L)\n#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__\n#define __INTMAX_WIDTH__ 64\n#define __UINT32_C(c) c ## U\n#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F\n#define __INT8_MAX__ 0x7f\n#define __LONG_WIDTH__ 64\n#define __PIC__ 2\n#define __UINT_FAST32_TYPE__ long unsigned int\n#define __FLT32X_NORM_MAX__ 1.79769313486231570814527423731704357e+308F32x\n#define __CHAR32_TYPE__ unsigned int\n#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F\n#define __SSE2__ 1\n#define __INT32_TYPE__ int\n#define __XSAVEC__ 1\n#define __SIZEOF_DOUBLE__ 8\n#define __FLT_MIN_10_EXP__ (-37)\n#define __FLT_MANT_DIG__ 24\n#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64\n#define __INT_LEAST32_WIDTH__ 32\n#define __INTMAX_TYPE__ long int\n#define __CLZERO__ 1\n#define __DEC128_MAX_EXP__ 6145\n#define __FSGSBASE__ 1\n#define __FLT32X_HAS_QUIET_NAN__ 1\n#define __ATOMIC_CONSUME 1\n#define __GNUC_MINOR__ 4\n#define __INT_FAST16_WIDTH__ 64\n#define __UINTMAX_MAX__ 0xffffffffffffffffUL\n#define __PIE__ 2\n#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x\n#define __DBL_MAX_10_EXP__ 308\n#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L\n#define __BMI2__ 1\n#define __INT16_C(c) c\n#define __STDC__ 1\n#define __AES__ 1\n#define __PTRDIFF_TYPE__ long int\n#define __DEC64_MIN_EXP__ (-382)\n#define __ATOMIC_SEQ_CST 5\n#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 1\n#define __ADX__ 1\n#define __FLT32X_MIN_10_EXP__ (-307)\n#define __UINTPTR_TYPE__ long unsigned int\n#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD\n#define __DEC128_MANT_DIG__ 34\n#define __LDBL_MIN_10_EXP__ (-4931)\n#define __SIZEOF_LONG_LONG__ 8\n#define __HAVE_SPECULATION_SAFE_VALUE 1\n#define __FLT128_DECIMAL_DIG__ 36\n#define __GCC_ATOMIC_LLONG_LOCK_FREE 2\n#define __FLT32_HAS_QUIET_NAN__ 1\n#define __FLT_DECIMAL_DIG__ 9\n#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL\n#define __LDBL_NORM_MAX__ 1.18973149535723176502126385303097021e+4932L\n#define __GCC_ATOMIC_SHORT_LOCK_FREE 2\n#define __SSE3__ 1\n#define __UINT_FAST8_TYPE__ unsigned char\n#define __ATOMIC_ACQ_REL 4\n#define __ATOMIC_RELEASE 3"
+
+ + + Source   +Edit   + +
+
+
+
x86features = {x86sse2, x86ssse3, x86bmi2}
+
+ + + Source   +Edit   + +
+
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/cpuCT.idx b/adix/cpuCT.idx new file mode 100644 index 0000000..34c3246 --- /dev/null +++ b/adix/cpuCT.idx @@ -0,0 +1,7 @@ +nimTitle cpuCT adix/cpuCT.html module adix/cpuCT 0 +nim ccPreDefs adix/cpuCT.html#ccPreDefs const ccPreDefs 9 +nim x86sse2 adix/cpuCT.html#x86sse2 X86Feature.x86sse2 14 +nim x86ssse3 adix/cpuCT.html#x86ssse3 X86Feature.x86ssse3 14 +nim x86bmi2 adix/cpuCT.html#x86bmi2 X86Feature.x86bmi2 14 +nim X86Feature adix/cpuCT.html#X86Feature enum X86Feature 14 +nim x86features adix/cpuCT.html#x86features const x86features 16 diff --git a/adix/cumsum.html b/adix/cumsum.html new file mode 100644 index 0000000..1cd1fcf --- /dev/null +++ b/adix/cumsum.html @@ -0,0 +1,187 @@ + + + + + + + +adix/cumsum + + + + + + + + + + + + +
+
+

adix/cumsum

+
+ +
+ Source   +Edit   + +
+ +

+
+

Imports

+
+ cpuCT +
+
+
+

Procs

+
+
+
+
proc cumsum(c: ptr UncheckedArray[uint8]; n: uint) {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc cumsum(c: ptr UncheckedArray[uint16]; n: uint) {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc cumsum(c: ptr UncheckedArray[uint32]; n: uint) {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc cumsum(c: ptr UncheckedArray[uint64]; n: uint) {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc cumsum[T](c: ptr T; n: uint) {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc cumsum[T](c: ptr UncheckedArray[T]; n: uint)
+
+ + + Source   +Edit   + +
+
+
+
proc cumsum[T](c: var openArray[T]) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/cumsum.idx b/adix/cumsum.idx new file mode 100644 index 0000000..b0125ac --- /dev/null +++ b/adix/cumsum.idx @@ -0,0 +1,9 @@ +nimTitle cumsum adix/cumsum.html module adix/cumsum 0 +nim cumsum adix/cumsum.html#cumsum,ptr.UncheckedArray[T],uint proc cumsum[T](c: ptr UncheckedArray[T]; n: uint) 6 +nim cumsum adix/cumsum.html#cumsum,ptr.UncheckedArray[uint8],uint proc cumsum(c: ptr UncheckedArray[uint8]; n: uint) 38 +nim cumsum adix/cumsum.html#cumsum,ptr.UncheckedArray[uint16],uint proc cumsum(c: ptr UncheckedArray[uint16]; n: uint) 63 +nim cumsum adix/cumsum.html#cumsum,ptr.UncheckedArray[uint32],uint proc cumsum(c: ptr UncheckedArray[uint32]; n: uint) 87 +nim cumsum adix/cumsum.html#cumsum,ptr.UncheckedArray[uint64],uint proc cumsum(c: ptr UncheckedArray[uint64]; n: uint) 110 +nim cumsum adix/cumsum.html#cumsum,openArray[T] proc cumsum[T](c: var openArray[T]) 114 +nim cumsum adix/cumsum.html#cumsum,ptr.T,uint proc cumsum[T](c: ptr T; n: uint) 117 +nimgrp cumsum adix/cumsum.html#cumsum-procs-all proc 6 diff --git a/adix/ditab.html b/adix/ditab.html new file mode 100644 index 0000000..99fa063 --- /dev/null +++ b/adix/ditab.html @@ -0,0 +1,1535 @@ + + + + + + + +adix/ditab + + + + + + + + + + + + +
+
+

adix/ditab

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This module provides a directly indexed set/table representation via a dense seq[T] with an auxiliary sparse direct index to accelerate searching. "direct" means the same size as the key space or "alphabet". The index says what seq index has each (unique) key. This can do any unordered set op in guaranteed unit time cost per element -- make, insert, delete, member query, iterate, union/intersect/etc. -- all with arbitrarily "aged" sets.

+

The catch is that the "unit" in said cost will only be small if the key space is small enough to afford allocating index space & if the working set of the index fits into low enough latency memory to not be too slow. Otherwise, other data structures like hash tables & B-trees will outperform this. Iteration is always in insertion order whenever no deletes have occurred. The "unit" is also 2 memory accesses per operation, vs. often 1 for lptabz. So, very large scale can make this guaranteed to be ~2X slower than a good average case for lptabz, all depending upon exact requirements, of course.

+

The earliest reference I have elaborating this approach is _An Efficient Representation for Sparse Sets by Preston Briggs & Linda Torczon from Rice in 1993 referencing an exercise in Aho, Croft & Ullman 1974. It's simple enough that the idea may date to early 1960s DB work (e.g. by Codd), maybe under another term like "direct indexing". K below must have an available conversion to int. Duplicate keys cannot be allowed for this one.

+Below here is pretty standard except for the generic signatures

+ +
+

Types

+
+
+
DISet[K] = DITab[K, void]
+
+ + DITab specialized to sets + Source   +Edit   + +
+
+
+
DITab[K; V] = object
+  when V is void:
+  else:
+
+ + Alphabet size determines K; V may be void + Source   +Edit   + +
+
+ +
+
+
+

Vars

+
+
+
diDenom = 0
+
+ + default denominator (unused) + Source   +Edit   + +
+
+
+
diGrowPow2 = 0
+
+ + default growth power of 2 (unused) + Source   +Edit   + +
+
+
+
diInitialSize = 0
+
+ + default numerator (unused) + Source   +Edit   + +
+
+
+
diMinFree = 0
+
+ + default min free slots (unused) + Source   +Edit   + +
+
+
+
diNumer = 0
+
+ + default numerator (unused) + Source   +Edit   + +
+
+
+
diRehash = false
+
+ + default hcode rehashing behavior (unused) + Source   +Edit   + +
+
+
+
diRobinHood = false
+
+ + default to Robin Hood (unused) + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc `$`[K, V: not void](t: DITab[K, V]): string
+
+ + + Source   +Edit   + +
+
+
+
proc `$`[K](s: DITab[K, void]): string
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `*`[K](s1, s2: DITab[K, void]): DITab[K, void] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `+`[K](s1, s2: DITab[K, void]): DITab[K, void] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `-`[K](s1, s2: DITab[K, void]): DITab[K, void] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `-+-`[K](s1, s2: DITab[K, void]): DITab[K, void] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `<`[K](s, t: DITab[K, void]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `<=`[K](s, t: DITab[K, void]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `==`[K, V](x, y: DITab[K, V]): bool
+
+ + + Source   +Edit   + +
+
+
+
proc `==`[K](s, t: DITab[K, void]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]`[K, V](t: DITab[K, V]; key: K): V {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc `[]`[K, V](t: var DITab[K, V]; key: K): var V {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]=`[K, V](t: var DITab[K, V]; key: K; val: V)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc card[K](s: DITab[K, void]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc clear[K, V](t: var DITab[K, V]) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc contains[K, V](t: DITab[K, V]; key: K): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc containsOrIncl[K](t: var DITab[K, void]; key: K): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc debugDump[K, V](t: DITab[K, V]; label = "")
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc del[K, V](t: var DITab[K, V]; key: K) {.inline.}
+
+ + delete one key key from t; If you want to know if it was present then use missingOrExcl, take, or pop instead. + Source   +Edit   + +
+
+ +
+
+
+
proc depths[K, V](t: DITab[K, V]): seq[int]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc depthStats[K, V](s: DITab[K, V]): tuple[m1, m2: float, mx: int]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc difference[K](s1, s2: DITab[K, void]): DITab[K, void]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc disjoint[K](s1, s2: DITab[K, void]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc editKey[K, V](t: var DITab[K, V]; old, new: K) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc excl[K](s: var DITab[K, void]; elt: K) {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc excl[K](s: var DITab[K, void]; other: DITab[K, void])
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getCap[K, V](t: var DITab[K, V]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getOrDefault[K, V](t: DITab[K, V]; key: K; default = default(V)): V {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hash[K](s: DITab[K, void]): Hash
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hasKey[K, V](t: DITab[K, V]; key: K): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hasKeyOrPut[K, V](t: var DITab[K, V]; key: K; val: V): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc inc[K, V: SomeInteger](t: var DITab[K, V]; key: K; amount: SomeInteger = 1) {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc incl[K](s: var DITab[K, void]; elt: K) {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc incl[K](s: var DITab[K, void]; other: DITab[K, void])
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc indexBy[A, K, V](collection: A; index: proc (x: V): K): DITab[K, V]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc init[K, V](t: var DITab[K, V]; initialSize = 0; numer = 0; denom = 0;
+                minFree = 0; growPow2 = 0; rehash = false; robinhood = false) {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc initDISet[K](initialSize = 0; numer = diNumer; denom = diDenom;
+                  minFree = diMinFree; growPow2 = diGrowPow2; rehash = diRehash;
+                  robinhood = diRobinHood): DISet[K] {.inline.}
+
+ + Return an DITab specialized to sets operations. See initDITab for parameter details. + Source   +Edit   + +
+
+ +
+
+
+
proc initDITab[K, V](initialSize = 0; numer = 0; denom = 0; minFree = 0;
+                     growPow2 = 0; rehash = false; robinhood = false): DITab[K,
+    V] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc intersection[K](s1, s2: DITab[K, void]): DITab[K, void]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc len[K, V](t: DITab[K, V]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc map[K, A](data: DITab[K, void]; op: proc (x: K): A {.closure.}): DITab[A,
+    void]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc merge[K, V: SomeInteger](c: var DITab[K, V]; b: DITab[K, V])
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc mgetOrPut[K, V](t: var DITab[K, V]; key: K; val: V): var V {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc mgetOrPut[K, V](t: var DITab[K, V]; key: K; val: V; had: var bool): var V {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc missingOrExcl[K, V](t: var DITab[K, V]; key: K): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc nthKey[K](t: DITab[K, void]; n: int): K {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc nthPair[K, V: not void](t: DITab[K, V]; n: int): (K, V) {.inline.}
+
+ + Insertion-ordered tables support 0-origin nth-in-order pair. + Source   +Edit   + +
+
+
+
proc nthPair[K, V: not void](t: var DITab[K, V]; n: int): (K, ptr V) {.inline.}
+
+ + Insertion-ordered tables support 0-origin nth-in-order pair w/editable val. + Source   +Edit   + +
+
+ +
+
+
+
proc pop[K, V: not void](t: var DITab[K, V]): (K, V) {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc pop[K, V: not void](t: var DITab[K, V]; key: K; val: var V): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc pop[K](s: var DITab[K, void]; key: var K): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc pop[K](t: var DITab[K, void]): K {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc rightSize(count: int; numer = 0; denom = 0; minFree = 0): int {.inline,
+    ...deprecated: "Deprecated since 0.2; identity function", raises: [], tags: [],
+    forbids: [].}
+
+
+ Deprecated: Deprecated since 0.2; identity function +
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc setCap[K, V](t: var DITab[K, V]; newSize = -1)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc setOrIncl[K](t: var DITab[K, void]; key: K): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc setPolicy[K, V](t: var DITab[K, V]; numer = 0; denom = 0; minFree = 0;
+                     growPow2 = 0; rehash = 0; robinhood = 0) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc symmetricDifference[K](s1, s2: DITab[K, void]): DITab[K, void]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc take[K, V: not void](t: var DITab[K, V]; key: K; val: var V): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc take[K](t: var DITab[K, void]; key: var K): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc toDITab[K, V: not void](pairs: openArray[(K, V)]; dups = false): DITab[K, V]
+
+ + + Source   +Edit   + +
+
+
+
proc toDITab[K](keys: openArray[K]; dups = false): DITab[K, void]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc union[K](s1, s2: DITab[K, void]): DITab[K, void]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `{}`[K, V](t: DITab[K, V]; key: K): V {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc `{}`[K, V](t: var DITab[K, V]; key: K): var V {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `{}=`[K, V](t: var DITab[K, V]; key: K; val: V) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator hcodes[K, V](t: DITab[K, V]): (int, Hash)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator items[K](t: DITab[K, void]): K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator keys[K, V](t: DITab[K, V]): K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator mitems[K](t: var DITab[K, void]): var K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator mpairs[K, V: not void](t: DITab[K, V]): (K, var V)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator mvalues[K, V](t: var DITab[K, V]): var V
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator pairs[K, V: not void](t: DITab[K, V]): (K, V)
+
+ + + Source   +Edit   + +
+
+
+
iterator pairs[K](t: DITab[K, void]): (int, K)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator topByVal[K, V](c: DITab[K, V]; n = 10; min = V.low; order = Cheap): (K,
+    V)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator values[K, V](t: DITab[K, V]): V
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template editOrInit[K, V](t: var DITab[K, V]; key: K; v, body1, body2: untyped)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
template withValue[K, V](t: var DITab[K, V]; key: K;
+                         value, body1, body2: untyped)
+
+ + + Source   +Edit   + +
+
+
+
template withValue[K, V](t: var DITab[K, V]; key: K; value, body: untyped)
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Exports

+
+ TopKOrder +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/ditab.idx b/adix/ditab.idx new file mode 100644 index 0000000..fd51115 --- /dev/null +++ b/adix/ditab.idx @@ -0,0 +1,101 @@ +nimTitle ditab adix/ditab.html module adix/ditab 0 +nim DITab adix/ditab.html#DITab object DITab 27 +nim DISet adix/ditab.html#DISet type DISet 34 +nim len adix/ditab.html#len,DITab[K,V] proc len[K, V](t: DITab[K, V]): int 41 +nim depths adix/ditab.html#depths,DITab[K,V] proc depths[K, V](t: DITab[K, V]): seq[int] 89 +nim diInitialSize adix/ditab.html#diInitialSize var diInitialSize 92 +nim diNumer adix/ditab.html#diNumer var diNumer 93 +nim diDenom adix/ditab.html#diDenom var diDenom 94 +nim diMinFree adix/ditab.html#diMinFree var diMinFree 95 +nim diGrowPow2 adix/ditab.html#diGrowPow2 var diGrowPow2 96 +nim diRehash adix/ditab.html#diRehash var diRehash 97 +nim diRobinHood adix/ditab.html#diRobinHood var diRobinHood 98 +nim init adix/ditab.html#init,DITab[K,V],int,int,int,int,int proc init[K, V](t: var DITab[K, V]; initialSize = 0; numer = 0; denom = 0;\n minFree = 0; growPow2 = 0; rehash = false; robinhood = false) 100 +nim initDITab adix/ditab.html#initDITab,int,int,int,int,int proc initDITab[K, V](initialSize = 0; numer = 0; denom = 0; minFree = 0;\n growPow2 = 0; rehash = false; robinhood = false): DITab[K, V] 112 +nim setPolicy adix/ditab.html#setPolicy,DITab[K,V],int,int,int,int,int,int proc setPolicy[K, V](t: var DITab[K, V]; numer = 0; denom = 0; minFree = 0;\n growPow2 = 0; rehash = 0; robinhood = 0) 116 +nim rightSize adix/ditab.html#rightSize,int,int,int,int proc rightSize(count: int; numer = 0; denom = 0; minFree = 0): int 119 +nim getCap adix/ditab.html#getCap,DITab[K,V] proc getCap[K, V](t: var DITab[K, V]): int 122 +nim setCap adix/ditab.html#setCap,DITab[K,V],int proc setCap[K, V](t: var DITab[K, V]; newSize = -1) 124 +nim contains adix/ditab.html#contains,DITab[K,V],K proc contains[K, V](t: DITab[K, V]; key: K): bool 126 +nim containsOrIncl adix/ditab.html#containsOrIncl,DITab[K,void],K proc containsOrIncl[K](t: var DITab[K, void]; key: K): bool 128 +nim setOrIncl adix/ditab.html#setOrIncl,DITab[K,void],K proc setOrIncl[K](t: var DITab[K, void]; key: K): bool 132 +nim mgetOrPut adix/ditab.html#mgetOrPut,DITab[K,V],K,V proc mgetOrPut[K, V](t: var DITab[K, V]; key: K; val: V): var V 136 +nim mgetOrPut adix/ditab.html#mgetOrPut,DITab[K,V],K,V,bool proc mgetOrPut[K, V](t: var DITab[K, V]; key: K; val: V; had: var bool): var V 140 +nim editOrInit adix/ditab.html#editOrInit.t,DITab[K,V],K,untyped,untyped,untyped template editOrInit[K, V](t: var DITab[K, V]; key: K; v, body1, body2: untyped) 145 +nim missingOrExcl adix/ditab.html#missingOrExcl,DITab[K,V],K proc missingOrExcl[K, V](t: var DITab[K, V]; key: K): bool 158 +nim take adix/ditab.html#take,DITab[K,void],K proc take[K](t: var DITab[K, void]; key: var K): bool 162 +nim take adix/ditab.html#take,DITab[K: not void,V: not void],K,V proc take[K, V: not void](t: var DITab[K, V]; key: K; val: var V): bool 166 +nim pop adix/ditab.html#pop,DITab[K,void] proc pop[K](t: var DITab[K, void]): K 173 +nim pop adix/ditab.html#pop,DITab[K: not void,V: not void] proc pop[K, V: not void](t: var DITab[K, V]): (K, V) 175 +nim clear adix/ditab.html#clear,DITab[K,V] proc clear[K, V](t: var DITab[K, V]) 178 +nim items adix/ditab.html#items.i,DITab[K,void] iterator items[K](t: DITab[K, void]): K 180 +nim mitems adix/ditab.html#mitems.i,DITab[K,void] iterator mitems[K](t: var DITab[K, void]): var K 183 +nim pairs adix/ditab.html#pairs.i,DITab[K,void] iterator pairs[K](t: DITab[K, void]): (int, K) 189 +nim pairs adix/ditab.html#pairs.i,DITab[K: not void,V: not void] iterator pairs[K, V: not void](t: DITab[K, V]): (K, V) 192 +nim mpairs adix/ditab.html#mpairs.i,DITab[K: not void,V: not void] iterator mpairs[K, V: not void](t: DITab[K, V]): (K, var V) 195 +nim hcodes adix/ditab.html#hcodes.i,DITab[K,V] iterator hcodes[K, V](t: DITab[K, V]): (int, Hash) 198 +nim debugDump adix/ditab.html#debugDump,DITab[K,V],string proc debugDump[K, V](t: DITab[K, V]; label = "") 205 +nim keys adix/ditab.html#keys.i,DITab[K,V] iterator keys[K, V](t: DITab[K, V]): K 212 +nim values adix/ditab.html#values.i,DITab[K,V] iterator values[K, V](t: DITab[K, V]): V 215 +nim mvalues adix/ditab.html#mvalues.i,DITab[K,V] iterator mvalues[K, V](t: var DITab[K, V]): var V 218 +nim pop adix/ditab.html#pop,DITab[K,void],K proc pop[K](s: var DITab[K, void]; key: var K): bool 222 +nim incl adix/ditab.html#incl,DITab[K,void],K proc incl[K](s: var DITab[K, void]; elt: K) 225 +nim excl adix/ditab.html#excl,DITab[K,void],K proc excl[K](s: var DITab[K, void]; elt: K) 228 +nim incl adix/ditab.html#incl,DITab[K,void],DITab[K,void] proc incl[K](s: var DITab[K, void]; other: DITab[K, void]) 231 +nim excl adix/ditab.html#excl,DITab[K,void],DITab[K,void] proc excl[K](s: var DITab[K, void]; other: DITab[K, void]) 234 +nim card adix/ditab.html#card,DITab[K,void] proc card[K](s: DITab[K, void]): int 237 +nim union adix/ditab.html#union,DITab[K,void],DITab[K,void] proc union[K](s1, s2: DITab[K, void]): DITab[K, void] 239 +nim intersection adix/ditab.html#intersection,DITab[K,void],DITab[K,void] proc intersection[K](s1, s2: DITab[K, void]): DITab[K, void] 243 +nim difference adix/ditab.html#difference,DITab[K,void],DITab[K,void] proc difference[K](s1, s2: DITab[K, void]): DITab[K, void] 248 +nim symmetricDifference adix/ditab.html#symmetricDifference,DITab[K,void],DITab[K,void] proc symmetricDifference[K](s1, s2: DITab[K, void]): DITab[K, void] 253 +nim `+` adix/ditab.html#+,DITab[K,void],DITab[K,void] proc `+`[K](s1, s2: DITab[K, void]): DITab[K, void] 258 +nim `*` adix/ditab.html#*,DITab[K,void],DITab[K,void] proc `*`[K](s1, s2: DITab[K, void]): DITab[K, void] 261 +nim `-` adix/ditab.html#-,DITab[K,void],DITab[K,void] proc `-`[K](s1, s2: DITab[K, void]): DITab[K, void] 264 +nim `-+-` adix/ditab.html#-+-,DITab[K,void],DITab[K,void] proc `-+-`[K](s1, s2: DITab[K, void]): DITab[K, void] 267 +nim disjoint adix/ditab.html#disjoint,DITab[K,void],DITab[K,void] proc disjoint[K](s1, s2: DITab[K, void]): bool 270 +nim `<=` adix/ditab.html#<=,DITab[K,void],DITab[K,void] proc `<=`[K](s, t: DITab[K, void]): bool 275 +nim `<` adix/ditab.html#<,DITab[K,void],DITab[K,void] proc `<`[K](s, t: DITab[K, void]): bool 281 +nim `==` adix/ditab.html#==,DITab[K,void],DITab[K,void] proc `==`[K](s, t: DITab[K, void]): bool 284 +nim map adix/ditab.html#map,DITab[K,void],proc(K) proc map[K, A](data: DITab[K, void]; op: proc (x: K): A {.closure.}): DITab[A, void] 287 +nim toDITab adix/ditab.html#toDITab,openArray[K] proc toDITab[K](keys: openArray[K]; dups = false): DITab[K, void] 292 +nim `$` adix/ditab.html#$,DITab[K,void] proc `$`[K](s: DITab[K, void]): string 297 +nim hash adix/ditab.html#hash,DITab[K,void] proc hash[K](s: DITab[K, void]): Hash 305 +nim depthStats adix/ditab.html#depthStats,DITab[K,V] proc depthStats[K, V](s: DITab[K, V]): tuple[m1, m2: float, mx: int] 309 +nim toDITab adix/ditab.html#toDITab,openArray[] proc toDITab[K, V: not void](pairs: openArray[(K, V)]; dups = false): DITab[K, V] 312 +nim `$` adix/ditab.html#$,DITab[K: not void,V: not void] proc `$`[K, V: not void](t: DITab[K, V]): string 317 +nim pop adix/ditab.html#pop,DITab[K: not void,V: not void],K,V proc pop[K, V: not void](t: var DITab[K, V]; key: K; val: var V): bool 327 +nim withValue adix/ditab.html#withValue.t,DITab[K,V],K,untyped,untyped template withValue[K, V](t: var DITab[K, V]; key: K; value, body: untyped) 330 +nim withValue adix/ditab.html#withValue.t,DITab[K,V],K,untyped,untyped,untyped template withValue[K, V](t: var DITab[K, V]; key: K; value, body1, body2: untyped) 337 +nim `[]` adix/ditab.html#[],DITab[K,V],K proc `[]`[K, V](t: DITab[K, V]; key: K): V 345 +nim `[]` adix/ditab.html#[],DITab[K,V],K_2 proc `[]`[K, V](t: var DITab[K, V]; key: K): var V 351 +nim `[]=` adix/ditab.html#[]=,DITab[K,V],K,V proc `[]=`[K, V](t: var DITab[K, V]; key: K; val: V) 357 +nim `{}` adix/ditab.html#{},DITab[K,V],K proc `{}`[K, V](t: DITab[K, V]; key: K): V 361 +nim `{}` adix/ditab.html#{},DITab[K,V],K_2 proc `{}`[K, V](t: var DITab[K, V]; key: K): var V 362 +nim `{}=` adix/ditab.html#{}=,DITab[K,V],K,V proc `{}=`[K, V](t: var DITab[K, V]; key: K; val: V) 363 +nim hasKey adix/ditab.html#hasKey,DITab[K,V],K proc hasKey[K, V](t: DITab[K, V]; key: K): bool 365 +nim hasKeyOrPut adix/ditab.html#hasKeyOrPut,DITab[K,V],K,V proc hasKeyOrPut[K, V](t: var DITab[K, V]; key: K; val: V): bool 367 +nim getOrDefault adix/ditab.html#getOrDefault,DITab[K,V],K,typeof(default(V)) proc getOrDefault[K, V](t: DITab[K, V]; key: K; default = default(V)): V 370 +nim del adix/ditab.html#del,DITab[K,V],K proc del[K, V](t: var DITab[K, V]; key: K) 375 +nim `==` adix/ditab.html#==,DITab[K,V],DITab[K,V] proc `==`[K, V](x, y: DITab[K, V]): bool 380 +nim indexBy adix/ditab.html#indexBy,A,proc(V) proc indexBy[A, K, V](collection: A; index: proc (x: V): K): DITab[K, V] 388 +nim editKey adix/ditab.html#editKey,DITab[K,V],K,K proc editKey[K, V](t: var DITab[K, V]; old, new: K) 392 +nim nthKey adix/ditab.html#nthKey,DITab[K,void],int proc nthKey[K](t: DITab[K, void]; n: int): K 403 +nim nthPair adix/ditab.html#nthPair,DITab[K: not void,V: not void],int proc nthPair[K, V: not void](t: DITab[K, V]; n: int): (K, V) 406 +nim nthPair adix/ditab.html#nthPair,DITab[K: not void,V: not void],int_2 proc nthPair[K, V: not void](t: var DITab[K, V]; n: int): (K, ptr V) 410 +nim inc adix/ditab.html#inc,DITab[K: SomeInteger,V: SomeInteger],K,SomeInteger proc inc[K, V: SomeInteger](t: var DITab[K, V]; key: K; amount: SomeInteger = 1) 417 +nim merge adix/ditab.html#merge,DITab[K: SomeInteger,V: SomeInteger],DITab[K: SomeInteger,V: SomeInteger] proc merge[K, V: SomeInteger](c: var DITab[K, V]; b: DITab[K, V]) 425 +nim topByVal adix/ditab.html#topByVal.i,DITab[K,V],int iterator topByVal[K, V](c: DITab[K, V]; n = 10; min = V.low; order = Cheap): (K, V) 428 +nim initDISet adix/ditab.html#initDISet,int proc initDISet[K](initialSize = 0; numer = diNumer; denom = diDenom;\n minFree = diMinFree; growPow2 = diGrowPow2; rehash = diRehash;\n robinhood = diRobinHood): DISet[K] 433 +nimgrp pop adix/ditab.html#pop-procs-all proc 173 +nimgrp $ adix/ditab.html#$-procs-all proc 297 +nimgrp toditab adix/ditab.html#toDITab-procs-all proc 292 +nimgrp incl adix/ditab.html#incl-procs-all proc 225 +nimgrp nthpair adix/ditab.html#nthPair-procs-all proc 406 +nimgrp take adix/ditab.html#take-procs-all proc 162 +nimgrp mgetorput adix/ditab.html#mgetOrPut-procs-all proc 136 +nimgrp {} adix/ditab.html#{}-procs-all proc 361 +nimgrp excl adix/ditab.html#excl-procs-all proc 228 +nimgrp == adix/ditab.html#==-procs-all proc 284 +nimgrp [] adix/ditab.html#[]-procs-all proc 345 +nimgrp pairs adix/ditab.html#pairs-iterators-all iterator 189 +nimgrp withvalue adix/ditab.html#withValue-templates-all template 330 diff --git a/adix/lghisto.html b/adix/lghisto.html new file mode 100644 index 0000000..1149357 --- /dev/null +++ b/adix/lghisto.html @@ -0,0 +1,466 @@ + + + + + + + +adix/lghisto + + + + + + + + + + + + +
+
+

adix/lghisto

+
+ +
+ Source   +Edit   + +
+ +

LgHisto is a simple application of BISTs to log-spaced histograms that can yield efficient, dynamic quantiles. log-spacing supports high dynamic range without inordinate cost while Fenwick/BIST supports dynamic membership with operation-balanced perf.

+

Quantile error is absolute {not relative to q*(1-q) like a t-Digest} & easily bounded as <~ 1/2 bin width {about 10^(lg(b/a)/n/2)}. So, if you need 3 places or your data is clustered within a few orders of magnitude then you can likely just use 1e4 bins and your counters will remain very L1 cache resident, depending upon resource competition. Cache is the main cost Re: speed. Re: space, since 99% of bins are 0 in many cases, net/disk transfer cost can be improved via simple run-length encoding.

+

The way Fenwick BISTs work, the generic parameter C must be a wide enough integer type to hold both elemental bin counts AND grand totals. uint32 is likely enough for many applications, though some might sneak by with uint16 and a few might need uint64. This scales bin size/space cost.

+

t-Digests are a well marketed competitor using ~10X less space BUT with >>5X slower quantiles of similar accuracy. Actual cost is sensitive to operation mixes. { This may change, but present t-Digest impls, even with trees, linear scan for quantile/CDFs. None even offer "batch" APIs to do N quantiles in one such scan. "Histo B-trees" should allow better scaling for such. } A BIST basis differs from t-Digests in other important ways. First, BISTs are well suited for pop or moving data window operations with strict finite memory, for e.g. translation of full streams to moving quantiles as in Bollinger Band style smooths. Second, floating point weights for EWMA-like decaying memory are not possible since FP arithmetic kind of breaks BISTs.

+

+
+

Imports

+
+ bist +
+
+
+

Types

+
+
+
LgHisto[C] = object
+
+ + Log-spaced histogram with Bist[C] backing + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc `$`[C](s: LgHisto[C]; nonZero = true): string
+
+ + Formatting operator; Warning: output can be large, esp. if nonZero=false + Source   +Edit   + +
+
+ +
+
+
+
func add[F, C](s: var LgHisto[C]; x: F; w = 1.C)
+
+ + Increment bin for value x by weight w + Source   +Edit   + +
+
+ +
+
+
+
func binAB[F, C](s: LgHisto[C]; x: F): (float, float)
+
+ + Range in data space of the bin containing x; Costs 2 fromIxs. + Source   +Edit   + +
+
+ +
+
+
+
func bist[C](s: LgHisto[C]): Bist[C]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func cdf[F, C](s: LgHisto[C]; x: F): C
+
+ + Raw count; Leave to caller to multiply by 1/s.bist.count; XXX Interpolate? + Source   +Edit   + +
+
+ +
+
+
+
func fromIx[F, C](s: LgHisto[C]; i: int; offset: F = 0.5): F
+
+ + Geometric mean of left&right edge log-shifted offset fraction into bin + Source   +Edit   + +
+
+ +
+
+
+
func high[C](s: LgHisto[C]): float
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func init[C](s: var LgHisto[C]; a = 1e-16; b = 1e+20; n = 8300)
+
+ + Init histo w/2n+1 log-spaced bins: [-∞..-b; -b..-a; 0; a..<b; b..∞]. + Source   +Edit   + +
+
+ +
+
+
+
func initLgHisto[C](a = 1e-16; b = 1e+20; n = 8300): LgHisto[C]
+
+ + Get Histo w/2n+1 log-spaced bins: [-inf..<-b; -b..<-a; 0; a..<b; b..inf]. + Source   +Edit   + +
+
+ +
+
+
+
func low[C](s: LgHisto[C]): float
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func merge[C](dst: var LgHisto[C]; src: LgHisto[C])
+
+ + Merge counts from src into dst. + Source   +Edit   + +
+
+ +
+
+
+
func nBin[C](s: LgHisto[C]): int
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func overflows[C](s: LgHisto[C]): int
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func pop[F, C](s: var LgHisto[C]; x: F; w = 1.C)
+
+ + Alias for add with a negative weight argument + Source   +Edit   + +
+
+ +
+
+
+
func quantile[F, C](s: LgHisto[C]; q: F): F
+
+ + Basic quantile; XXX Can log-spacing savvy interpolation be more accurate? + Source   +Edit   + +
+
+ +
+
+
+
func space[C](s: LgHisto[C]): int
+
+ + Estimate space taken up by data structure in bytes + Source   +Edit   + +
+
+ +
+
+
+
func toIx[F, C](s: LgHisto[C]; x: F): int
+
+ + Find bin index for value x; underflows get [0] & overflows get [2*n]. + Source   +Edit   + +
+
+ +
+
+
+
func underflows[C](s: LgHisto[C]): int
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator bins[C](s: LgHisto[C]): (float, float, C)
+
+ + Yield (lo, hi, count) for each bin covered + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/lghisto.idx b/adix/lghisto.idx new file mode 100644 index 0000000..6f45125 --- /dev/null +++ b/adix/lghisto.idx @@ -0,0 +1,21 @@ +nimTitle lghisto adix/lghisto.html module adix/lghisto 0 +nim LgHisto adix/lghisto.html#LgHisto object LgHisto 33 +nim underflows adix/lghisto.html#underflows,LgHisto[C] proc underflows[C](s: LgHisto[C]): int 41 +nim overflows adix/lghisto.html#overflows,LgHisto[C] proc overflows[C](s: LgHisto[C]): int 42 +nim low adix/lghisto.html#low,LgHisto[C] proc low[C](s: LgHisto[C]): float 43 +nim high adix/lghisto.html#high,LgHisto[C] proc high[C](s: LgHisto[C]): float 44 +nim nBin adix/lghisto.html#nBin,LgHisto[C] proc nBin[C](s: LgHisto[C]): int 45 +nim bist adix/lghisto.html#bist,LgHisto[C] proc bist[C](s: LgHisto[C]): Bist[C] 46 +nim init adix/lghisto.html#init,LgHisto[C],float,float,int proc init[C](s: var LgHisto[C]; a = 1e-16; b = 1e+20; n = 8300) 48 +nim initLgHisto adix/lghisto.html#initLgHisto,float,float,int proc initLgHisto[C](a = 1e-16; b = 1e+20; n = 8300): LgHisto[C] 61 +nim space adix/lghisto.html#space,LgHisto[C] proc space[C](s: LgHisto[C]): int 64 +nim toIx adix/lghisto.html#toIx,LgHisto[C],F proc toIx[F, C](s: LgHisto[C]; x: F): int 67 +nim fromIx adix/lghisto.html#fromIx,LgHisto[C],int,F proc fromIx[F, C](s: LgHisto[C]; i: int; offset: F = 0.5): F 77 +nim binAB adix/lghisto.html#binAB,LgHisto[C],F proc binAB[F, C](s: LgHisto[C]; x: F): (float, float) 83 +nim add adix/lghisto.html#add,LgHisto[C],F proc add[F, C](s: var LgHisto[C]; x: F; w = 1.C) 94 +nim pop adix/lghisto.html#pop,LgHisto[C],F proc pop[F, C](s: var LgHisto[C]; x: F; w = 1.C) 98 +nim bins adix/lghisto.html#bins.i,LgHisto[C] iterator bins[C](s: LgHisto[C]): (float, float, C) 102 +nim `$` adix/lghisto.html#$,LgHisto[C] proc `$`[C](s: LgHisto[C]; nonZero = true): string 112 +nim quantile adix/lghisto.html#quantile,LgHisto[C],F proc quantile[F, C](s: LgHisto[C]; q: F): F 126 +nim cdf adix/lghisto.html#cdf,LgHisto[C],F proc cdf[F, C](s: LgHisto[C]; x: F): C 133 +nim merge adix/lghisto.html#merge,LgHisto[C],LgHisto[C] proc merge[C](dst: var LgHisto[C]; src: LgHisto[C]) 137 diff --git a/adix/lptabz.html b/adix/lptabz.html new file mode 100644 index 0000000..d7b9868 --- /dev/null +++ b/adix/lptabz.html @@ -0,0 +1,1985 @@ + + + + + + + +adix/lptabz + + + + + + + + + + + + +
+
+

adix/lptabz

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This module provides an (in|un)ordered multiset/multitable representation via Linear Probing with aging-friendly Backshift Delete(Knuth TAOCPv3) & optional Robin Hood re-org (Celis,1986). Linear probing collision clusters yields "no tuning needed" locality of reference: 1 DRAM hit per access for large tables of small items. RH sorts collision clusters by search depth which adds nice properties: faster miss search (eg. for inserts, usually compensating for data motion) and min depth variance (no unlucky keys). The latter enables ~100% table space utilization (we need one empty slot to halt some loops).

+

Misuse/attack is always possible. Inserting many duplicate causes overlong scans just as hash collisions do and is thus misuse/self-attack. If this is likely then use V=seq[T] instead. We provide a few mitigations triggered, like table growth itself, by overlong scans on underfull tables:

+
  1. automatic rehash of user hash output with a strong integer hash,
  2. +
  3. overlong scan warnings (disabled in danger mode),
  4. +
  5. automatic Robin Hood re-org activation, and
  6. +
  7. use althash.getSalt to allow hard to predict per-table hash salt.
  8. +
+

Program-wide-tunable defaults are to rehash, warn, re-org & salt with vmAddr since this is a safe-ish portable mode, but most can also be set via module globals consulted @init time. -d:unstableHash makes the default getSalt a secure random number via std/sysrand, but debugging may be harder.

+

MultiSET personality ensues when the V value type generic parameter is void. Otherwise the style of interface is multiTABLE. Every attempt is made for either personality to be drop-in compatible with Nim's standard library sets & tables, but extra features are provided here.

+

Space-time optimization of a sentinel key (a value of K disallowed for ordinary keys) is supported through the final two generic parameters, Z, and z. If Z is void, hash codes are saved and z is ignored. If Z==K, z is the sentinel key value.

+

If Z is neither K nor void then compact, insertion-ordered mode is used and z means how many bits of hcode are saved beside an index into a dense seq[(K,V)]. 6..8 bits avoids most "double cache misses" for miss lookups/inserts. z=0 works if space matters more than time.

+

+ +
+

Types

+
+
+
LPSet[K] = LPTabz[K, void, void, 0]
+
+ + LPTabz for no-sentinel Set + Source   +Edit   + +
+
+
+
LPSetz[K; Z; z] = LPTabz[K, void, Z, z]
+
+ + LPTabz for sentinel Set + Source   +Edit   + +
+
+
+
LPTab[K; V] = LPTabz[K, V, void, 0]
+
+ + LPTabz for no-sentinel Tab + Source   +Edit   + +
+
+
+
LPTabz[K; V; Z; z] = object
+  when Z is K or Z is void:
+  else:
+
+ + Robin Hood Hash Set + Source   +Edit   + +
+
+ +
+
+
+

Vars

+
+
+
lpDenom = 1
+
+ + default denominator for lg(n) probe depth limit + Source   +Edit   + +
+
+
+
lpGrowPow2 = 1
+
+ + default growth power of 2; 1 means double + Source   +Edit   + +
+
+
+
lpInitialSize = 2
+
+ + default initial size aka capacity aka cap + Source   +Edit   + +
+
+
+
lpMaxWarn = 10
+
+ + Most warnings per program invocation + Source   +Edit   + +
+
+
+
lpMinFree = 1
+
+ + default min free slots; (>= 1) + Source   +Edit   + +
+
+
+
lpNumer = 3
+
+ + default numerator for lg(n) probe depth limit + Source   +Edit   + +
+
+
+
lpRehash = false
+
+ + default hcode rehashing behavior; auto-activated + Source   +Edit   + +
+
+
+
lpRobinHood = false
+
+ + default to Robin Hood re-org; auto-activated + Source   +Edit   + +
+
+
+
lpWarn = stderr
+
+ + Set to wherever you want warnings to go + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc `$`[K, V: not void; Z; z: static int](t: LPTabz[K, V, Z, z]): string
+
+ + + Source   +Edit   + +
+
+
+
proc `$`[K, Z; z: static int](s: LPTabz[K, void, Z, z]): string
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `*`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z,
+    z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `+`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z,
+    z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `-`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z,
+    z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `-+-`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void,
+    Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `<`[K, Z; z: static int](s, t: LPTabz[K, void, Z, z]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `<=`[K, Z; z: static int](s, t: LPTabz[K, void, Z, z]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `==`[K, V: not void; Z; z: static int](x, y: LPTabz[K, V, Z, z]): bool
+
+ + + Source   +Edit   + +
+
+
+
proc `==`[K, Z; z: static int](s, t: LPTabz[K, void, Z, z]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]`[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): V {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc `[]`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K): var V {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]=`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V) {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc add[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V) {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc add[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: K) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc allValues[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K;
+                                       vals: var seq[V]): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc card[K, Z; z: static int](s: LPTabz[K, void, Z, z]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc clear[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z])
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc contains[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): bool {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc containsOrIncl[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: K): bool {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc debugDump[K, V, Z; z: static int](s: LPTabz[K, V, Z, z]; label = "")
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc del[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K) {.inline.}
+
+ + delete one key key from t; If you want to know if it was present then use missingOrExcl, take, or pop instead. + Source   +Edit   + +
+
+ +
+
+
+
proc depths[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): seq[int]
+
+ + Compute & return exact distribution of search depths over a set + Source   +Edit   + +
+
+ +
+
+
+
proc depthStats[K, V, Z; z: static int](s: LPTabz[K, V, Z, z]): tuple[
+    m1, m2: float, mx: int]
+
+ + Performance Forensics + Source   +Edit   + +
+
+ +
+
+
+
proc difference[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K,
+    void, Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc disjoint[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc editKey[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; old, new: K)
+
+ + Insertion-ordered tables support editing keys while keeping iteration order. + Source   +Edit   + +
+
+ +
+
+
+
proc excl[K, Z; z: static int](s: var LPTabz[K, void, Z, z];
+                               other: LPTabz[K, void, Z, z])
+
+ + + Source   +Edit   + +
+
+
+
proc excl[K, Z; z: static int](s: var LPTabz[K, void, Z, z]; elt: K) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getCap[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getOrDefault[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K;
+    default = default(V)): V {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hash[K, Z; z: static int](s: LPTabz[K, void, Z, z]): Hash
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hasKey[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): bool {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hasKeyOrPut[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;
+    val: V): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc inc[K, V, Z; z: static int](c: var LPTabz[K, V, Z, z]; key: K;
+                                 amount: V = 1) {.inline.}
+
+ + Increment a key counter in table t by amount. + Source   +Edit   + +
+
+ +
+
+
+
proc incl[K, Z; z: static int](s: var LPTabz[K, void, Z, z];
+                               other: LPTabz[K, void, Z, z])
+
+ + + Source   +Edit   + +
+
+
+
proc incl[K, Z; z: static int](s: var LPTabz[K, void, Z, z]; elt: K) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc indexBy[A, K, V, Z; z: static int](collection: A; index: proc (x: V): K): LPTabz[
+    K, V, Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc init[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z];
+                                  initialSize = lpInitialSize; numer = lpNumer;
+                                  denom = lpDenom; minFree = lpMinFree;
+                                  growPow2 = lpGrowPow2; rehash = lpRehash;
+                                  robinhood = lpRobinHood) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc initLPSet[K](initialSize = lpInitialSize; numer = lpNumer; denom = lpDenom;
+                  minFree = lpMinFree; growPow2 = lpGrowPow2; rehash = lpRehash;
+                  robinhood = lpRobinHood): LPSet[K] {.inline.}
+
+ + Return an LPTabz specialized to sets with no sentinel key. See initLPTabz for parameter details. + Source   +Edit   + +
+
+ +
+
+
+
proc initLPSetz[K, Z; z: static int](initialSize = lpInitialSize;
+                                     numer = lpNumer; denom = lpDenom;
+                                     minFree = lpMinFree; growPow2 = lpGrowPow2;
+                                     rehash = lpRehash; robinhood = lpRobinHood): LPSetz[
+    K, Z, z] {.inline.}
+
+ + Return an LPTabz specialized to sets with a sentinel key. See initLPTabz for parameter details. + Source   +Edit   + +
+
+ +
+
+
+
proc initLPTab[K, V](initialSize = lpInitialSize; numer = lpNumer;
+                     denom = lpDenom; minFree = lpMinFree;
+                     growPow2 = lpGrowPow2; rehash = lpRehash;
+                     robinhood = lpRobinHood): LPTab[K, V] {.inline.}
+
+ + Return an LPTabz specialized to tables with no sentinel key. See initLPTabz for parameter details. + Source   +Edit   + +
+
+ +
+
+
+
proc initLPTabz[K, V, Z; z: static int](initialSize = lpInitialSize;
+                                        numer = lpNumer; denom = lpDenom;
+                                        minFree = lpMinFree;
+                                        growPow2 = lpGrowPow2;
+                                        rehash = lpRehash;
+                                        robinhood = lpRobinHood): LPTabz[K, V,
+    Z, z] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc intersection[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K,
+    void, Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc len[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): int {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc load[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; path: string)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc loadLPTabz[K, V, Z; z: static int](path: string): LPTabz[K, V, Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc map[K, A, Z; z: static int](data: LPTabz[K, void, Z, z];
+                                 op: proc (x: K): A {.closure.}): LPTabz[A,
+    void, Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc merge[K, V, Z; z: static int](c: var LPTabz[K, V, Z, z];
+                                   b: LPTabz[K, V, Z, z])
+
+ + Merge values from CountTable/histogram b into histogram c. + Source   +Edit   + +
+
+ +
+
+
+
proc mgetOrPut[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V): var V {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc mgetOrPut[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;
+                                       val: V; had: var bool): var V {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc missingOrExcl[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc mmap[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; path: string)
+
+ + NOTE: Read-Only memory map; Attempted edits => run-time errors (like SEGV). + Source   +Edit   + +
+
+ +
+
+
+
proc nthKey[K, Z; z: static int](t: LPTabz[K, void, Z, z]; n: int): K {.inline.}
+
+ + Insertion-ordered multisets support 0-origin nth-in-order key. + Source   +Edit   + +
+
+ +
+
+
+
proc nthPair[K, V: not void; Z; z: static int](t: LPTabz[K, V, Z, z]; n: int): (
+    K, V)
+
+ + Insertion-ordered tables support 0-origin nth-in-order pair. + Source   +Edit   + +
+
+
+
proc nthPair[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]; n: int): (
+    K, ptr V) {.inline.}
+
+ + Insertion-ordered tables support 0-origin nth-in-order pair w/editable val. + Source   +Edit   + +
+
+ +
+
+
+
proc numItems[K, Z; z: static int](t: LPTabz[K, void, Z, z]; key: K): int {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc pop[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]): (K, V) {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc pop[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;
+    val: var V): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc pop[K, Z; z: static int](s: var LPTabz[K, void, Z, z]; key: var K): bool
+
+ + + Source   +Edit   + +
+
+
+
proc pop[K, Z; z: static int](t: var LPTabz[K, void, Z, z]): K {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc rightSize(count: int; numer = 0; denom = 0; minFree = 0): int {.inline,
+    ...deprecated: "Deprecated since 0.2; identity function", raises: [], tags: [],
+    forbids: [].}
+
+
+ Deprecated: Deprecated since 0.2; identity function +
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc save[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; pathStub: string)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc setCap[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; newSize = -1)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc setOrIncl[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: K): bool {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc setPolicy[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z];
+                                       numer = lpNumer; denom = lpDenom;
+                                       minFree = lpMinFree;
+                                       growPow2 = lpGrowPow2; rehash = lpRehash;
+                                       robinhood = lpRobinHood) {.inline.}
+
+ + Must call setCap after changing certain params here (e.g. rehash). + Source   +Edit   + +
+
+ +
+
+
+
proc symmetricDifference[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[
+    K, void, Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc take[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;
+    val: var V): bool {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc take[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: var K): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc toLPTabz[K; V: not void; Z; z: static int](pairs: openArray[(K, V)];
+    dups = false): LPTabz[K, V, Z, z]
+
+ + + Source   +Edit   + +
+
+
+
proc toLPTabz[K; V: void; Z; z: static int](keys: openArray[K]; dups = false): LPTabz[
+    K, V, Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc union[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void,
+    Z, z]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `{}`[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): V {.inline.}
+
+ + + Source   +Edit   + +
+
+
+
proc `{}`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K): var V {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `{}=`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V) {.
+    inline.}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator allItems[K, Z; z: static int](s: LPTabz[K, void, Z, z]; key: K): K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator allValues[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): V
+
+ + + Source   +Edit   + +
+
+
+
iterator allValues[K, V, Z; z: static int](t: LPTabz[K, V, Z, z];
+    vals: var seq[V]): K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator hcodes[K, Z; z: static int](s: LPTabz[K, void, Z, z]): (int, Hash)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator items[K, Z; z: static int](s: LPTabz[K, void, Z, z]): K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator keys[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator mitems[K, Z; z: static int](s: var LPTabz[K, void, Z, z]): var K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator mostCommon[K](xs: openArray[K]; n = 10): (K, int)
+
+ + Iterate over (n most common values in xs, their counts) tuples. + Source   +Edit   + +
+
+ +
+
+
+
iterator mpairs[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]): (K, var V)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator mvalues[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]): var V
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator numItems[K, Z; z: static int](t: LPTabz[K, void, Z, z]): (K, int)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator pairs[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): (K, V)
+
+ + + Source   +Edit   + +
+
+
+
iterator pairs[K, Z; z: static int](t: LPTabz[K, void, Z, z]): (int, K)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator topByVal[K, V, Z; z: static int](c: LPTabz[K, V, Z, z]; n = 10;
+    min = V.low; order = Cheap): (K, V)
+
+ + Iterate from smallest to largest over biggest n items by value in c. order can be Cheap, Ascending, or Descending. + Source   +Edit   + +
+
+ +
+
+
+
iterator values[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): V
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template editOrInit[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;
+    v, found, missing: untyped): untyped
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
template getItOrFail[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; k: K;
+    found, missing): untyped
+
+ + Provide value it corresponding to key k in found or do missing. + Source   +Edit   + +
+
+ +
+
+
+
template withIt[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; k: K;
+                                        edit, init): untyped
+
+ + Provide value variable it corresponding to key k in both bodies that represents the value found|allocated in the table. + Source   +Edit   + +
+
+ +
+
+
+
template withValue[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;
+    value, found, missing: untyped): untyped
+
+ + + Source   +Edit   + +
+
+
+
template withValue[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;
+    value, found: untyped): untyped
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + + + + + diff --git a/adix/lptabz.idx b/adix/lptabz.idx new file mode 100644 index 0000000..87231a7 --- /dev/null +++ b/adix/lptabz.idx @@ -0,0 +1,124 @@ +nimTitle lptabz adix/lptabz.html module adix/lptabz 0 +nim LPTabz adix/lptabz.html#LPTabz object LPTabz 54 +nim LPSetz adix/lptabz.html#LPSetz type LPSetz 65 +nim LPTab adix/lptabz.html#LPTab type LPTab 66 +nim LPSet adix/lptabz.html#LPSet type LPSet 67 +nim lpInitialSize adix/lptabz.html#lpInitialSize var lpInitialSize 69 +nim lpNumer adix/lptabz.html#lpNumer var lpNumer 70 +nim lpDenom adix/lptabz.html#lpDenom var lpDenom 71 +nim lpMinFree adix/lptabz.html#lpMinFree var lpMinFree 72 +nim lpGrowPow2 adix/lptabz.html#lpGrowPow2 var lpGrowPow2 73 +nim lpRobinHood adix/lptabz.html#lpRobinHood var lpRobinHood 74 +nim lpRehash adix/lptabz.html#lpRehash var lpRehash 75 +nim lpWarn adix/lptabz.html#lpWarn var lpWarn 86 +nim lpMaxWarn adix/lptabz.html#lpMaxWarn var lpMaxWarn 87 +nim save adix/lptabz.html#save,LPTabz[K,V,Z,z],string proc save[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; pathStub: string) 90 +nim load adix/lptabz.html#load,LPTabz[K,V,Z,z],string proc load[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; path: string) 108 +nim loadLPTabz adix/lptabz.html#loadLPTabz,string proc loadLPTabz[K, V, Z; z: static int](path: string): LPTabz[K, V, Z, z] 134 +nim mmap adix/lptabz.html#mmap,LPTabz[K,V,Z,z],string proc mmap[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; path: string) 137 +nim len adix/lptabz.html#len,LPTabz[K,V,Z,z] proc len[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): int 166 +nim getCap adix/lptabz.html#getCap,LPTabz[K,V,Z,z] proc getCap[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): int 184 +nim depths adix/lptabz.html#depths,LPTabz[K,V,Z,z] proc depths[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): seq[int] 331 +nim init adix/lptabz.html#init,LPTabz[K,V,Z,z] proc init[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z];\n initialSize = lpInitialSize; numer = lpNumer;\n denom = lpDenom; minFree = lpMinFree;\n growPow2 = lpGrowPow2; rehash = lpRehash;\n robinhood = lpRobinHood) 442 +nim setCap adix/lptabz.html#setCap,LPTabz[K,V,Z,z],int proc setCap[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; newSize = -1) 465 +nim initLPTabz adix/lptabz.html#initLPTabz proc initLPTabz[K, V, Z; z: static int](initialSize = lpInitialSize; numer = lpNumer;\n denom = lpDenom; minFree = lpMinFree;\n growPow2 = lpGrowPow2; rehash = lpRehash;\n robinhood = lpRobinHood): LPTabz[K, V, Z, z] 539 +nim setPolicy adix/lptabz.html#setPolicy,LPTabz[K,V,Z,z] proc setPolicy[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; numer = lpNumer;\n denom = lpDenom; minFree = lpMinFree;\n growPow2 = lpGrowPow2; rehash = lpRehash;\n robinhood = lpRobinHood) 544 +nim rightSize adix/lptabz.html#rightSize,int,int,int,int proc rightSize(count: int; numer = 0; denom = 0; minFree = 0): int 555 +nim contains adix/lptabz.html#contains,LPTabz[K,V,Z,z],K proc contains[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): bool 558 +nim containsOrIncl adix/lptabz.html#containsOrIncl,LPTabz[K,void,Z,z],K proc containsOrIncl[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: K): bool 562 +nim setOrIncl adix/lptabz.html#setOrIncl,LPTabz[K,void,Z,z],K proc setOrIncl[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: K): bool 567 +nim mgetOrPut adix/lptabz.html#mgetOrPut,LPTabz[K,V,Z,z],K,V proc mgetOrPut[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V): var V 572 +nim mgetOrPut adix/lptabz.html#mgetOrPut,LPTabz[K,V,Z,z],K,V,bool proc mgetOrPut[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V;\n had: var bool): var V 577 +nim editOrInit adix/lptabz.html#editOrInit.t,LPTabz[K,V,Z,z],K,untyped,untyped,untyped template editOrInit[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;\n v, found, missing: untyped): untyped 585 +nim withIt adix/lptabz.html#withIt.t,LPTabz[K,V,Z,z],K,, template withIt[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; k: K; edit, init): untyped 597 +nim getItOrFail adix/lptabz.html#getItOrFail.t,LPTabz[K,V,Z,z],K,, template getItOrFail[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; k: K; found, missing): untyped 609 +nim add adix/lptabz.html#add,LPTabz[K,void,Z,z],K proc add[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: K) 642 +nim add adix/lptabz.html#add,LPTabz[K,V,Z,z],K,V proc add[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V) 645 +nim missingOrExcl adix/lptabz.html#missingOrExcl,LPTabz[K,V,Z,z],K proc missingOrExcl[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K): bool 649 +nim take adix/lptabz.html#take,LPTabz[K,void,Z,z],K proc take[K, Z; z: static int](t: var LPTabz[K, void, Z, z]; key: var K): bool 653 +nim take adix/lptabz.html#take,LPTabz[K: not void,V: not void,Z,z],K,V proc take[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;\n val: var V): bool 657 +nim pop adix/lptabz.html#pop,LPTabz[K,void,Z,z] proc pop[K, Z; z: static int](t: var LPTabz[K, void, Z, z]): K 665 +nim pop adix/lptabz.html#pop,LPTabz[K: not void,V: not void,Z,z] proc pop[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]): (K, V) 677 +nim editKey adix/lptabz.html#editKey,LPTabz[K,V,Z,z],K,K proc editKey[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; old, new: K) 692 +nim nthKey adix/lptabz.html#nthKey,LPTabz[K,void,Z,z],int proc nthKey[K, Z; z: static int](t: LPTabz[K, void, Z, z]; n: int): K 710 +nim nthPair adix/lptabz.html#nthPair,LPTabz[K: not void,V: not void,Z,z],int proc nthPair[K, V: not void; Z; z: static int](t: LPTabz[K, V, Z, z]; n: int): (K, V) 717 +nim nthPair adix/lptabz.html#nthPair,LPTabz[K: not void,V: not void,Z,z],int_2 proc nthPair[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]; n: int): (\n K, ptr V) 724 +nim clear adix/lptabz.html#clear,LPTabz[K,V,Z,z] proc clear[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]) 732 +nim items adix/lptabz.html#items.i,LPTabz[K,void,Z,z] iterator items[K, Z; z: static int](s: LPTabz[K, void, Z, z]): K 765 +nim mitems adix/lptabz.html#mitems.i,LPTabz[K,void,Z,z] iterator mitems[K, Z; z: static int](s: var LPTabz[K, void, Z, z]): var K 768 +nim hcodes adix/lptabz.html#hcodes.i,LPTabz[K,void,Z,z] iterator hcodes[K, Z; z: static int](s: LPTabz[K, void, Z, z]): (int, Hash) 771 +nim allItems adix/lptabz.html#allItems.i,LPTabz[K,void,Z,z],K iterator allItems[K, Z; z: static int](s: LPTabz[K, void, Z, z]; key: K): K 778 +nim numItems adix/lptabz.html#numItems,LPTabz[K,void,Z,z],K proc numItems[K, Z; z: static int](t: LPTabz[K, void, Z, z]; key: K): int 789 +nim numItems adix/lptabz.html#numItems.i,LPTabz[K,void,Z,z] iterator numItems[K, Z; z: static int](t: LPTabz[K, void, Z, z]): (K, int) 792 +nim pairs adix/lptabz.html#pairs.i,LPTabz[K,void,Z,z] iterator pairs[K, Z; z: static int](t: LPTabz[K, void, Z, z]): (int, K) 795 +nim pairs adix/lptabz.html#pairs.i,LPTabz[K,V,Z,z] iterator pairs[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): (K, V) 799 +nim mpairs adix/lptabz.html#mpairs.i,LPTabz[K,V,Z,z] iterator mpairs[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]): (K, var V) 802 +nim keys adix/lptabz.html#keys.i,LPTabz[K,V,Z,z] iterator keys[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): K 805 +nim values adix/lptabz.html#values.i,LPTabz[K,V,Z,z] iterator values[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]): V 808 +nim mvalues adix/lptabz.html#mvalues.i,LPTabz[K,V,Z,z] iterator mvalues[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]): var V 811 +nim allValues adix/lptabz.html#allValues.i,LPTabz[K,V,Z,z],K iterator allValues[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): V 814 +nim allValues adix/lptabz.html#allValues.i,LPTabz[K,V,Z,z],seq[V] iterator allValues[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; vals: var seq[V]): K 822 +nim allValues adix/lptabz.html#allValues,LPTabz[K,V,Z,z],K,seq[V] proc allValues[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K;\n vals: var seq[V]): bool 828 +nim debugDump adix/lptabz.html#debugDump,LPTabz[K,V,Z,z],string proc debugDump[K, V, Z; z: static int](s: LPTabz[K, V, Z, z]; label = "") 834 +nim pop adix/lptabz.html#pop,LPTabz[K,void,Z,z],K proc pop[K, Z; z: static int](s: var LPTabz[K, void, Z, z]; key: var K): bool 846 +nim incl adix/lptabz.html#incl,LPTabz[K,void,Z,z],K proc incl[K, Z; z: static int](s: var LPTabz[K, void, Z, z]; elt: K) 849 +nim excl adix/lptabz.html#excl,LPTabz[K,void,Z,z],K proc excl[K, Z; z: static int](s: var LPTabz[K, void, Z, z]; elt: K) 852 +nim incl adix/lptabz.html#incl,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc incl[K, Z; z: static int](s: var LPTabz[K, void, Z, z];\n other: LPTabz[K, void, Z, z]) 855 +nim excl adix/lptabz.html#excl,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc excl[K, Z; z: static int](s: var LPTabz[K, void, Z, z];\n other: LPTabz[K, void, Z, z]) 859 +nim card adix/lptabz.html#card,LPTabz[K,void,Z,z] proc card[K, Z; z: static int](s: LPTabz[K, void, Z, z]): int 863 +nim union adix/lptabz.html#union,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc union[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z, z] 865 +nim intersection adix/lptabz.html#intersection,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc intersection[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K,\n void, Z, z] 869 +nim difference adix/lptabz.html#difference,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc difference[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void,\n Z, z] 875 +nim symmetricDifference adix/lptabz.html#symmetricDifference,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc symmetricDifference[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[\n K, void, Z, z] 881 +nim `+` adix/lptabz.html#+,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc `+`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z, z] 887 +nim `*` adix/lptabz.html#*,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc `*`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z, z] 889 +nim `-` adix/lptabz.html#-,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc `-`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z, z] 891 +nim `-+-` adix/lptabz.html#-+-,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc `-+-`[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): LPTabz[K, void, Z, z] 893 +nim disjoint adix/lptabz.html#disjoint,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc disjoint[K, Z; z: static int](s1, s2: LPTabz[K, void, Z, z]): bool 896 +nim `<=` adix/lptabz.html#<=,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc `<=`[K, Z; z: static int](s, t: LPTabz[K, void, Z, z]): bool 901 +nim `<` adix/lptabz.html#<,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc `<`[K, Z; z: static int](s, t: LPTabz[K, void, Z, z]): bool 913 +nim `==` adix/lptabz.html#==,LPTabz[K,void,Z,z],LPTabz[K,void,Z,z] proc `==`[K, Z; z: static int](s, t: LPTabz[K, void, Z, z]): bool 916 +nim map adix/lptabz.html#map,LPTabz[K,void,Z,z],proc(K) proc map[K, A, Z; z: static int](data: LPTabz[K, void, Z, z];\n op: proc (x: K): A {.closure.}): LPTabz[A, void, Z,\n z] 929 +nim toLPTabz adix/lptabz.html#toLPTabz,openArray[K] proc toLPTabz[K; V: void; Z; z: static int](keys: openArray[K]; dups = false): LPTabz[\n K, V, Z, z] 934 +nim `$` adix/lptabz.html#$,LPTabz[K,void,Z,z] proc `$`[K, Z; z: static int](s: LPTabz[K, void, Z, z]): string 942 +nim hash adix/lptabz.html#hash,LPTabz[K,void,Z,z] proc hash[K, Z; z: static int](s: LPTabz[K, void, Z, z]): Hash 950 +nim depthStats adix/lptabz.html#depthStats,LPTabz[K,V,Z,z] proc depthStats[K, V, Z; z: static int](s: LPTabz[K, V, Z, z]): tuple[m1, m2: float,\n mx: int] 954 +nim toLPTabz adix/lptabz.html#toLPTabz,openArray[] proc toLPTabz[K; V: not void; Z; z: static int](pairs: openArray[(K, V)];\n dups = false): LPTabz[K, V, Z, z] 970 +nim `$` adix/lptabz.html#$,LPTabz[K: not void,V: not void,Z,z] proc `$`[K, V: not void; Z; z: static int](t: LPTabz[K, V, Z, z]): string 978 +nim pop adix/lptabz.html#pop,LPTabz[K: not void,V: not void,Z,z],K,V proc pop[K, V: not void; Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;\n val: var V): bool 988 +nim withValue adix/lptabz.html#withValue.t,LPTabz[K,V,Z,z],K,untyped,untyped template withValue[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;\n value, found: untyped): untyped 992 +nim withValue adix/lptabz.html#withValue.t,LPTabz[K,V,Z,z],K,untyped,untyped,untyped template withValue[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K;\n value, found, missing: untyped): untyped 1000 +nim `[]` adix/lptabz.html#[],LPTabz[K,V,Z,z],K proc `[]`[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): V 1009 +nim `[]` adix/lptabz.html#[],LPTabz[K,V,Z,z],K_2 proc `[]`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K): var V 1015 +nim `[]=` adix/lptabz.html#[]=,LPTabz[K,V,Z,z],K,V proc `[]=`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V) 1022 +nim `{}` adix/lptabz.html#{},LPTabz[K,V,Z,z],K proc `{}`[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): V 1027 +nim `{}` adix/lptabz.html#{},LPTabz[K,V,Z,z],K_2 proc `{}`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K): var V 1029 +nim `{}=` adix/lptabz.html#{}=,LPTabz[K,V,Z,z],K,V proc `{}=`[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V) 1031 +nim hasKey adix/lptabz.html#hasKey,LPTabz[K,V,Z,z],K proc hasKey[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K): bool 1034 +nim hasKeyOrPut adix/lptabz.html#hasKeyOrPut,LPTabz[K,V,Z,z],K,V proc hasKeyOrPut[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K; val: V): bool 1037 +nim getOrDefault adix/lptabz.html#getOrDefault,LPTabz[K,V,Z,z],K,typeof(default(V)) proc getOrDefault[K, V, Z; z: static int](t: LPTabz[K, V, Z, z]; key: K;\n default = default(V)): V 1041 +nim del adix/lptabz.html#del,LPTabz[K,V,Z,z],K proc del[K, V, Z; z: static int](t: var LPTabz[K, V, Z, z]; key: K) 1047 +nim `==` adix/lptabz.html#==,LPTabz[K: not void,V: not void,Z,z],LPTabz[K: not void,V: not void,Z,z] proc `==`[K, V: not void; Z; z: static int](x, y: LPTabz[K, V, Z, z]): bool 1052 +nim indexBy adix/lptabz.html#indexBy,A,proc(V) proc indexBy[A, K, V, Z; z: static int](collection: A; index: proc (x: V): K): LPTabz[\n K, V, Z, z] 1067 +nim inc adix/lptabz.html#inc,LPTabz[K,V,Z,z],K,V proc inc[K, V, Z; z: static int](c: var LPTabz[K, V, Z, z]; key: K; amount: V = 1) 1073 +nim merge adix/lptabz.html#merge,LPTabz[K,V,Z,z],LPTabz[K,V,Z,z] proc merge[K, V, Z; z: static int](c: var LPTabz[K, V, Z, z]; b: LPTabz[K, V, Z, z]) 1082 +nim topByVal adix/lptabz.html#topByVal.i,LPTabz[K,V,Z,z],int iterator topByVal[K, V, Z; z: static int](c: LPTabz[K, V, Z, z]; n = 10; min = V.low;\n order = Cheap): (K, V) 1086 +nim mostCommon adix/lptabz.html#mostCommon.i,openArray[K],int iterator mostCommon[K](xs: openArray[K]; n = 10): (K, int) 1094 +nim initLPSetz adix/lptabz.html#initLPSetz proc initLPSetz[K, Z; z: static int](initialSize = lpInitialSize; numer = lpNumer;\n denom = lpDenom; minFree = lpMinFree;\n growPow2 = lpGrowPow2; rehash = lpRehash;\n robinhood = lpRobinHood): LPSetz[K, Z, z] 1101 +nim initLPSet adix/lptabz.html#initLPSet proc initLPSet[K](initialSize = lpInitialSize; numer = lpNumer; denom = lpDenom;\n minFree = lpMinFree; growPow2 = lpGrowPow2; rehash = lpRehash;\n robinhood = lpRobinHood): LPSet[K] 1108 +nim initLPTab adix/lptabz.html#initLPTab proc initLPTab[K, V](initialSize = lpInitialSize; numer = lpNumer; denom = lpDenom;\n minFree = lpMinFree; growPow2 = lpGrowPow2; rehash = lpRehash;\n robinhood = lpRobinHood): LPTab[K, V] 1115 +nimgrp pop adix/lptabz.html#pop-procs-all proc 665 +nimgrp $ adix/lptabz.html#$-procs-all proc 942 +nimgrp add adix/lptabz.html#add-procs-all proc 642 +nimgrp incl adix/lptabz.html#incl-procs-all proc 849 +nimgrp nthpair adix/lptabz.html#nthPair-procs-all proc 717 +nimgrp take adix/lptabz.html#take-procs-all proc 653 +nimgrp mgetorput adix/lptabz.html#mgetOrPut-procs-all proc 572 +nimgrp {} adix/lptabz.html#{}-procs-all proc 1027 +nimgrp excl adix/lptabz.html#excl-procs-all proc 852 +nimgrp tolptabz adix/lptabz.html#toLPTabz-procs-all proc 934 +nimgrp == adix/lptabz.html#==-procs-all proc 916 +nimgrp [] adix/lptabz.html#[]-procs-all proc 1009 +nimgrp pairs adix/lptabz.html#pairs-iterators-all iterator 795 +nimgrp allvalues adix/lptabz.html#allValues-iterators-all iterator 814 +nimgrp withvalue adix/lptabz.html#withValue-templates-all template 992 diff --git a/adix/memutil.html b/adix/memutil.html new file mode 100644 index 0000000..203e74b --- /dev/null +++ b/adix/memutil.html @@ -0,0 +1,125 @@ + + + + + + + +adix/memutil + + + + + + + + + + + + +
+
+

adix/memutil

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+
+

Procs

+
+
+
+
proc pullDown[T](x: var seq[T]; i, n: int) {.inline.}
+
+ + move n items down 1; i.e. x[i..i+n-1] = x[i+1..i+n] + Source   +Edit   + +
+
+ +
+
+
+
proc pushUp[T](x: var seq[T]; i, n: int) {.inline.}
+
+ + move n items up 1; i.e. x[i+1..i+n] = x[i..i+n-1] + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/memutil.idx b/adix/memutil.idx new file mode 100644 index 0000000..476bc49 --- /dev/null +++ b/adix/memutil.idx @@ -0,0 +1,3 @@ +nimTitle memutil adix/memutil.html module adix/memutil 0 +nim pushUp adix/memutil.html#pushUp,seq[T],int,int proc pushUp[T](x: var seq[T]; i, n: int) 23 +nim pullDown adix/memutil.html#pullDown,seq[T],int,int proc pullDown[T](x: var seq[T]; i, n: int) 29 diff --git a/adix/metab.html b/adix/metab.html new file mode 100644 index 0000000..aab07ec --- /dev/null +++ b/adix/metab.html @@ -0,0 +1,246 @@ + + + + + + + +adix/metab + + + + + + + + + + + + +
+
+

adix/metab

+
+ +
+ Source   +Edit   + +
+ +

This module provides an easy way to do compile-time switched impl swaps for various table/set reprs with various compile-time switched defaults. You should really just learn how to use LPTabz[..] directly, though.

+
+

Imports

+
+ lptabz +
+
+
+

Types

+
+
+
Set[K] = LPTabz[K, void, void, 0]
+
+ + + Source   +Edit   + +
+
+
+
Tab[K; V] = LPTabz[K, V, void, 0]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc initSet[K](sz = lpInitialSize; numer = lpNumer; denom = lpDenom;
+                minFree = lpMinFree; growPow2 = lpGrowPow2; rehash = rDefault;
+                robinHood = rhDefault): Set[K] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc initTab[K, V](sz = lpInitialSize; numer = lpNumer; denom = lpDenom;
+                   minFree = lpMinFree; growPow2 = lpGrowPow2;
+                   rehash = rDefault; robinHood = rhDefault): Tab[K, V] {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc rightSz(x: Natural): int {.inline, ...deprecated: "Only identity now",
+                                raises: [], tags: [], forbids: [].}
+
+
+ Deprecated: Only identity now +
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc toSet[K](keys: openArray[K]; dups = false): Set[K]
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc toTab[K, V](pairs: openArray[(K, V)]; dups = false): Tab[K, V]
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + + + + + diff --git a/adix/metab.idx b/adix/metab.idx new file mode 100644 index 0000000..c1c65f1 --- /dev/null +++ b/adix/metab.idx @@ -0,0 +1,8 @@ +nimTitle metab adix/metab.html module adix/metab 0 +nim rightSz adix/metab.html#rightSz,Natural proc rightSz(x: Natural): int 16 +nim Tab adix/metab.html#Tab type Tab 1 +nim initTab adix/metab.html#initTab proc initTab[K, V](sz = lpInitialSize; numer = lpNumer; denom = lpDenom;\n minFree = lpMinFree; growPow2 = lpGrowPow2; rehash = rDefault;\n robinHood = rhDefault): Tab[K, V] 3 +nim toTab adix/metab.html#toTab,openArray[] proc toTab[K, V](pairs: openArray[(K, V)]; dups = false): Tab[K, V] 8 +nim Set adix/metab.html#Set type Set 15 +nim initSet adix/metab.html#initSet proc initSet[K](sz = lpInitialSize; numer = lpNumer; denom = lpDenom;\n minFree = lpMinFree; growPow2 = lpGrowPow2; rehash = rDefault;\n robinHood = rhDefault): Set[K] 17 +nim toSet adix/metab.html#toSet,openArray[K] proc toSet[K](keys: openArray[K]; dups = false): Set[K] 77 diff --git a/adix/mvstat.html b/adix/mvstat.html new file mode 100644 index 0000000..f34b960 --- /dev/null +++ b/adix/mvstat.html @@ -0,0 +1,843 @@ + + + + + + + +adix/mvstat + + + + + + + + + + + + +
+
+

adix/mvstat

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

Summary stats built in running/online fashion (as std/stats) BUT over (maybe) MOVING data windows (via pop) and (sometimes) 50X faster & a million X more accurate. Speed up comes from SIMD auto-vectorization in whole openArray[] calls (in --passC:-ffast-math|-Ofast backend modes) aided by "shift" idea at en.wikipedia.org/wiki/Algorithms_for_calculating_variance (both simpler & faster than Welford). Both var & non-var overloads are provided to allow caching 1.0/n which may be identical-but-expensive (eg. reporting at each cycle of a 1 pop per push (so fixed n) window over data).

+

Note: this all costs more in both time & space than exponentially weighted equivalents but has precise rather than infinite memory which can be nice. I.e., it can perfectly "forget" a large spike when it leaves a window.

+

+
+

Imports

+
+ lghisto +
+
+
+

Types

+
+
+
BasicStats[F] = object
+  n*: int                    ## sample size
+  min*, max*, mean*, sdev*: F ## the usual suspects.
+
+ + Result type for parallel-mergable stats + Source   +Edit   + +
+
+
+
MovingStat[F; C] = object
+  options*: set[Option]
+  n*, n4Inv: int             ## amount of pushed data
+  min*, max*: F
+  lgHisto*: LgHisto[C]
+
+ + Statistical data accumulator + Source   +Edit   + +
+
+
+
Option = enum
+  OrderStats
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc `$`[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): string
+
+ + A string representation of a MovingStat[F,C]. + Source   +Edit   + +
+
+ +
+
+
+
func `+`[F](a, b: BasicStats[F]): BasicStats[F]
+
+ + Operator notation for add. + Source   +Edit   + +
+
+ +
+
+
+
func `+=`[F](a: var BasicStats[F]; b: BasicStats[F])
+
+ + Operator notation for add. + Source   +Edit   + +
+
+ +
+
+
+
func add[F](a: var BasicStats[F]; b: BasicStats[F])
+
+ + Combines two BasicStats. Useful to combine partial result sets. + Source   +Edit   + +
+
+ +
+
+
+
func basicStats[F: SomeFloat](xs: openArray[F]): BasicStats[F] {.
+    codegenDecl: "__attribute__((optimize(\"Ofast\", \"fast-math\"))) $# $#$#".}
+
+ + Some summary stats in 1-pass using vector-CPU instructions, if possible. + Source   +Edit   + +
+
+ +
+
+
+
func cdf[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]; x: float): float {.
+    inline.}
+
+ + Estimated moving CDF(x) + Source   +Edit   + +
+
+ +
+
+
+
func clear[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]) {.inline.}
+
+ + Reset s to same as var s: MovingStat[F,C]. + Source   +Edit   + +
+
+ +
+
+
+
func init[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]; a = 1e-16;
+                                        b = 1e+20; n = 8300;
+                                        options: set[Option] = {}) {.inline.}
+
+ + Initialized a MovingStat[F,C] with a [-b,b] log-spaced histogram. + Source   +Edit   + +
+
+ +
+
+
+
func initMovingStat[F: SomeFloat; C: SomeInteger](a = 1e-16; b = 1e+20;
+    n = 8300; options: set[Option] = {}): MovingStat[F, C] {.inline.}
+
+ + Return initialized MovingStat[F,C] with a [-b,b] log-spaced histogram. + Source   +Edit   + +
+
+ +
+
+
+
func kurtosis[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float {.inline.}
+
+ + Moving excess-relative to Gaussian kurtosis (population) over data window. + Source   +Edit   + +
+
+
+
func kurtosis[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float {.
+    inline.}
+
+ + Moving excess-relative to Gaussian kurtosis (population) over data window. + Source   +Edit   + +
+
+
+
func kurtosis[T: SomeNumber](xs: openArray[T]; accum = 32): float
+
+ + excess kurtosis (population). accum != 32 => 64-bit accumulation. + Source   +Edit   + +
+
+ +
+
+
+
func kurtosisS[F: SomeFloat; C: SomeInteger](s`gensym35: MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func kurtosisS[F: SomeFloat; C: SomeInteger](
+    s`gensym35: var MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func kurtosisS[T: SomeNumber](xs`gensym35: openArray[T]; accum`gensym35 = 32): float
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func mean[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float {.inline.}
+
+ + Moving mean/average over data window. + Source   +Edit   + +
+
+
+
func mean[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float {.inline.}
+
+ + Moving mean/average over data window. + Source   +Edit   + +
+
+
+
func mean[T: SomeNumber](xs: openArray[T]): float {.
+    codegenDecl: "__attribute__((optimize(\"Ofast\", \"fast-math\"))) $# $#$#".}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func nInv[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): F {.inline.}
+
+ + A reciprocal caching 1.0/s.n; cannot update reciprocal. + Source   +Edit   + +
+
+
+
func nInv[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): F {.inline.}
+
+ + A reciprocal caching 1.0/s.n. + Source   +Edit   + +
+
+ +
+
+
+
func pop[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]; x: SomeNumber)
+
+ + Pops (aka removes the influence) of a value x from running sums. + Source   +Edit   + +
+
+ +
+
+
+
func push[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]; x: SomeNumber)
+
+ + Pushes a value x into running sums. + Source   +Edit   + +
+
+ +
+
+
+
func quantile[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]; q: float): float {.
+    inline.}
+
+ + Estimated moving quantile q; E.g. q=0.5 is the moving median. + Source   +Edit   + +
+
+ +
+
+
+
func range[F: SomeFloat](xs: openArray[F]): (F, F) {.
+    codegenDecl: "__attribute__((optimize(\"Ofast\", \"fast-math\"))) $# $#$#".}
+
+ + Data range in 1-pass using vector-CPU instructions, if possible. E.g., let (mn,mx) = x.range. + Source   +Edit   + +
+
+ +
+
+
+
func skewness[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float {.inline.}
+
+ + Moving skewness (population) over data window. + Source   +Edit   + +
+
+
+
func skewness[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float {.
+    inline.}
+
+ + Moving skewness (population) over data window. + Source   +Edit   + +
+
+
+
func skewness[T: SomeNumber](xs: openArray[T]; accum = 32): float
+
+ + skewness (population). accum != 32 => 64-bit accumulation. + Source   +Edit   + +
+
+ +
+
+
+
func skewnessS[F: SomeFloat; C: SomeInteger](s`gensym28: MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func skewnessS[F: SomeFloat; C: SomeInteger](
+    s`gensym28: var MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func skewnessS[T: SomeNumber](xs`gensym28: openArray[T]; accum`gensym28 = 32): float
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func standardDeviation[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float {.
+    inline.}
+
+ + Moving standard deviation (population) over data window. + Source   +Edit   + +
+
+
+
func standardDeviation[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float {.
+    inline.}
+
+ + Moving standard deviation (population) over data window. + Source   +Edit   + +
+
+
+
func standardDeviation[T: SomeNumber](xs: openArray[T]; accum = 32): float
+
+ + standard deviation (population). accum != 32 => 64-bit accumulation. + Source   +Edit   + +
+
+ +
+
+
+
func standardDeviationS[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func standardDeviationS[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func standardDeviationS[T: SomeNumber](xs: openArray[T]; accum = 32): float
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func stderror[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float {.inline.}
+
+ + Moving standard error (standard deviation of the mean) over data window. + Source   +Edit   + +
+
+
+
func stderror[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float {.
+    inline.}
+
+ + Moving standard error (standard deviation of the mean) over data window. + Source   +Edit   + +
+
+
+
func stderror[T: SomeNumber](xs: openArray[T]; accum = 32): float
+
+ + standard error (std dev of the mean). accum != 32 => 64-bit accumulation. + Source   +Edit   + +
+
+ +
+
+
+
func sum[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float {.inline.}
+
+ + Moving sum/total over data window. + Source   +Edit   + +
+
+ +
+
+
+
func variance[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float {.inline.}
+
+ + Moving variance (population) over data window. + Source   +Edit   + +
+
+
+
func variance[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float {.
+    inline.}
+
+ + Moving variance (population) over data window. + Source   +Edit   + +
+
+
+
func variance[T: SomeNumber](xs: openArray[T]; accum = 32): float {.
+    codegenDecl: "__attribute__((optimize(\"Ofast\", \"fast-math\"))) $# $#$#".}
+
+ + variance (population). accum != 32 => 64-bit accumulation. + Source   +Edit   + +
+
+ +
+
+
+
func varianceS[F: SomeFloat; C: SomeInteger](s`gensym21: MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func varianceS[F: SomeFloat; C: SomeInteger](
+    s`gensym21: var MovingStat[F, C]): float
+
+ + + Source   +Edit   + +
+
+
+
func varianceS[T: SomeNumber](xs`gensym21: openArray[T]; accum`gensym21 = 32): float
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/mvstat.idx b/adix/mvstat.idx new file mode 100644 index 0000000..069614e --- /dev/null +++ b/adix/mvstat.idx @@ -0,0 +1,62 @@ +nimTitle mvstat adix/mvstat.html module adix/mvstat 0 +nim OrderStats adix/mvstat.html#OrderStats Option.OrderStats 24 +nim Option adix/mvstat.html#Option enum Option 24 +nim MovingStat adix/mvstat.html#MovingStat object MovingStat 25 +nim BasicStats adix/mvstat.html#BasicStats object BasicStats 31 +nim init adix/mvstat.html#init,MovingStat[F: SomeFloat,C: SomeInteger],float,float,int,set[Option] proc init[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]; a = 1e-16;\n b = 1e+20; n = 8300;\n options: set[Option] = {}) 35 +nim initMovingStat adix/mvstat.html#initMovingStat,float,float,int,set[Option] proc initMovingStat[F: SomeFloat; C: SomeInteger](a = 1e-16; b = 1e+20; n = 8300;\n options: set[Option] = {}): MovingStat[F, C] 41 +nim nInv adix/mvstat.html#nInv,MovingStat[F: SomeFloat,C: SomeInteger] proc nInv[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): F 46 +nim nInv adix/mvstat.html#nInv,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc nInv[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): F 53 +nim clear adix/mvstat.html#clear,MovingStat[F: SomeFloat,C: SomeInteger] proc clear[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]) 57 +nim push adix/mvstat.html#push,MovingStat[F: SomeFloat,C: SomeInteger],SomeNumber proc push[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]; x: SomeNumber) 61 +nim pop adix/mvstat.html#pop,MovingStat[F: SomeFloat,C: SomeInteger],SomeNumber proc pop[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]; x: SomeNumber) 75 +nim quantile adix/mvstat.html#quantile,MovingStat[F: SomeFloat,C: SomeInteger],float proc quantile[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]; q: float): float 86 +nim cdf adix/mvstat.html#cdf,MovingStat[F: SomeFloat,C: SomeInteger],float proc cdf[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]; x: float): float 92 +nim sum adix/mvstat.html#sum,MovingStat[F: SomeFloat,C: SomeInteger] proc sum[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 98 +nim mean adix/mvstat.html#mean,MovingStat[F: SomeFloat,C: SomeInteger] proc mean[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 102 +nim mean adix/mvstat.html#mean,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc mean[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float 105 +nim variance adix/mvstat.html#variance,MovingStat[F: SomeFloat,C: SomeInteger] proc variance[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 109 +nim variance adix/mvstat.html#variance,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc variance[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float 112 +nim standardDeviation adix/mvstat.html#standardDeviation,MovingStat[F: SomeFloat,C: SomeInteger] proc standardDeviation[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 117 +nim standardDeviation adix/mvstat.html#standardDeviation,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc standardDeviation[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float 120 +nim stderror adix/mvstat.html#stderror,MovingStat[F: SomeFloat,C: SomeInteger] proc stderror[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 125 +nim stderror adix/mvstat.html#stderror,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc stderror[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float 128 +nim skewness adix/mvstat.html#skewness,MovingStat[F: SomeFloat,C: SomeInteger] proc skewness[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 137 +nim skewness adix/mvstat.html#skewness,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc skewness[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float 140 +nim kurtosis adix/mvstat.html#kurtosis,MovingStat[F: SomeFloat,C: SomeInteger] proc kurtosis[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 151 +nim kurtosis adix/mvstat.html#kurtosis,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc kurtosis[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float 154 +nim `$` adix/mvstat.html#$,MovingStat[F: SomeFloat,C: SomeInteger] proc `$`[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): string 158 +nim add adix/mvstat.html#add,BasicStats[F],BasicStats[F] proc add[F](a: var BasicStats[F]; b: BasicStats[F]) 168 +nim `+=` adix/mvstat.html#+=,BasicStats[F],BasicStats[F] proc `+=`[F](a: var BasicStats[F]; b: BasicStats[F]) 179 +nim `+` adix/mvstat.html#+,BasicStats[F],BasicStats[F] proc `+`[F](a, b: BasicStats[F]): BasicStats[F] 181 +nim mean adix/mvstat.html#mean,openArray[T] proc mean[T: SomeNumber](xs: openArray[T]): float 189 +nim variance adix/mvstat.html#variance,openArray[T],int proc variance[T: SomeNumber](xs: openArray[T]; accum = 32): float 193 +nim range adix/mvstat.html#range,openArray[F] proc range[F: SomeFloat](xs: openArray[F]): (F, F) 206 +nim basicStats adix/mvstat.html#basicStats,openArray[F] proc basicStats[F: SomeFloat](xs: openArray[F]): BasicStats[F] 218 +nim standardDeviation adix/mvstat.html#standardDeviation,openArray[T],int proc standardDeviation[T: SomeNumber](xs: openArray[T]; accum = 32): float 243 +nim stderror adix/mvstat.html#stderror,openArray[T],int proc stderror[T: SomeNumber](xs: openArray[T]; accum = 32): float 247 +nim skewness adix/mvstat.html#skewness,openArray[T],int proc skewness[T: SomeNumber](xs: openArray[T]; accum = 32): float 251 +nim kurtosis adix/mvstat.html#kurtosis,openArray[T],int proc kurtosis[T: SomeNumber](xs: openArray[T]; accum = 32): float 267 +nim varianceS adix/mvstat.html#varianceS proc varianceS[F: SomeFloat; C: SomeInteger](s`gensym21: MovingStat[F, C]): float 295 +nim varianceS adix/mvstat.html#varianceS_2 proc varianceS[F: SomeFloat; C: SomeInteger](s`gensym21: var MovingStat[F, C]): float 297 +nim varianceS adix/mvstat.html#varianceS,,int proc varianceS[T: SomeNumber](xs`gensym21: openArray[T]; accum`gensym21 = 32): float 301 +nim skewnessS adix/mvstat.html#skewnessS proc skewnessS[F: SomeFloat; C: SomeInteger](s`gensym28: MovingStat[F, C]): float 295 +nim skewnessS adix/mvstat.html#skewnessS_2 proc skewnessS[F: SomeFloat; C: SomeInteger](s`gensym28: var MovingStat[F, C]): float 297 +nim skewnessS adix/mvstat.html#skewnessS,,int proc skewnessS[T: SomeNumber](xs`gensym28: openArray[T]; accum`gensym28 = 32): float 301 +nim kurtosisS adix/mvstat.html#kurtosisS proc kurtosisS[F: SomeFloat; C: SomeInteger](s`gensym35: MovingStat[F, C]): float 295 +nim kurtosisS adix/mvstat.html#kurtosisS_2 proc kurtosisS[F: SomeFloat; C: SomeInteger](s`gensym35: var MovingStat[F, C]): float 297 +nim kurtosisS adix/mvstat.html#kurtosisS,,int proc kurtosisS[T: SomeNumber](xs`gensym35: openArray[T]; accum`gensym35 = 32): float 301 +nim standardDeviationS adix/mvstat.html#standardDeviationS,MovingStat[F: SomeFloat,C: SomeInteger] proc standardDeviationS[F: SomeFloat; C: SomeInteger](s: MovingStat[F, C]): float 302 +nim standardDeviationS adix/mvstat.html#standardDeviationS,MovingStat[F: SomeFloat,C: SomeInteger]_2 proc standardDeviationS[F: SomeFloat; C: SomeInteger](s: var MovingStat[F, C]): float 304 +nim standardDeviationS adix/mvstat.html#standardDeviationS,openArray[T],int proc standardDeviationS[T: SomeNumber](xs: openArray[T]; accum = 32): float 306 +nimgrp skewnesss adix/mvstat.html#skewnessS-procs-all proc 295 +nimgrp stderror adix/mvstat.html#stderror-procs-all proc 125 +nimgrp kurtosis adix/mvstat.html#kurtosis-procs-all proc 151 +nimgrp mean adix/mvstat.html#mean-procs-all proc 102 +nimgrp skewness adix/mvstat.html#skewness-procs-all proc 137 +nimgrp standarddeviations adix/mvstat.html#standardDeviationS-procs-all proc 302 +nimgrp standarddeviation adix/mvstat.html#standardDeviation-procs-all proc 117 +nimgrp ninv adix/mvstat.html#nInv-procs-all proc 46 +nimgrp kurtosiss adix/mvstat.html#kurtosisS-procs-all proc 295 +nimgrp variances adix/mvstat.html#varianceS-procs-all proc 295 +nimgrp variance adix/mvstat.html#variance-procs-all proc 109 diff --git a/adix/nsort.html b/adix/nsort.html new file mode 100644 index 0000000..37d7f11 --- /dev/null +++ b/adix/nsort.html @@ -0,0 +1,269 @@ + + + + + + + +adix/nsort + + + + + + + + + + + + +
+
+

adix/nsort

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This numeric sort module encapsulates sorting by native numeric keys embedded at some offset inside Nim objects of any size (well, <= 256 bytes for char- keyed obs, but you should "tag sort" objects > 64B anyway). This kind of interface allows low overhead generality and enables algorithms specialized to number types. Such algorithms are often many times faster than comparison sorts. The algo is roughly counting sort for 1-Byte keys and for [248]Byte native type keys an LSD radix sort with optional transforms from signed|float domains. This implementation has several sadly rare optimizations.

+

FIRST, total order and order by digit0 is checked in the first histogramming pass to decide if remaining work can be skipped. Hence, if run on an already sorted array, only one read-only pass over the data is done to confirm order. Similarly, items already sorted by digit0 induce no re-ordering write phase. Reverse order is also detected. These non-branching integer comparisons add little work and potentially save a lot.

+

SECOND, only 2 counter buffers are ever needed at once - current pass write pointers & next pass read histogram. Using more wastes limited L1/L2 space and/or shrinks max histogram size (increasing number of passes). The buffers for these two "alternate" histograms just toggle across passes. (A several- histogram-at-once counting pass can also achieve no excess re-fetches, but at higher cache usage. Cache use is same for 2B keys, but only high whole byte constancy can yield skipped 2nd passes. The best 2B method depends on keys.)

+

THIRD, histogram details are optimized. For moderate n, prefix summing histograms into cumulative distribution functions (really output bin offsets) is a dominant cost. So, this impl does SIMD parallel prefix sum. This optim is more effective as more counters fit into vector registers. So, this impl uses the smallest [1248]Byte counter needed for n items & takes care to align the 2 power of 2-sized counter buffers to maximize vector use. Last, a time cost estimate formula & Newton's method is used to decide pass sizes.

+

FOURTH, bits that vary across keys are measured (mask or=(x[i-1] xor x[i])) in the first read-pass. Key-wise constant bits are zero in said mask. Since an array MUST be sorted by constant key bits, smart digit plans can skip them to maybe shrink pass count. pext32/pext64 from Intel's Advanced Bit Manipulation subset (Haswell 2014) are a cheap way to use the above mask. This optimization does not help bitwise non-constant data (other than ease of digit formation afforded by pext). However, this impl is structured so there is almost no added cost to access the potentially large savings. Work on digit plans is ongoing. This optimization is novel to my knowledge. It seems small for an academic paper (maybe optimal digit plans would add enough to discuss) but likely to have been mentioned offhand already. I'd cite a reference if I could and please cite me if you don't have one. How well this does depends strongly upon bit-entropy of keys. Eg., time(2) outputs, over allocated 8B ints, 64-bit VM addrs & positive floats spanning 1..2 octaves may be constant above 12-24 LSbits. Some samples may even get sorted in just one pass! I'd bet much real-world f32 data is 2pass w/b0=12.

+

One undone optimization is multi-threads for counting phases. This can boost L3->L1 read throughput by 2-9x (but since scattered writes are much slower than streaming reads, overall speed-up is likely limited). Another maybe useful optimization is saving transformed keys in the tmp arrays (but this also needs inverse transforms on the final pass & current xforms are already cheap compared to L2 or worse bandwidth costs. So, 5-20% boost, I'd guess.)

+

+
+

Imports

+
+ cpuCT, cumsum +
+
+
+

Types

+
+
+
XForm = enum
+  xfNone, xfRev, xfSgn, xfSgnRev, xfFlt, xfFltRev ## Transforms
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Vars

+
+
+
verb = 0
+
+ + verbosity level + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc nsort(obs, tmp: pointer; n, sz: int; off: uint8; xf: XForm; b0 = 0): pointer {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + Specialization of power-user interface for uint8-width keys. + Source   +Edit   + +
+
+
+
proc nsort[O, W](obs: var openArray[O]; off: W; xf = xfNone; b0 = 0)
+
+ + Radix sort obs by W-width key at in-object offset off, transforming keys according to xf. b0 is the number of bits for the first pass histogram. 0 means use a good default. Uses temporary space equal to the size of obs. Does tiled merge sort for big data. + Source   +Edit   + +
+
+
+
proc nsort[W: Ui248](obs, tmp: pointer; n, sz: int; off: W; xf: XForm; b0 = 0): pointer
+
+ + A power-user interface that allows skipping a final copy back to obs. It uses n to decide what sort algo to use. Returns -1 if reversed. + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template nsortBy(x, field: untyped; b0 = 0): untyped
+
+ +

Convenience template around nsort proc to reduce typing. b0 is the number of bits for the first pass histogram. 0 means use a good default.

+

You can only nsort by one numeric field at a time, but sorts are stable. Do x.nsortBy foo; x.nsortBy bar to do a multi-level sort.

+
import nsort
+var recs = @[(f: 3.0, age: 50), (f: 6.0, age: 30), (f: 5.0, age: 30)]
+recs.nsortBy f         # Multi-level sort by `age` then `f`.  Invoke
+recs.nsortBy age       # ..in REVERSE order of usual comparison-order.
+for r in recs: echo r  # Right output: @[(5.0,30), (6.0,30), (3.0,50)]
+ Source   +Edit   + +
+
+ +
+
+
+
template nsortByRaw(x, field: untyped; b0 = 0): untyped
+
+ + Used by nsortBy for small objects (or directly by users who know what they are doing). + Source   +Edit   + +
+
+ +
+
+
+
template nsortByTag(x, field: untyped; b0 = 0): untyped
+
+ + So-called tag sort used by nsortBy for large objects (or directly by users who know what they are doing). + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/nsort.idx b/adix/nsort.idx new file mode 100644 index 0000000..494728c --- /dev/null +++ b/adix/nsort.idx @@ -0,0 +1,16 @@ +nimTitle nsort adix/nsort.html module adix/nsort 0 +nim xfNone adix/nsort.html#xfNone XForm.xfNone 86 +nim xfRev adix/nsort.html#xfRev XForm.xfRev 86 +nim xfSgn adix/nsort.html#xfSgn XForm.xfSgn 86 +nim xfSgnRev adix/nsort.html#xfSgnRev XForm.xfSgnRev 86 +nim xfFlt adix/nsort.html#xfFlt XForm.xfFlt 86 +nim xfFltRev adix/nsort.html#xfFltRev XForm.xfFltRev 86 +nim XForm adix/nsort.html#XForm enum XForm 86 +nim verb adix/nsort.html#verb var verb 89 +nim nsort adix/nsort.html#nsort,pointer,pointer,int,int,uint8,XForm,int proc nsort(obs, tmp: pointer; n, sz: int; off: uint8; xf: XForm; b0 = 0): pointer 358 +nim nsort adix/nsort.html#nsort,pointer,pointer,int,int,W,XForm,int proc nsort[W: Ui248](obs, tmp: pointer; n, sz: int; off: W; xf: XForm; b0 = 0): pointer 366 +nim nsort adix/nsort.html#nsort,openArray[O],W,int proc nsort[O, W](obs: var openArray[O]; off: W; xf = xfNone; b0 = 0) 424 +nim nsortByRaw adix/nsort.html#nsortByRaw.t,untyped,untyped,int template nsortByRaw(x, field: untyped; b0 = 0): untyped 432 +nim nsortByTag adix/nsort.html#nsortByTag.t,untyped,untyped,int template nsortByTag(x, field: untyped; b0 = 0): untyped 446 +nim nsortBy adix/nsort.html#nsortBy.t,untyped,untyped,int template nsortBy(x, field: untyped; b0 = 0): untyped 456 +nimgrp nsort adix/nsort.html#nsort-procs-all proc 358 diff --git a/adix/oats.html b/adix/oats.html new file mode 100644 index 0000000..9751669 --- /dev/null +++ b/adix/oats.html @@ -0,0 +1,589 @@ + + + + + + + +adix/oats + + + + + + + + + + + + +
+
+

adix/oats

+
+ +
+ Source   +Edit   + +
+ +

+
+

Imports

+
+ bitop, topk +
+
+
+

Types

+
+
+
Oat[K; Q] = concept
+    proc cap(t: Self): int
+    proc keyQ(t: Self; k: K): Q
+    proc key(t: Self; i: int): K
+    proc used(t: Self; i: int): bool
+    proc inUse(c: var Self; n: int)
+    proc inUse(c: Self): int
+
+ + + Source   +Edit   + +
+
+
+
ROat[K; Q] = concept
+    proc cap(t: Self): int
+    proc keyQ(t: Self; k: K): Q
+    proc key(t: Self; i: int): K
+    proc used(t: Self; i: int): bool
+    proc inUse(c: var Self; n: int)
+    proc inUse(c: Self): int
+    proc newOfCap(t: Self; n: int): Self
+    proc copy(t: var Self; i: int; u: Self; j: int)
+    proc setNew(t, u: var Self)
+
+ + + Source   +Edit   + +
+
+
+
VOat[K; Q; V] = concept
+    proc cap(t: Self): int
+    proc keyQ(t: Self; k: K): Q
+    proc key(t: Self; i: int): K
+    proc used(t: Self; i: int): bool
+    proc inUse(c: var Self; n: int)
+    proc inUse(c: Self): int
+    proc val(t: var Self; i: int; v: V)
+    proc val(t: Self; i: int): V
+
+ + + Source   +Edit   + +
+
+
+
VROat[K; Q; V] = concept
+    proc cap(t: Self): int
+    proc keyQ(t: Self; k: K): Q
+    proc key(t: Self; i: int): K
+    proc used(t: Self; i: int): bool
+    proc inUse(c: var Self; n: int)
+    proc inUse(c: Self): int
+    proc val(t: var Self; i: int; v: V)
+    proc val(t: Self; i: int): V
+    proc newOfCap(t: Self; n: int): Self
+    proc copy(t: var Self; i: int; u: Self; j: int)
+    proc setNew(t, u: var Self)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc `[]`[K, Q, V](t: VOat[K, Q, V]; q: Q): V
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]=`[K, Q, V](t: var VOat[K, Q, V]; q: Q; v: V)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getOrDefault[K, Q, V](t: VOat[K, Q, V]; q: Q): V
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc incl[K, Q](t: var Oat[K, Q]; q: Q)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc len(t: SomeOat): int
+
+ + stdlib-style slots in-use + Source   +Edit   + +
+
+ +
+
+
+
proc mgetOrPut[K, Q, V](t: var VOat[K, Q, V]; q: Q; v: V): var V
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc oatSlot[Q](t: SomeOat; q: Q; h: Hash; d: var Hash): int
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func oatSlots(n: int; mnFree = 600): int {....raises: [], tags: [], forbids: [].}
+
+ + Guess of the right table size from expected number of items. + Source   +Edit   + +
+
+ +
+
+
+
proc setCap(t: var SomeROat; newSize = -1)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc tooFull(t: SomeOat; d: int; newSize: var int): bool
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator items[K, Q](t: Oat[K, Q]): K
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator pairs[K, Q, V](t: VOat[K, Q, V]): (K, V)
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator topByVal[K, Q, V](s: VOat[K, Q, V]; n = 10; min = V.low;
+                           order = topk.Cheap): (K, V)
+
+ + Iterate from smallest to largest over biggest n items by value in s. If n==0 this is effectively heapSort of s by value V. + Source   +Edit   + +
+
+ +
+
+
+
iterator values[K, Q, V](t: VOat[K, Q, V]): V
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template oatCounted(c, Self, cDotPop)
+
+ + Def routines for in-use cells counted by Nim-var maybe-ref'd off of a c. + Source   +Edit   + +
+
+ +
+
+
+
template oatKStack(s, Self, Cell, off, offT, K, Q)
+
+ + Def routines for back-to-back/stacked variable length, unpadded key data. + Source   +Edit   + +
+
+ +
+
+
+
template oatSeq(Self, dat)
+
+ + Def routines for seq-ish Self + Source   +Edit   + +
+
+ +
+
+
+
template pua(T: typedesc): untyped
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
template upSert(t: SomeOat; q, i, UP, SERT)
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Exports

+
+ TopKOrder +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/oats.idx b/adix/oats.idx new file mode 100644 index 0000000..57bb377 --- /dev/null +++ b/adix/oats.idx @@ -0,0 +1,24 @@ +nimTitle oats adix/oats.html module adix/oats 0 +nim pua adix/oats.html#pua.t,typedesc template pua(T: typedesc): untyped 2 +nim Oat adix/oats.html#Oat type Oat 13 +nim VOat adix/oats.html#VOat type VOat 25 +nim ROat adix/oats.html#ROat type ROat 39 +nim VROat adix/oats.html#VROat type VROat 54 +nim len adix/oats.html#len,SomeOat proc len(t: SomeOat): int 74 +nim oatSlots adix/oats.html#oatSlots,int,int proc oatSlots(n: int; mnFree = 600): int 80 +nim oatSlot adix/oats.html#oatSlot,SomeOat,Q,Hash,Hash proc oatSlot[Q](t: SomeOat; q: Q; h: Hash; d: var Hash): int 83 +nim tooFull adix/oats.html#tooFull,SomeOat,int,int proc tooFull(t: SomeOat; d: int; newSize: var int): bool 94 +nim setCap adix/oats.html#setCap,SomeROat,int proc setCap(t: var SomeROat; newSize = -1) 105 +nim upSert adix/oats.html#upSert.t,SomeOat,,,, template upSert(t: SomeOat; q, i, UP, SERT) 118 +nim incl adix/oats.html#incl,Oat[K,Q],Q proc incl[K, Q](t: var Oat[K, Q]; q: Q) 134 +nim `[]` adix/oats.html#[],VOat[K,Q,V],Q proc `[]`[K, Q, V](t: VOat[K, Q, V]; q: Q): V 138 +nim `[]=` adix/oats.html#[]=,VOat[K,Q,V],Q,V proc `[]=`[K, Q, V](t: var VOat[K, Q, V]; q: Q; v: V) 142 +nim mgetOrPut adix/oats.html#mgetOrPut,VOat[K,Q,V],Q,V proc mgetOrPut[K, Q, V](t: var VOat[K, Q, V]; q: Q; v: V): var V 146 +nim getOrDefault adix/oats.html#getOrDefault,VOat[K,Q,V],Q proc getOrDefault[K, Q, V](t: VOat[K, Q, V]; q: Q): V 150 +nim items adix/oats.html#items.i,Oat[K,Q] iterator items[K, Q](t: Oat[K, Q]): K 153 +nim values adix/oats.html#values.i,VOat[K,Q,V] iterator values[K, Q, V](t: VOat[K, Q, V]): V 156 +nim pairs adix/oats.html#pairs.i,VOat[K,Q,V] iterator pairs[K, Q, V](t: VOat[K, Q, V]): (K, V) 159 +nim topByVal adix/oats.html#topByVal.i,VOat[K,Q,V],int iterator topByVal[K, Q, V](s: VOat[K, Q, V]; n = 10; min = V.low; order = topk.Cheap): (\n K, V) 162 +nim oatKStack adix/oats.html#oatKStack.t,,,,,,, template oatKStack(s, Self, Cell, off, offT, K, Q) 169 +nim oatSeq adix/oats.html#oatSeq.t,, template oatSeq(Self, dat) 185 +nim oatCounted adix/oats.html#oatCounted.t,,, template oatCounted(c, Self, cDotPop) 192 diff --git a/adix/sequint.html b/adix/sequint.html new file mode 100644 index 0000000..14df4cf --- /dev/null +++ b/adix/sequint.html @@ -0,0 +1,402 @@ + + + + + + + +adix/sequint + + + + + + + + + + + + +
+
+

adix/sequint

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This module provides a memory optimized seq[uint] for a user-given range of numbers (by default its own initial length). E.g., if the range is 0..7, it uses just 3 bits per number (plus rounding error). Other pithy descriptions are "the array version of bit fields" | "the matrix version of bit vectors".

+

In the best case, this allows packing numbers 8x (e.g., 8/1) more densely than a "next biggest CPU int rounded" approach (like 8,16,32,64). The public API uses uint, usually a 64-bit unsigned integer.

+

To store n indices from 0..n-1 takes n*ceil(lg(n)) bits. E.g., circa 2020 L3 CPU caches have become large enough to support any permutation of 0..2^24-1 since (242*24/8 = 48 MiB).

+

Using the widest type for backing store and limiting the design to hold only numbers up to said wide type ensures <= 2 consecutive backing items are ever needed to access a given number.

+

While dynamically growing a SeqUint works, changing element size doesn't. So, callers must t=initSeqUint(s.len, 1 shl (s.bits+1)) & copy as needed.

+

+
+

Imports

+
+ bitop +
+
+
+

Types

+
+
+
SeqUint = object
+
+ + A space-optimized seq[uint] + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc `$`(s: SeqUint): string {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]`(s: SeqUint; i: int | uint): uint {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]=`(s: var SeqUint; i: int | uint; x: int | uint) {.inline.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc add(s: var SeqUint; v: uint) {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc addr0(s: SeqUint): pointer {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc bits(s: SeqUint): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc clear(s: var SeqUint) {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc high(s: SeqUint): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc init(s: var SeqUint; initialSize = 0; numBound = 0) {.inline, ...raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc initSeqUint(initialSize = 0; numBound = 0): SeqUint {.inline, ...raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc len(s: SeqUint): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc low(s: SeqUint): int {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc setLen(s: var SeqUint; size: int) {.inline, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator items(s: SeqUint): uint {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
iterator pairs(s: SeqUint): (int, uint) {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/sequint.idx b/adix/sequint.idx new file mode 100644 index 0000000..e61d474 --- /dev/null +++ b/adix/sequint.idx @@ -0,0 +1,17 @@ +nimTitle sequint adix/sequint.html module adix/sequint 0 +nim SeqUint adix/sequint.html#SeqUint object SeqUint 37 +nim bits adix/sequint.html#bits,SeqUint proc bits(s: SeqUint): int 47 +nim low adix/sequint.html#low,SeqUint proc low(s: SeqUint): int 49 +nim addr0 adix/sequint.html#addr0,SeqUint proc addr0(s: SeqUint): pointer 51 +nim len adix/sequint.html#len,SeqUint proc len(s: SeqUint): int 53 +nim high adix/sequint.html#high,SeqUint proc high(s: SeqUint): int 55 +nim clear adix/sequint.html#clear,SeqUint proc clear(s: var SeqUint) 57 +nim init adix/sequint.html#init,SeqUint,int,int proc init(s: var SeqUint; initialSize = 0; numBound = 0) 61 +nim initSeqUint adix/sequint.html#initSeqUint,int,int proc initSeqUint(initialSize = 0; numBound = 0): SeqUint 70 +nim `[]` adix/sequint.html#[],SeqUint, proc `[]`(s: SeqUint; i: int | uint): uint 81 +nim `[]=` adix/sequint.html#[]=,SeqUint,, proc `[]=`(s: var SeqUint; i: int | uint; x: int | uint) 104 +nim setLen adix/sequint.html#setLen,SeqUint,int proc setLen(s: var SeqUint; size: int) 129 +nim add adix/sequint.html#add,SeqUint,uint proc add(s: var SeqUint; v: uint) 134 +nim items adix/sequint.html#items.i,SeqUint iterator items(s: SeqUint): uint 139 +nim pairs adix/sequint.html#pairs.i,SeqUint iterator pairs(s: SeqUint): (int, uint) 142 +nim `$` adix/sequint.html#$,SeqUint proc `$`(s: SeqUint): string 145 diff --git a/adix/stat.html b/adix/stat.html new file mode 100644 index 0000000..27f680e --- /dev/null +++ b/adix/stat.html @@ -0,0 +1,98 @@ + + + + + + + +adix/stat + + + + + + + + + + + + +
+
+

adix/stat

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+ +
+ + +
+
+ + + + + + diff --git a/adix/stat.idx b/adix/stat.idx new file mode 100644 index 0000000..4aae0bb --- /dev/null +++ b/adix/stat.idx @@ -0,0 +1 @@ +nimTitle stat adix/stat.html module adix/stat 0 diff --git a/adix/tdigest.html b/adix/tdigest.html new file mode 100644 index 0000000..cb6218d --- /dev/null +++ b/adix/tdigest.html @@ -0,0 +1,347 @@ + + + + + + + +adix/tdigest + + + + + + + + + + + + +
+
+

adix/tdigest

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

This is a "tail digest" {github/tdunning/t-digest|arxiv.org/abs/1902.04023}. Counter decs are not possible. (So, moving quantiles are unsupported.) In my experiments, quantiles are 5X slower than adix/lghisto. Tail quantiles do deliver better accuracy for less space (but lghisto already needs little local cache space | network BW in absolute terms). There may be a way to adapt my B-Tree to speed up the idea. { tDig is also very involved - folks just intuit histo(ln(x)), but that is a more subjective critique. }

+
+

Types

+
+
+
DigesT = object
+  scale*: Scale              ## What scale function to use
+
+ + + Source   +Edit   + +
+
+
+
Group = object
+  m*: float                  ## mean
+  w*: int                    ## weight
+
+ + Group/Cluster/Centroid + Source   +Edit   + +
+
+
+
Scale = enum
+  scLog                      ## Other scales possible, but unimpl here
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
func add(s: var DigesT; others: var openArray[DigesT]) {....raises: [ValueError],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
func add(s: var DigesT; x: float; w = 1) {....raises: [ValueError], tags: [],
+    forbids: [].}
+
+ + Main update API + Source   +Edit   + +
+
+ +
+
+
+
func cdf(s: var DigesT; x: float): float {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func compress(s: var DigesT) {....raises: [], tags: [], forbids: [].}
+
+ + best done only when we want to show results to the outside world. + Source   +Edit   + +
+
+ +
+
+
+
func init(s: var DigesT; cpr = 100.0; scale = scLog; mainLen = 0; nBuf = 0) {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func initDigesT(cpr = 100.0; scale = scLog; mainLen = 0; nBuf = 0): DigesT {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func mergeNew(s: var DigesT; force = false; cpr = -1.0) {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func quantile(s: var DigesT; q: float): float {....raises: [ValueError], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func space(s: DigesT): int {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func weight(s: DigesT): int {....raises: [], tags: [], forbids: [].}
+
+ + total count represented + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator groups(s: DigesT): Group {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/tdigest.idx b/adix/tdigest.idx new file mode 100644 index 0000000..1548cf6 --- /dev/null +++ b/adix/tdigest.idx @@ -0,0 +1,17 @@ +nimTitle tdigest adix/tdigest.html module adix/tdigest 0 +nim scLog adix/tdigest.html#scLog Scale.scLog 12 +nim Scale adix/tdigest.html#Scale enum Scale 12 +nim Group adix/tdigest.html#Group object Group 14 +nim DigesT adix/tdigest.html#DigesT object DigesT 18 +nim init adix/tdigest.html#init,DigesT,float,int,int proc init(s: var DigesT; cpr = 100.0; scale = scLog; mainLen = 0; nBuf = 0) 29 +nim initDigesT adix/tdigest.html#initDigesT,float,int,int proc initDigesT(cpr = 100.0; scale = scLog; mainLen = 0; nBuf = 0): DigesT 49 +nim space adix/tdigest.html#space,DigesT proc space(s: DigesT): int 52 +nim weight adix/tdigest.html#weight,DigesT proc weight(s: DigesT): int 54 +nim mergeNew adix/tdigest.html#mergeNew,DigesT,float proc mergeNew(s: var DigesT; force = false; cpr = -1.0) 107 +nim add adix/tdigest.html#add,DigesT,float,int proc add(s: var DigesT; x: float; w = 1) 115 +nim compress adix/tdigest.html#compress,DigesT proc compress(s: var DigesT) 126 +nim groups adix/tdigest.html#groups.i,DigesT iterator groups(s: DigesT): Group 129 +nim add adix/tdigest.html#add,DigesT,openArray[DigesT] proc add(s: var DigesT; others: var openArray[DigesT]) 132 +nim quantile adix/tdigest.html#quantile,DigesT,float proc quantile(s: var DigesT; q: float): float 145 +nim cdf adix/tdigest.html#cdf,DigesT,float proc cdf(s: var DigesT; x: float): float 185 +nimgrp add adix/tdigest.html#add-procs-all proc 115 diff --git a/adix/topk.html b/adix/topk.html new file mode 100644 index 0000000..2b35be2 --- /dev/null +++ b/adix/topk.html @@ -0,0 +1,293 @@ + + + + + + + +adix/topk + + + + + + + + + + + + +
+
+

adix/topk

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+
+

Types

+
+
+
Partn = enum
+  last, ran
+
+ + + Source   +Edit   + +
+
+
+
TopK[T] = object
+
+ + A TopK accumulator; init; push; iterate + Source   +Edit   + +
+
+
+
TopKOrder = enum
+  Descending, Ascending, Cheap
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc clear[T](t: var TopK[T])
+
+ + Reset TopK accumulator + Source   +Edit   + +
+
+ +
+
+
+
proc initTopK[T](k = 10; partn = last): TopK[T]
+
+ + Initialize a TopK-accumulator for top-k; Usage is simply:
var t = initTopK(); for e in 1..99: t.push e
+for e in t: echo e
+ Source   +Edit   + +
+
+ +
+
+
+
proc push[T](t: var TopK[T]; e: sink T)
+
+ + Incorporate element e into t for eventual exact for e in t: ... + Source   +Edit   + +
+
+ +
+
+
+
proc saw[T](t: TopK[T]): int
+
+ + push count since last init|clear + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator ascending[T](t: var TopK[T]): lent T
+
+ + iterate over t yielding top items in ASCENDING order. + Source   +Edit   + +
+
+ +
+
+
+
iterator descending[T](t: var TopK[T]): lent T
+
+ + iterate over t yielding top items in DESCENDING order. + Source   +Edit   + +
+
+ +
+
+
+
iterator items[T](t: var TopK[T]): lent T
+
+ + iterate over t yielding top items in cheapest/system order. + Source   +Edit   + +
+
+ +
+
+
+
iterator maybeOrdered[T](t: var TopK[T]; order = topk.Cheap): lent T
+
+ + iterate over t yielding top items in various orders. + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/topk.idx b/adix/topk.idx new file mode 100644 index 0000000..5a02832 --- /dev/null +++ b/adix/topk.idx @@ -0,0 +1,17 @@ +nimTitle topk adix/topk.html module adix/topk 0 +nim last adix/topk.html#last Partn.last 3 +nim ran adix/topk.html#ran Partn.ran 3 +nim Partn adix/topk.html#Partn enum Partn 3 +nim TopK adix/topk.html#TopK object TopK 4 +nim Descending adix/topk.html#Descending TopKOrder.Descending 10 +nim Ascending adix/topk.html#Ascending TopKOrder.Ascending 10 +nim Cheap adix/topk.html#Cheap TopKOrder.Cheap 10 +nim TopKOrder adix/topk.html#TopKOrder enum TopKOrder 10 +nim initTopK adix/topk.html#initTopK,int proc initTopK[T](k = 10; partn = last): TopK[T] 13 +nim push adix/topk.html#push,TopK[T],sinkT proc push[T](t: var TopK[T]; e: sink T) 48 +nim saw adix/topk.html#saw,TopK[T] proc saw[T](t: TopK[T]): int 59 +nim items adix/topk.html#items.i,TopK[T] iterator items[T](t: var TopK[T]): lent T 61 +nim descending adix/topk.html#descending.i,TopK[T] iterator descending[T](t: var TopK[T]): lent T 69 +nim ascending adix/topk.html#ascending.i,TopK[T] iterator ascending[T](t: var TopK[T]): lent T 74 +nim maybeOrdered adix/topk.html#maybeOrdered.i,TopK[T] iterator maybeOrdered[T](t: var TopK[T]; order = topk.Cheap): lent T 80 +nim clear adix/topk.html#clear,TopK[T] proc clear[T](t: var TopK[T]) 87 diff --git a/adix/uniqce.html b/adix/uniqce.html new file mode 100644 index 0000000..d553696 --- /dev/null +++ b/adix/uniqce.html @@ -0,0 +1,229 @@ + + + + + + + +adix/uniqce + + + + + + + + + + + + +
+
+

adix/uniqce

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

The min-count sketch (NOT count-min) idea is to see hash(x) as a U(0,1) & use P(sampleMax<x)=x^n for sample size n. Low art inverts a confidence.ival for h.max to estimate n. Tracking k-most distinct h gives better accuracy and is usually called a KMV sketch. (Intuition is that k-th edge val => average gap between k-1 uniques&averaging cuts noise.) See Bar-Yossef 2002 "Counting Distinct..", Giroire05 "Order statistics & estimating cardinalities" & Ting14 "Streamed approximate counting..".

+
+

Types

+
+
+
UniqCe[F] = object
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc initUniqCe[F: SomeFloat](k = 1024): UniqCe[F]
+
+ + Return initialized UniqCe with tail size k. k=1024 costs 4K|1VM page + Source   +Edit   + +
+
+ +
+
+
+
proc jaccard[F: SomeFloat](a: UniqCe[F]; b: UniqCe[F]): float32
+
+ + Exact Jaccard coefficient (|intersect|/|union|) of the two sample tails. NOTE: jaccard(a,b) * union(a, b).nUnique estimates nUnique(a ^ b). + Source   +Edit   + +
+
+ +
+
+
+
proc nUnique[F: SomeFloat](uc: UniqCe[F]): float32
+
+ + Estimate number of unique elements seen so far. + Source   +Edit   + +
+
+ +
+
+
+
proc nUniqueErr[F: SomeFloat](uc: UniqCe[F]): float32
+
+ + Estimated error on estimate of unique elements seen so far. + Source   +Edit   + +
+
+ +
+
+
+
proc push[F: SomeFloat](uc: var UniqCe[F]; h: F)
+
+ + Incorporate visitation of an element. NOTE: std/hashes.hash(string) OUTPUT ONLY FILLS 32-BITS => push takes x on [0,1] instead of a key|hash() val. + Source   +Edit   + +
+
+ +
+
+
+
proc union[F: SomeFloat](a: UniqCe[F]; b: UniqCe[F]): UniqCe[F]
+
+ + Return merge/union of a & b. + Source   +Edit   + +
+
+
+
proc union[F: SomeFloat](a: var UniqCe[F]; b: UniqCe[F])
+
+ + Push all hashes from b onto a effecting an estimated set union. + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/uniqce.idx b/adix/uniqce.idx new file mode 100644 index 0000000..6a19724 --- /dev/null +++ b/adix/uniqce.idx @@ -0,0 +1,10 @@ +nimTitle uniqce adix/uniqce.html module adix/uniqce 0 +nim UniqCe adix/uniqce.html#UniqCe object UniqCe 19 +nim initUniqCe adix/uniqce.html#initUniqCe,int proc initUniqCe[F: SomeFloat](k = 1024): UniqCe[F] 24 +nim push adix/uniqce.html#push,UniqCe[F: SomeFloat],F proc push[F: SomeFloat](uc: var UniqCe[F]; h: F) 27 +nim nUnique adix/uniqce.html#nUnique,UniqCe[F: SomeFloat] proc nUnique[F: SomeFloat](uc: UniqCe[F]): float32 48 +nim nUniqueErr adix/uniqce.html#nUniqueErr,UniqCe[F: SomeFloat] proc nUniqueErr[F: SomeFloat](uc: UniqCe[F]): float32 52 +nim jaccard adix/uniqce.html#jaccard,UniqCe[F: SomeFloat],UniqCe[F: SomeFloat] proc jaccard[F: SomeFloat](a: UniqCe[F]; b: UniqCe[F]): float32 57 +nim union adix/uniqce.html#union,UniqCe[F: SomeFloat],UniqCe[F: SomeFloat] proc union[F: SomeFloat](a: var UniqCe[F]; b: UniqCe[F]) 69 +nim union adix/uniqce.html#union,UniqCe[F: SomeFloat],UniqCe[F: SomeFloat]_2 proc union[F: SomeFloat](a: UniqCe[F]; b: UniqCe[F]): UniqCe[F] 73 +nimgrp union adix/uniqce.html#union-procs-all proc 69 diff --git a/adix/xlang.html b/adix/xlang.html new file mode 100644 index 0000000..821409b --- /dev/null +++ b/adix/xlang.html @@ -0,0 +1,207 @@ + + + + + + + +adix/xlang + + + + + + + + + + + + +
+
+

adix/xlang

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+
+

Procs

+
+
+
+
proc `&=`[T, U](a: var T; b: U) {.inline.}
+
+ + Updating bit-wise and + Source   +Edit   + +
+
+ +
+
+
+
proc `<<=`[T, U](a: var T; b: U) {.inline.}
+
+ + Updating bit-wise shl + Source   +Edit   + +
+
+ +
+
+
+
proc `>>=`[T, U](a: var T; b: U) {.inline.}
+
+ + Updating bit-wise shr + Source   +Edit   + +
+
+ +
+
+
+
proc `^=`[T, U](a: var T; b: U) {.inline.}
+
+ + Updating bit-wise xor + Source   +Edit   + +
+
+ +
+
+
+
proc `|=`[T, U](a: var T; b: U) {.inline.}
+
+ + Updating bit-wise or + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template cfor(init, test, update, body: untyped)
+
+ + C-like for loop template. May need () around arguments at call site. Usage is like: cfor (var i = 0), i < 16, i += 2: body + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/adix/xlang.idx b/adix/xlang.idx new file mode 100644 index 0000000..797b782 --- /dev/null +++ b/adix/xlang.idx @@ -0,0 +1,7 @@ +nimTitle xlang adix/xlang.html module adix/xlang 0 +nim cfor adix/xlang.html#cfor.t,untyped,untyped,untyped,untyped template cfor(init, test, update, body: untyped) 1 +nim `&=` adix/xlang.html#&=,T,U proc `&=`[T, U](a: var T; b: U) 13 +nim `|=` adix/xlang.html#|=,T,U proc `|=`[T, U](a: var T; b: U) 17 +nim `^=` adix/xlang.html#^=,T,U proc `^=`[T, U](a: var T; b: U) 21 +nim `<<=` adix/xlang.html#<<=,T,U proc `<<=`[T, U](a: var T; b: U) 25 +nim `>>=` adix/xlang.html#>>=,T,U proc `>>=`[T, U](a: var T; b: U) 29 diff --git a/dochack.js b/dochack.js new file mode 100644 index 0000000..e470353 --- /dev/null +++ b/dochack.js @@ -0,0 +1,1609 @@ +/* Generated by the Nim Compiler v2.0.9 */ +var framePtr = null; +var excHandler = 0; +var lastJSError = null; +var NTI33554466 = {size: 0,kind: 1,base: null,node: null,finalizer: null}; +var NTI721420302 = {size: 0, kind: 18, base: null, node: null, finalizer: null}; +var NTI33554435 = {size: 0,kind: 31,base: null,node: null,finalizer: null}; +var NTI973078607 = {size: 0,kind: 31,base: null,node: null,finalizer: null}; +var NTI973078613 = {size: 0, kind: 18, base: null, node: null, finalizer: null}; +var NTI134217745 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217749 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217751 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI33555173 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI33555181 = {size: 0, kind: 22, base: null, node: null, finalizer: null}; +var NTI33554449 = {size: 0,kind: 28,base: null,node: null,finalizer: null}; +var NTI33554450 = {size: 0,kind: 29,base: null,node: null,finalizer: null}; +var NTI33555180 = {size: 0, kind: 22, base: null, node: null, finalizer: null}; +var NTI33555177 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI33555178 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217741 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217743 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NNI134217743 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217743.node = NNI134217743; +var NNI134217741 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217741.node = NNI134217741; +var NNI33555178 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI33555178.node = NNI33555178; +NTI33555180.base = NTI33555177; +NTI33555181.base = NTI33555177; +var NNI33555177 = {kind: 2, len: 5, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "parent", len: 0, typ: NTI33555180, name: "parent", sons: null}, +{kind: 1, offset: "name", len: 0, typ: NTI33554450, name: "name", sons: null}, +{kind: 1, offset: "message", len: 0, typ: NTI33554449, name: "msg", sons: null}, +{kind: 1, offset: "trace", len: 0, typ: NTI33554449, name: "trace", sons: null}, +{kind: 1, offset: "up", len: 0, typ: NTI33555181, name: "up", sons: null}]}; +NTI33555177.node = NNI33555177; +var NNI33555173 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI33555173.node = NNI33555173; +NTI33555177.base = NTI33555173; +NTI33555178.base = NTI33555177; +NTI134217741.base = NTI33555178; +NTI134217743.base = NTI134217741; +var NNI134217751 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217751.node = NNI134217751; +NTI134217751.base = NTI33555178; +var NNI134217749 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217749.node = NNI134217749; +NTI134217749.base = NTI33555178; +var NNI134217745 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217745.node = NNI134217745; +NTI134217745.base = NTI33555178; +var NNI973078613 = {kind: 2, len: 2, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "a", len: 0, typ: NTI973078607, name: "a", sons: null}, +{kind: 1, offset: "b", len: 0, typ: NTI33554435, name: "b", sons: null}]}; +NTI973078613.node = NNI973078613; +var NNI721420302 = {kind: 2, len: 2, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "Field0", len: 0, typ: NTI33554435, name: "Field0", sons: null}, +{kind: 1, offset: "Field1", len: 0, typ: NTI33554466, name: "Field1", sons: null}]}; +NTI721420302.node = NNI721420302; + +function mnewString(len_33557003) { + var result = new Array(len_33557003); + for (var i = 0; i < len_33557003; i++) {result[i] = 0;} + return result; + + + +} + +function toJSStr(s_33556901) { + var result_33556902 = null; + + var res_33556943 = newSeq_33556919((s_33556901).length); + var i_33556944 = 0; + var j_33556945 = 0; + Label1: { + Label2: while (true) { + if (!(i_33556944 < (s_33556901).length)) break Label2; + var c_33556946 = s_33556901[i_33556944]; + if ((c_33556946 < 128)) { + res_33556943[j_33556945] = String.fromCharCode(c_33556946); + i_33556944 += 1; + } + else { + var helper_33556959 = newSeq_33556919(0); + Label3: { + Label4: while (true) { + if (!true) break Label4; + var code_33556960 = c_33556946.toString(16); + if ((((code_33556960) == null ? 0 : (code_33556960).length) == 1)) { + helper_33556959.push("%0");; + } + else { + helper_33556959.push("%");; + } + + helper_33556959.push(code_33556960);; + i_33556944 += 1; + if ((((s_33556901).length <= i_33556944) || (s_33556901[i_33556944] < 128))) { + break Label3; + } + + c_33556946 = s_33556901[i_33556944]; + } + }; +++excHandler; + try { + res_33556943[j_33556945] = decodeURIComponent(helper_33556959.join("")); +--excHandler; +} catch (EXCEPTION) { + var prevJSError = lastJSError; + lastJSError = EXCEPTION; + --excHandler; + res_33556943[j_33556945] = helper_33556959.join(""); + lastJSError = prevJSError; + } finally { + } + } + + j_33556945 += 1; + } + }; + if (res_33556943.length < j_33556945) { for (var i = res_33556943.length ; i < j_33556945 ; ++i) res_33556943.push(null); } + else { res_33556943.length = j_33556945; }; + result_33556902 = res_33556943.join(""); + + return result_33556902; + +} + +function raiseException(e_33556653, ename_33556654) { + e_33556653.name = ename_33556654; + if ((excHandler == 0)) { + unhandledException(e_33556653); + } + + throw e_33556653; + + +} + +function addInt(a_33557050, b_33557051) { + var result = a_33557050 + b_33557051; + checkOverflowInt(result); + return result; + + + +} + +function chckRange(i_33557324, a_33557325, b_33557326) { + var result_33557327 = 0; + + BeforeRet: { + if (((a_33557325 <= i_33557324) && (i_33557324 <= b_33557326))) { + result_33557327 = i_33557324; + break BeforeRet; + } + else { + raiseRangeError(); + } + + }; + + return result_33557327; + +} + +function setConstr() { + var result = {}; + for (var i = 0; i < arguments.length; ++i) { + var x = arguments[i]; + if (typeof(x) == "object") { + for (var j = x[0]; j <= x[1]; ++j) { + result[j] = true; + } + } else { + result[x] = true; + } + } + return result; + + + +} +var ConstSet1 = setConstr(17, 16, 4, 18, 27, 19, 23, 22, 21); + +function nimCopy(dest_33557268, src_33557269, ti_33557270) { + var result_33557279 = null; + + switch (ti_33557270.kind) { + case 21: + case 22: + case 23: + case 5: + if (!(isFatPointer_33557259(ti_33557270))) { + result_33557279 = src_33557269; + } + else { + result_33557279 = [src_33557269[0], src_33557269[1]]; + } + + break; + case 19: + if (dest_33557268 === null || dest_33557268 === undefined) { + dest_33557268 = {}; + } + else { + for (var key in dest_33557268) { delete dest_33557268[key]; } + } + for (var key in src_33557269) { dest_33557268[key] = src_33557269[key]; } + result_33557279 = dest_33557268; + + break; + case 18: + case 17: + if (!((ti_33557270.base == null))) { + result_33557279 = nimCopy(dest_33557268, src_33557269, ti_33557270.base); + } + else { + if ((ti_33557270.kind == 17)) { + result_33557279 = (dest_33557268 === null || dest_33557268 === undefined) ? {m_type: ti_33557270} : dest_33557268; + } + else { + result_33557279 = (dest_33557268 === null || dest_33557268 === undefined) ? {} : dest_33557268; + } + } + nimCopyAux(result_33557279, src_33557269, ti_33557270.node); + break; + case 4: + case 16: + if(ArrayBuffer.isView(src_33557269)) { + if(dest_33557268 === null || dest_33557268 === undefined || dest_33557268.length != src_33557269.length) { + dest_33557268 = new src_33557269.constructor(src_33557269); + } else { + dest_33557268.set(src_33557269, 0); + } + result_33557279 = dest_33557268; + } else { + if (src_33557269 === null) { + result_33557279 = null; + } + else { + if (dest_33557268 === null || dest_33557268 === undefined || dest_33557268.length != src_33557269.length) { + dest_33557268 = new Array(src_33557269.length); + } + result_33557279 = dest_33557268; + for (var i = 0; i < src_33557269.length; ++i) { + result_33557279[i] = nimCopy(result_33557279[i], src_33557269[i], ti_33557270.base); + } + } + } + + break; + case 24: + case 27: + if (src_33557269 === null) { + result_33557279 = null; + } + else { + if (dest_33557268 === null || dest_33557268 === undefined || dest_33557268.length != src_33557269.length) { + dest_33557268 = new Array(src_33557269.length); + } + result_33557279 = dest_33557268; + for (var i = 0; i < src_33557269.length; ++i) { + result_33557279[i] = nimCopy(result_33557279[i], src_33557269[i], ti_33557270.base); + } + } + + break; + case 28: + if (src_33557269 !== null) { + result_33557279 = src_33557269.slice(0); + } + + break; + default: + result_33557279 = src_33557269; + break; + } + + return result_33557279; + +} + +function chckIndx(i_33557319, a_33557320, b_33557321) { + var result_33557322 = 0; + + BeforeRet: { + if (((a_33557320 <= i_33557319) && (i_33557319 <= b_33557321))) { + result_33557322 = i_33557319; + break BeforeRet; + } + else { + raiseIndexError(i_33557319, a_33557320, b_33557321); + } + + }; + + return result_33557322; + +} + +function makeNimstrLit(c_33556895) { + var result = []; + for (var i = 0; i < c_33556895.length; ++i) { + result[i] = c_33556895.charCodeAt(i); + } + return result; + + + +} + +function subInt(a_33557054, b_33557055) { + var result = a_33557054 - b_33557055; + checkOverflowInt(result); + return result; + + + +} + +function cstrToNimstr(c_33556898) { + var ln = c_33556898.length; + var result = new Array(ln); + var r = 0; + for (var i = 0; i < ln; ++i) { + var ch = c_33556898.charCodeAt(i); + + if (ch < 128) { + result[r] = ch; + } + else { + if (ch < 2048) { + result[r] = (ch >> 6) | 192; + } + else { + if (ch < 55296 || ch >= 57344) { + result[r] = (ch >> 12) | 224; + } + else { + ++i; + ch = 65536 + (((ch & 1023) << 10) | (c_33556898.charCodeAt(i) & 1023)); + result[r] = (ch >> 18) | 240; + ++r; + result[r] = ((ch >> 12) & 63) | 128; + } + ++r; + result[r] = ((ch >> 6) & 63) | 128; + } + ++r; + result[r] = (ch & 63) | 128; + } + ++r; + } + return result; + + + +} +var ConstSet2 = setConstr([65, 90]); +var ConstSet3 = setConstr(95, 32, 46); +var ConstSet4 = setConstr(95, 32, 46); + +function mulInt(a_33557058, b_33557059) { + var result = a_33557058 * b_33557059; + checkOverflowInt(result); + return result; + + + +} +var ConstSet5 = setConstr([97, 122]); +var ConstSet6 = setConstr([65, 90], [97, 122]); +var ConstSet7 = setConstr([97, 122]); +var ConstSet8 = setConstr([65, 90]); +var ConstSet9 = setConstr([65, 90], [97, 122]); + +function nimMax(a_33557108, b_33557109) { + var Temporary1; + + var result_33557110 = 0; + + BeforeRet: { + if ((b_33557109 <= a_33557108)) { + Temporary1 = a_33557108; + } + else { + Temporary1 = b_33557109; + } + + result_33557110 = Temporary1; + break BeforeRet; + }; + + return result_33557110; + +} + +function nimMin(a_33557104, b_33557105) { + var Temporary1; + + var result_33557106 = 0; + + BeforeRet: { + if ((a_33557104 <= b_33557105)) { + Temporary1 = a_33557104; + } + else { + Temporary1 = b_33557105; + } + + result_33557106 = Temporary1; + break BeforeRet; + }; + + return result_33557106; + +} + +function addChar(x_33557415, c_33557416) { + x_33557415.push(c_33557416); + + +} +var objectID_1207959729 = [0]; + +function setTheme(theme_570425350) { + document.documentElement.setAttribute("data-theme", theme_570425350); + window.localStorage.setItem("theme", theme_570425350); + + +} + +function add_33556373(x_33556374, x_33556374_Idx, y_33556375) { + if (x_33556374[x_33556374_Idx] === null) { x_33556374[x_33556374_Idx] = []; } + var off = x_33556374[x_33556374_Idx].length; + x_33556374[x_33556374_Idx].length += y_33556375.length; + for (var i = 0; i < y_33556375.length; ++i) { + x_33556374[x_33556374_Idx][off+i] = y_33556375.charCodeAt(i); + } + + + +} + +function newSeq_33556919(len_33556921) { + var result_33556922 = []; + + result_33556922 = new Array(len_33556921); for (var i = 0 ; i < len_33556921 ; ++i) { result_33556922[i] = null; } + return result_33556922; + +} + +function unhandledException(e_33556649) { + var buf_33556650 = [[]]; + if (!(((e_33556649.message).length == 0))) { + buf_33556650[0].push.apply(buf_33556650[0], [69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110,58,32]);; + buf_33556650[0].push.apply(buf_33556650[0], e_33556649.message);; + } + else { + buf_33556650[0].push.apply(buf_33556650[0], [69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110]);; + } + + buf_33556650[0].push.apply(buf_33556650[0], [32,91]);; + add_33556373(buf_33556650, 0, e_33556649.name); + buf_33556650[0].push.apply(buf_33556650[0], [93,10]);; + var cbuf_33556651 = toJSStr(buf_33556650[0]); + if (typeof(Error) !== "undefined") { + throw new Error(cbuf_33556651); + } + else { + throw cbuf_33556651; + } + + + +} + +function raiseOverflow() { + raiseException({message: [111,118,101,114,45,32,111,114,32,117,110,100,101,114,102,108,111,119], parent: null, m_type: NTI134217743, name: null, trace: [], up: null}, "OverflowDefect"); + + +} + +function checkOverflowInt(a_33557048) { + if (a_33557048 > 2147483647 || a_33557048 < -2147483648) raiseOverflow(); + + + +} + +function raiseRangeError() { + raiseException({message: [118,97,108,117,101,32,111,117,116,32,111,102,32,114,97,110,103,101], parent: null, m_type: NTI134217751, name: null, trace: [], up: null}, "RangeDefect"); + + +} + +function addChars_301990090(result_301990092, result_301990092_Idx, x_301990093, start_301990094, n_301990095) { + var Temporary1; + + var old_301990096 = (result_301990092[result_301990092_Idx]).length; + if (result_301990092[result_301990092_Idx].length < (Temporary1 = chckRange(addInt(old_301990096, n_301990095), 0, 2147483647), Temporary1)) { for (var i = result_301990092[result_301990092_Idx].length; i < Temporary1; ++i) result_301990092[result_301990092_Idx].push(0); } + else {result_301990092[result_301990092_Idx].length = Temporary1; }; + Label2: { + var iHEX60gensym4_301990110 = 0; + var i_570426545 = 0; + Label3: { + Label4: while (true) { + if (!(i_570426545 < n_301990095)) break Label4; + iHEX60gensym4_301990110 = i_570426545; + result_301990092[result_301990092_Idx][chckIndx(addInt(old_301990096, iHEX60gensym4_301990110), 0, (result_301990092[result_301990092_Idx]).length - 1)] = x_301990093.charCodeAt(chckIndx(addInt(start_301990094, iHEX60gensym4_301990110), 0, (x_301990093).length - 1)); + i_570426545 = addInt(i_570426545, 1); + } + }; + }; + + +} + +function addChars_301990086(result_301990088, result_301990088_Idx, x_301990089) { + addChars_301990090(result_301990088, result_301990088_Idx, x_301990089, 0, ((x_301990089) == null ? 0 : (x_301990089).length)); + + +} + +function addInt_301990111(result_301990112, result_301990112_Idx, x_301990113) { + addChars_301990086(result_301990112, result_301990112_Idx, ((x_301990113) + "")); + + +} + +function addInt_301990129(result_301990130, result_301990130_Idx, x_301990131) { + addInt_301990111(result_301990130, result_301990130_Idx, BigInt(x_301990131)); + + +} + +function HEX24_385875976(x_385875977) { + var result_385875978 = [[]]; + + addInt_301990129(result_385875978, 0, x_385875977); + + return result_385875978[0]; + +} + +function isFatPointer_33557259(ti_33557260) { + var result_33557261 = false; + + BeforeRet: { + result_33557261 = !((ConstSet1[ti_33557260.base.kind] != undefined)); + break BeforeRet; + }; + + return result_33557261; + +} + +function nimCopyAux(dest_33557272, src_33557273, n_33557274) { + switch (n_33557274.kind) { + case 0: + break; + case 1: + dest_33557272[n_33557274.offset] = nimCopy(dest_33557272[n_33557274.offset], src_33557273[n_33557274.offset], n_33557274.typ); + + break; + case 2: + for (var i = 0; i < n_33557274.sons.length; i++) { + nimCopyAux(dest_33557272, src_33557273, n_33557274.sons[i]); + } + + break; + case 3: + dest_33557272[n_33557274.offset] = nimCopy(dest_33557272[n_33557274.offset], src_33557273[n_33557274.offset], n_33557274.typ); + for (var i = 0; i < n_33557274.sons.length; ++i) { + nimCopyAux(dest_33557272, src_33557273, n_33557274.sons[i][1]); + } + + break; + } + + +} + +function raiseIndexError(i_33556812, a_33556813, b_33556814) { + var Temporary1; + + if ((b_33556814 < a_33556813)) { + Temporary1 = [105,110,100,101,120,32,111,117,116,32,111,102,32,98,111,117,110,100,115,44,32,116,104,101,32,99,111,110,116,97,105,110,101,114,32,105,115,32,101,109,112,116,121]; + } + else { + Temporary1 = ([105,110,100,101,120,32] || []).concat(HEX24_385875976(i_33556812) || [],[32,110,111,116,32,105,110,32] || [],HEX24_385875976(a_33556813) || [],[32,46,46,32] || [],HEX24_385875976(b_33556814) || []); + } + + raiseException({message: nimCopy(null, Temporary1, NTI33554449), parent: null, m_type: NTI134217749, name: null, trace: [], up: null}, "IndexDefect"); + + +} + +function sysFatal_268435501(message_268435504) { + raiseException({message: nimCopy(null, message_268435504, NTI33554449), m_type: NTI134217745, parent: null, name: null, trace: [], up: null}, "AssertionDefect"); + + +} + +function raiseAssert_268435499(msg_268435500) { + sysFatal_268435501(msg_268435500); + + +} + +function failedAssertImpl_268435541(msg_268435542) { + raiseAssert_268435499(msg_268435542); + + +} + +function onDOMLoaded(e_570425385) { + +function HEX3Aanonymous_570425409(event_570425410) { + event_570425410.target.parentNode.style.display = "none"; + event_570425410.target.parentNode.nextSibling.style.display = "inline"; + + + } + + document.getElementById("theme-select").value = window.localStorage.getItem("theme"); + Label1: { + var pragmaDots_570425408 = null; + var colontmp__570426536 = []; + colontmp__570426536 = document.getElementsByClassName("pragmadots"); + var i_570426538 = 0; + var L_570426539 = (colontmp__570426536).length; + Label2: { + Label3: while (true) { + if (!(i_570426538 < L_570426539)) break Label3; + pragmaDots_570425408 = colontmp__570426536[chckIndx(i_570426538, 0, (colontmp__570426536).length - 1)]; + pragmaDots_570425408.onclick = HEX3Aanonymous_570425409; + i_570426538 += 1; + if (!(((colontmp__570426536).length == L_570426539))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(254, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + + +} + +function isWhitespace_570425752(x_570425753) { + var result_570425754 = false; + + result_570425754 = (((x_570425753.nodeName == "#text") && !/\S/.test(x_570425753.textContent)) || (x_570425753.nodeName == "#comment")); + + return result_570425754; + +} + +function toToc_570425755(x_570425756, father_570425757) { + var Temporary5; + var Temporary6; + var Temporary7; + var Temporary8; + var Temporary15; + + if ((x_570425756.nodeName == "UL")) { + var f_570425765 = {heading: null, kids: [], sortId: (father_570425757.kids).length, doSort: false}; + var i_570425766 = 0; + Label1: { + Label2: while (true) { + if (!(i_570425766 < x_570425756.childNodes.length)) break Label2; + var nxt_570425767 = addInt(i_570425766, 1); + Label3: { + Label4: while (true) { + if (!(nxt_570425767 < x_570425756.childNodes.length)) Temporary5 = false; else { Temporary5 = isWhitespace_570425752(x_570425756.childNodes[nxt_570425767]); } if (!Temporary5) break Label4; + nxt_570425767 = addInt(nxt_570425767, 1); + } + }; + if (!(nxt_570425767 < x_570425756.childNodes.length)) Temporary8 = false; else { Temporary8 = (x_570425756.childNodes[i_570425766].nodeName == "LI"); } if (!Temporary8) Temporary7 = false; else { Temporary7 = (x_570425756.childNodes[i_570425766].childNodes.length == 1); } if (!Temporary7) Temporary6 = false; else { Temporary6 = (x_570425756.childNodes[nxt_570425767].nodeName == "UL"); } if (Temporary6) { + var e_570425780 = {heading: x_570425756.childNodes[i_570425766].childNodes[0], kids: [], sortId: (f_570425765.kids).length, doSort: false}; + var it_570425781 = x_570425756.childNodes[nxt_570425767]; + Label9: { + var j_570425786 = 0; + var colontmp__570426552 = 0; + colontmp__570426552 = it_570425781.childNodes.length; + var i_570426553 = 0; + Label10: { + Label11: while (true) { + if (!(i_570426553 < colontmp__570426552)) break Label11; + j_570425786 = i_570426553; + toToc_570425755(it_570425781.childNodes[j_570425786], e_570425780); + i_570426553 = addInt(i_570426553, 1); + } + }; + }; + f_570425765.kids.push(e_570425780);; + i_570425766 = addInt(nxt_570425767, 1); + } + else { + toToc_570425755(x_570425756.childNodes[i_570425766], f_570425765); + i_570425766 = addInt(i_570425766, 1); + } + + } + }; + father_570425757.kids.push(f_570425765);; + } + else { + if (isWhitespace_570425752(x_570425756)) { + } + else { + if ((x_570425756.nodeName == "LI")) { + var idx_570425804 = []; + Label12: { + var i_570425809 = 0; + var colontmp__570426556 = 0; + colontmp__570426556 = x_570425756.childNodes.length; + var i_570426557 = 0; + Label13: { + Label14: while (true) { + if (!(i_570426557 < colontmp__570426556)) break Label14; + i_570425809 = i_570426557; + if (!(isWhitespace_570425752(x_570425756.childNodes[i_570425809]))) { + idx_570425804.push(i_570425809);; + } + + i_570426557 = addInt(i_570426557, 1); + } + }; + }; + if (!((idx_570425804).length == 2)) Temporary15 = false; else { Temporary15 = (x_570425756.childNodes[idx_570425804[chckIndx(1, 0, (idx_570425804).length - 1)]].nodeName == "UL"); } if (Temporary15) { + var e_570425825 = {heading: x_570425756.childNodes[idx_570425804[chckIndx(0, 0, (idx_570425804).length - 1)]], kids: [], sortId: (father_570425757.kids).length, doSort: false}; + var it_570425826 = x_570425756.childNodes[idx_570425804[chckIndx(1, 0, (idx_570425804).length - 1)]]; + Label16: { + var j_570425831 = 0; + var colontmp__570426560 = 0; + colontmp__570426560 = it_570425826.childNodes.length; + var i_570426561 = 0; + Label17: { + Label18: while (true) { + if (!(i_570426561 < colontmp__570426560)) break Label18; + j_570425831 = i_570426561; + toToc_570425755(it_570425826.childNodes[j_570425831], e_570425825); + i_570426561 = addInt(i_570426561, 1); + } + }; + }; + father_570425757.kids.push(e_570425825);; + } + else { + Label19: { + var i_570425840 = 0; + var colontmp__570426564 = 0; + colontmp__570426564 = x_570425756.childNodes.length; + var i_570426565 = 0; + Label20: { + Label21: while (true) { + if (!(i_570426565 < colontmp__570426564)) break Label21; + i_570425840 = i_570426565; + toToc_570425755(x_570425756.childNodes[i_570425840], father_570425757); + i_570426565 = addInt(i_570426565, 1); + } + }; + }; + } + + } + else { + father_570425757.kids.push({heading: x_570425756, kids: [], sortId: (father_570425757.kids).length, doSort: false});; + } + }} + + +} + +function extractItems_570425543(x_570425544, heading_570425545, items_570425546, items_570425546_Idx) { + BeforeRet: { + if ((x_570425544 == null)) { + break BeforeRet; + } + + if ((!((x_570425544.heading == null)) && (x_570425544.heading.textContent == heading_570425545))) { + Label1: { + var i_570425563 = 0; + var colontmp__570426568 = 0; + colontmp__570426568 = (x_570425544.kids).length; + var i_570426569 = 0; + Label2: { + Label3: while (true) { + if (!(i_570426569 < colontmp__570426568)) break Label3; + i_570425563 = i_570426569; + items_570425546[items_570425546_Idx].push(x_570425544.kids[chckIndx(i_570425563, 0, (x_570425544.kids).length - 1)].heading);; + i_570426569 = addInt(i_570426569, 1); + } + }; + }; + } + else { + Label4: { + var k_570425589 = null; + var i_570426573 = 0; + var L_570426574 = (x_570425544.kids).length; + Label5: { + Label6: while (true) { + if (!(i_570426573 < L_570426574)) break Label6; + k_570425589 = x_570425544.kids[chckIndx(i_570426573, 0, (x_570425544.kids).length - 1)]; + extractItems_570425543(k_570425589, heading_570425545, items_570425546, items_570425546_Idx); + i_570426573 += 1; + if (!(((x_570425544.kids).length == L_570426574))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(254, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + } + + }; + + +} + +function tree_570425474(tag_570425475, kids_570425476) { + var result_570425477 = null; + + result_570425477 = document.createElement(tag_570425475); + Label1: { + var k_570425491 = null; + var i_570426586 = 0; + Label2: { + Label3: while (true) { + if (!(i_570426586 < (kids_570425476).length)) break Label3; + k_570425491 = kids_570425476[chckIndx(i_570426586, 0, (kids_570425476).length - 1)]; + result_570425477.appendChild(k_570425491); + i_570426586 += 1; + } + }; + }; + + return result_570425477; + +} + +function text_570425499(s_570425500) { + var result_570425501 = null; + + result_570425501 = document.createTextNode(s_570425500); + + return result_570425501; + +} + +function uncovered_570425944(x_570425945) { + var Temporary1; + + var result_570425946 = null; + + BeforeRet: { + if ((((x_570425945.kids).length == 0) && !((x_570425945.heading == null)))) { + if (!(x_570425945.heading.hasOwnProperty('__karaxMarker__'))) { + Temporary1 = x_570425945; + } + else { + Temporary1 = null; + } + + result_570425946 = Temporary1; + break BeforeRet; + } + + result_570425946 = {heading: x_570425945.heading, kids: [], sortId: x_570425945.sortId, doSort: x_570425945.doSort}; + Label2: { + var k_570425961 = null; + var i_570426593 = 0; + var L_570426594 = (x_570425945.kids).length; + Label3: { + Label4: while (true) { + if (!(i_570426593 < L_570426594)) break Label4; + k_570425961 = x_570425945.kids[chckIndx(i_570426593, 0, (x_570425945.kids).length - 1)]; + var y_570425962 = uncovered_570425944(k_570425961); + if (!((y_570425962 == null))) { + result_570425946.kids.push(y_570425962);; + } + + i_570426593 += 1; + if (!(((x_570425945.kids).length == L_570426594))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(254, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + if (((result_570425946.kids).length == 0)) { + result_570425946 = null; + } + + }; + + return result_570425946; + +} + +function mergeTocs_570425974(orig_570425975, news_570425976) { + var result_570425977 = null; + + result_570425977 = uncovered_570425944(orig_570425975); + if ((result_570425977 == null)) { + result_570425977 = news_570425976; + } + else { + Label1: { + var i_570425989 = 0; + var colontmp__570426589 = 0; + colontmp__570426589 = (news_570425976.kids).length; + var i_570426590 = 0; + Label2: { + Label3: while (true) { + if (!(i_570426590 < colontmp__570426589)) break Label3; + i_570425989 = i_570426590; + result_570425977.kids.push(news_570425976.kids[chckIndx(i_570425989, 0, (news_570425976.kids).length - 1)]);; + i_570426590 = addInt(i_570426590, 1); + } + }; + }; + } + + + return result_570425977; + +} + +function buildToc_570425994(orig_570425995, types_570425996, procs_570425997) { + var result_570425998 = null; + + var newStuff_570426003 = {heading: null, kids: [], doSort: true, sortId: 0}; + Label1: { + var t_570426007 = null; + var i_570426581 = 0; + var L_570426582 = (types_570425996).length; + Label2: { + Label3: while (true) { + if (!(i_570426581 < L_570426582)) break Label3; + t_570426007 = types_570425996[chckIndx(i_570426581, 0, (types_570425996).length - 1)]; + var c_570426012 = {heading: t_570426007.cloneNode(true), kids: [], doSort: true, sortId: 0}; + t_570426007.__karaxMarker__ = true; + Label4: { + var p_570426016 = null; + var i_570426578 = 0; + var L_570426579 = (procs_570425997).length; + Label5: { + Label6: while (true) { + if (!(i_570426578 < L_570426579)) break Label6; + p_570426016 = procs_570425997[chckIndx(i_570426578, 0, (procs_570425997).length - 1)]; + if (!(p_570426016.hasOwnProperty('__karaxMarker__'))) { + var xx_570426017 = p_570426016.parentNode.getElementsByClassName("attachedType"); + if ((((xx_570426017).length == 1) && (xx_570426017[chckIndx(0, 0, (xx_570426017).length - 1)].textContent == t_570426007.textContent))) { + var q_570426022 = tree_570425474("A", [text_570425499(p_570426016.title)]); + q_570426022.setAttribute("href", p_570426016.getAttribute("href")); + c_570426012.kids.push({heading: q_570426022, kids: [], sortId: 0, doSort: false});; + p_570426016.__karaxMarker__ = true; + } + + } + + i_570426578 += 1; + if (!(((procs_570425997).length == L_570426579))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(254, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + newStuff_570426003.kids.push(c_570426012);; + i_570426581 += 1; + if (!(((types_570425996).length == L_570426582))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(254, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + result_570425998 = mergeTocs_570425974(orig_570425995, newStuff_570426003); + + return result_570425998; + +} + +function add_570425492(parent_570425493, kid_570425494) { + if (((parent_570425493.nodeName == "TR") && ((kid_570425494.nodeName == "TD") || (kid_570425494.nodeName == "TH")))) { + var k_570425495 = document.createElement("TD"); + k_570425495.appendChild(kid_570425494); + parent_570425493.appendChild(k_570425495); + } + else { + parent_570425493.appendChild(kid_570425494); + } + + + +} + +function setClass_570425496(e_570425497, value_570425498) { + e_570425497.setAttribute("class", value_570425498); + + +} + +function toHtml_570425622(x_570425623, isRoot_570425624) { + +function HEX3Aanonymous_570425642(a_570425643, b_570425644) { + var result_570425645 = 0; + + BeforeRet: { + if ((!((a_570425643.heading == null)) && !((b_570425644.heading == null)))) { + var x_570425654 = a_570425643.heading.textContent; + var y_570425655 = b_570425644.heading.textContent; + if ((x_570425654 < y_570425655)) { + result_570425645 = (-1); + break BeforeRet; + } + + if ((y_570425655 < x_570425654)) { + result_570425645 = 1; + break BeforeRet; + } + + result_570425645 = 0; + break BeforeRet; + } + else { + result_570425645 = subInt(a_570425643.sortId, b_570425644.sortId); + break BeforeRet; + } + + }; + + return result_570425645; + + } + + var result_570425625 = null; + + BeforeRet: { + if ((x_570425623 == null)) { + result_570425625 = null; + break BeforeRet; + } + + if (((x_570425623.kids).length == 0)) { + if ((x_570425623.heading == null)) { + result_570425625 = null; + break BeforeRet; + } + + result_570425625 = x_570425623.heading.cloneNode(true); + break BeforeRet; + } + + result_570425625 = tree_570425474("DIV", []); + if ((!((x_570425623.heading == null)) && !(x_570425623.heading.hasOwnProperty('__karaxMarker__')))) { + add_570425492(result_570425625, x_570425623.heading.cloneNode(true)); + } + + var ul_570425641 = tree_570425474("UL", []); + if (isRoot_570425624) { + setClass_570425496(ul_570425641, "simple simple-toc"); + } + else { + setClass_570425496(ul_570425641, "simple"); + } + + if (x_570425623.doSort) { + x_570425623.kids.sort(HEX3Aanonymous_570425642); + } + + Label1: { + var k_570425667 = null; + var i_570426597 = 0; + var L_570426598 = (x_570425623.kids).length; + Label2: { + Label3: while (true) { + if (!(i_570426597 < L_570426598)) break Label3; + k_570425667 = x_570425623.kids[chckIndx(i_570426597, 0, (x_570425623.kids).length - 1)]; + var y_570425668 = toHtml_570425622(k_570425667, false); + if (!((y_570425668 == null))) { + add_570425492(ul_570425641, tree_570425474("LI", [y_570425668])); + } + + i_570426597 += 1; + if (!(((x_570425623.kids).length == L_570426598))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(254, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + if (!((ul_570425641.childNodes.length == 0))) { + add_570425492(result_570425625, ul_570425641); + } + + if ((result_570425625.childNodes.length == 0)) { + result_570425625 = null; + } + + }; + + return result_570425625; + +} + +function replaceById_570425502(id_570425503, newTree_570425504) { + var x_570425505 = document.getElementById(id_570425503); + x_570425505.parentNode.replaceChild(newTree_570425504, x_570425505); + newTree_570425504.id = id_570425503; + + +} + +function togglevis_570426052(d_570426053) { + if ((d_570426053.style.display == "none")) { + d_570426053.style.display = "inline"; + } + else { + d_570426053.style.display = "none"; + } + + + +} + +function groupBy(value_570426055) { + var toc_570426056 = document.getElementById("toc-list"); + if ((alternative_570426051[0] == null)) { + var tt_570426064 = {heading: null, kids: [], sortId: 0, doSort: false}; + toToc_570425755(toc_570426056, tt_570426064); + tt_570426064 = tt_570426064.kids[chckIndx(0, 0, (tt_570426064.kids).length - 1)]; + var types_570426069 = [[]]; + var procs_570426074 = [[]]; + extractItems_570425543(tt_570426064, "Types", types_570426069, 0); + extractItems_570425543(tt_570426064, "Procs", procs_570426074, 0); + extractItems_570425543(tt_570426064, "Converters", procs_570426074, 0); + extractItems_570425543(tt_570426064, "Methods", procs_570426074, 0); + extractItems_570425543(tt_570426064, "Templates", procs_570426074, 0); + extractItems_570425543(tt_570426064, "Macros", procs_570426074, 0); + extractItems_570425543(tt_570426064, "Iterators", procs_570426074, 0); + var ntoc_570426075 = buildToc_570425994(tt_570426064, types_570426069[0], procs_570426074[0]); + var x_570426076 = toHtml_570425622(ntoc_570426075, true); + alternative_570426051[0] = tree_570425474("DIV", [x_570426076]); + } + + if ((value_570426055 == "type")) { + replaceById_570425502("tocRoot", alternative_570426051[0]); + } + else { + replaceById_570425502("tocRoot", tree_570425474("DIV", [])); + } + + togglevis_570426052(document.getElementById("toc-list")); + + +} + +function HEX5BHEX5D_738198811(s_738198814, x_738198815) { + var result_738198816 = []; + + var a_738198818 = x_738198815.a; + var L_738198820 = addInt(subInt(subInt((s_738198814).length, x_738198815.b), a_738198818), 1); + result_738198816 = nimCopy(null, mnewString(chckRange(L_738198820, 0, 2147483647)), NTI33554449); + Label1: { + var i_738198825 = 0; + var i_570426607 = 0; + Label2: { + Label3: while (true) { + if (!(i_570426607 < L_738198820)) break Label3; + i_738198825 = i_570426607; + result_738198816[chckIndx(i_738198825, 0, (result_738198816).length - 1)] = s_738198814[chckIndx(addInt(i_738198825, a_738198818), 0, (s_738198814).length - 1)]; + i_570426607 = addInt(i_570426607, 1); + } + }; + }; + + return result_738198816; + +} + +function HEX2EHEX2E_973078633(a_973078636, b_973078637) { + var result_973078640 = ({a: 0, b: 0}); + + result_973078640 = nimCopy(result_973078640, {a: a_973078636, b: b_973078637}, NTI973078613); + + return result_973078640; + +} +async function loadIndex_570426272() { + var result_570426274 = null; + + BeforeRet: { + var indexURL_570426280 = document.getElementById("indexLink").getAttribute("href"); + var rootURL_570426306 = HEX5BHEX5D_738198811(cstrToNimstr(indexURL_570426280), HEX2EHEX2E_973078633(0, 14)); + var resp_570426318 = (await (await fetch(indexURL_570426280)).text()); + var indexElem_570426319 = document.createElement("div"); + indexElem_570426319.innerHTML = resp_570426318; + Label1: { + var href_570426341 = null; + var colontmp__570426601 = []; + colontmp__570426601 = indexElem_570426319.getElementsByClassName("reference"); + var i_570426603 = 0; + var L_570426604 = (colontmp__570426601).length; + Label2: { + Label3: while (true) { + if (!(i_570426603 < L_570426604)) break Label3; + href_570426341 = colontmp__570426601[chckIndx(i_570426603, 0, (colontmp__570426601).length - 1)]; + href_570426341.setAttribute("href", toJSStr((rootURL_570426306 || []).concat(cstrToNimstr(href_570426341.getAttribute("href")) || []))); + db_570426093[0].push(href_570426341);; + contents_570426094[0].push(href_570426341.getAttribute("data-doc-search-tag"));; + i_570426603 += 1; + if (!(((colontmp__570426601).length == L_570426604))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(254, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + result_570426274 = undefined; + break BeforeRet; + }; + + return result_570426274; + +} + +function then_570426450(future_570426453, onSuccess_570426454, onReject_570426455) { + var result_570426456 = null; + + BeforeRet: { + var ret_570426466 = null; + ret_570426466 = future_570426453.then(onSuccess_570426454, onReject_570426455) + result_570426456 = ret_570426466; + break BeforeRet; + }; + + return result_570426456; + +} + +function nsuToLowerAsciiChar(c_738197589) { + var result_738197590 = 0; + + if ((ConstSet2[c_738197589] != undefined)) { + result_738197590 = (c_738197589 ^ 32); + } + else { + result_738197590 = c_738197589; + } + + + return result_738197590; + +} + +function fuzzyMatch_721420304(pattern_721420305, str_721420306) { + var Temporary4; + var Temporary5; + var Temporary6; + var Temporary7; + var Temporary8; + + var result_721420309 = {Field0: 0, Field1: false}; + + var scoreState_721420310 = (-100); + var headerMatched_721420311 = false; + var unmatchedLeadingCharCount_721420312 = 0; + var consecutiveMatchCount_721420313 = 0; + var strIndex_721420314 = 0; + var patIndex_721420315 = 0; + var score_721420316 = 0; + Label1: { + Label2: while (true) { + if (!((strIndex_721420314 < ((str_721420306) == null ? 0 : (str_721420306).length)) && (patIndex_721420315 < ((pattern_721420305) == null ? 0 : (pattern_721420305).length)))) break Label2; + Label3: { + var patternChar_721420319 = nsuToLowerAsciiChar(pattern_721420305.charCodeAt(chckIndx(patIndex_721420315, 0, (pattern_721420305).length - 1))); + var strChar_721420320 = nsuToLowerAsciiChar(str_721420306.charCodeAt(chckIndx(strIndex_721420314, 0, (str_721420306).length - 1))); + if ((ConstSet3[patternChar_721420319] != undefined)) { + patIndex_721420315 = addInt(patIndex_721420315, 1); + break Label3; + } + + if ((ConstSet4[strChar_721420320] != undefined)) { + strIndex_721420314 = addInt(strIndex_721420314, 1); + break Label3; + } + + if ((!(headerMatched_721420311) && (strChar_721420320 == 58))) { + headerMatched_721420311 = true; + scoreState_721420310 = (-100); + score_721420316 = ((Math.floor((0.5 * score_721420316))) | 0); + patIndex_721420315 = 0; + strIndex_721420314 = addInt(strIndex_721420314, 1); + break Label3; + } + + if ((strChar_721420320 == patternChar_721420319)) { + switch (scoreState_721420310) { + case (-100): + case 20: + scoreState_721420310 = 10; + break; + case 0: + scoreState_721420310 = 5; + score_721420316 = addInt(score_721420316, scoreState_721420310); + break; + case 10: + case 5: + consecutiveMatchCount_721420313 = addInt(consecutiveMatchCount_721420313, 1); + scoreState_721420310 = 5; + score_721420316 = addInt(score_721420316, mulInt(5, consecutiveMatchCount_721420313)); + if ((scoreState_721420310 == 10)) { + score_721420316 = addInt(score_721420316, 10); + } + + var onBoundary_721420372 = (patIndex_721420315 == ((pattern_721420305) == null ? -1 : (pattern_721420305).length - 1)); + if ((!(onBoundary_721420372) && (strIndex_721420314 < ((str_721420306) == null ? -1 : (str_721420306).length - 1)))) { + var nextPatternChar_721420373 = nsuToLowerAsciiChar(pattern_721420305.charCodeAt(chckIndx(addInt(patIndex_721420315, 1), 0, (pattern_721420305).length - 1))); + var nextStrChar_721420374 = nsuToLowerAsciiChar(str_721420306.charCodeAt(chckIndx(addInt(strIndex_721420314, 1), 0, (str_721420306).length - 1))); + if (!!((ConstSet5[nextStrChar_721420374] != undefined))) Temporary4 = false; else { Temporary4 = !((nextStrChar_721420374 == nextPatternChar_721420373)); } onBoundary_721420372 = Temporary4; + } + + if (onBoundary_721420372) { + scoreState_721420310 = 20; + score_721420316 = addInt(score_721420316, scoreState_721420310); + } + + break; + case (-1): + case (-3): + if (!((ConstSet6[str_721420306.charCodeAt(chckIndx(subInt(strIndex_721420314, 1), 0, (str_721420306).length - 1))] != undefined))) Temporary5 = true; else { if (!(ConstSet7[str_721420306.charCodeAt(chckIndx(subInt(strIndex_721420314, 1), 0, (str_721420306).length - 1))] != undefined)) Temporary6 = false; else { Temporary6 = (ConstSet8[str_721420306.charCodeAt(chckIndx(strIndex_721420314, 0, (str_721420306).length - 1))] != undefined); } Temporary5 = Temporary6; } var isLeadingChar_721420398 = Temporary5; + if (isLeadingChar_721420398) { + scoreState_721420310 = 10; + } + else { + scoreState_721420310 = 0; + score_721420316 = addInt(score_721420316, scoreState_721420310); + } + + break; + } + patIndex_721420315 = addInt(patIndex_721420315, 1); + } + else { + switch (scoreState_721420310) { + case (-100): + scoreState_721420310 = (-3); + score_721420316 = addInt(score_721420316, scoreState_721420310); + break; + case 5: + scoreState_721420310 = (-1); + score_721420316 = addInt(score_721420316, scoreState_721420310); + consecutiveMatchCount_721420313 = 0; + break; + case (-3): + if ((unmatchedLeadingCharCount_721420312 < 3)) { + scoreState_721420310 = (-3); + score_721420316 = addInt(score_721420316, scoreState_721420310); + } + + unmatchedLeadingCharCount_721420312 = addInt(unmatchedLeadingCharCount_721420312, 1); + break; + default: + scoreState_721420310 = (-1); + score_721420316 = addInt(score_721420316, scoreState_721420310); + break; + } + } + + strIndex_721420314 = addInt(strIndex_721420314, 1); + }; + } + }; + if (!(patIndex_721420315 == ((pattern_721420305) == null ? 0 : (pattern_721420305).length))) Temporary7 = false; else { if ((strIndex_721420314 == ((str_721420306) == null ? 0 : (str_721420306).length))) Temporary8 = true; else { Temporary8 = !((ConstSet9[str_721420306.charCodeAt(chckIndx(strIndex_721420314, 0, (str_721420306).length - 1))] != undefined)); } Temporary7 = Temporary8; } if (Temporary7) { + score_721420316 = addInt(score_721420316, 10); + } + + var colontmp__570426620 = nimMax(0, score_721420316); + var colontmp__570426621 = (0 < score_721420316); + result_721420309 = nimCopy(result_721420309, {Field0: colontmp__570426620, Field1: colontmp__570426621}, NTI721420302); + + return result_721420309; + +} + +function escapeCString_570426095(x_570426096, x_570426096_Idx) { + var s_570426097 = []; + Label1: { + var c_570426098 = 0; + var iHEX60gensym13_570426624 = 0; + var nHEX60gensym13_570426625 = ((x_570426096[x_570426096_Idx]) == null ? 0 : (x_570426096[x_570426096_Idx]).length); + Label2: { + Label3: while (true) { + if (!(iHEX60gensym13_570426624 < nHEX60gensym13_570426625)) break Label3; + c_570426098 = x_570426096[x_570426096_Idx].charCodeAt(chckIndx(iHEX60gensym13_570426624, 0, (x_570426096[x_570426096_Idx]).length - 1)); + switch (c_570426098) { + case 60: + s_570426097.push.apply(s_570426097, [38,108,116,59]);; + break; + case 62: + s_570426097.push.apply(s_570426097, [38,103,116,59]);; + break; + default: + addChar(s_570426097, c_570426098);; + break; + } + iHEX60gensym13_570426624 += 1; + } + }; + }; + x_570426096[x_570426096_Idx] = toJSStr(s_570426097); + + +} + +function dosearch_570426099(value_570426100) { + +function HEX3Aanonymous_570426127(a_570426132, b_570426133) { + var result_570426140 = 0; + + result_570426140 = subInt(b_570426133["Field1"], a_570426132["Field1"]); + + return result_570426140; + + } + + var result_570426101 = null; + + BeforeRet: { + if (((db_570426093[0]).length == 0)) { + break BeforeRet; + } + + var ul_570426105 = tree_570425474("UL", []); + result_570426101 = tree_570425474("DIV", []); + setClass_570425496(result_570426101, "search_results"); + var matches_570426110 = []; + Label1: { + var i_570426118 = 0; + var colontmp__570426611 = 0; + colontmp__570426611 = (db_570426093[0]).length; + var i_570426612 = 0; + Label2: { + Label3: while (true) { + if (!(i_570426612 < colontmp__570426611)) break Label3; + i_570426118 = i_570426612; + Label4: { + var c_570426119 = contents_570426094[0][chckIndx(i_570426118, 0, (contents_570426094[0]).length - 1)]; + if (((c_570426119 == "Examples") || (c_570426119 == "PEG construction"))) { + break Label4; + } + + var tmpTuple_570426120 = fuzzyMatch_721420304(value_570426100, c_570426119); + var score_570426121 = tmpTuple_570426120["Field0"]; + var matched_570426122 = tmpTuple_570426120["Field1"]; + if (matched_570426122) { + matches_570426110.push({Field0: db_570426093[0][chckIndx(i_570426118, 0, (db_570426093[0]).length - 1)], Field1: score_570426121});; + } + + }; + i_570426612 = addInt(i_570426612, 1); + } + }; + }; + matches_570426110.sort(HEX3Aanonymous_570426127); + Label5: { + var i_570426157 = 0; + var colontmp__570426615 = 0; + colontmp__570426615 = nimMin((matches_570426110).length, 29); + var i_570426616 = 0; + Label6: { + Label7: while (true) { + if (!(i_570426616 < colontmp__570426615)) break Label7; + i_570426157 = i_570426616; + matches_570426110[chckIndx(i_570426157, 0, (matches_570426110).length - 1)]["Field0"].innerHTML = matches_570426110[chckIndx(i_570426157, 0, (matches_570426110).length - 1)]["Field0"].getAttribute("data-doc-search-tag"); + escapeCString_570426095(matches_570426110[chckIndx(i_570426157, 0, (matches_570426110).length - 1)]["Field0"], "innerHTML"); + add_570425492(ul_570426105, tree_570425474("LI", [matches_570426110[chckIndx(i_570426157, 0, (matches_570426110).length - 1)]["Field0"]])); + i_570426616 = addInt(i_570426616, 1); + } + }; + }; + if ((ul_570426105.childNodes.length == 0)) { + add_570425492(result_570426101, tree_570425474("B", [text_570425499("no search results")])); + } + else { + add_570425492(result_570426101, tree_570425474("B", [text_570425499("search results")])); + add_570425492(result_570426101, ul_570426105); + } + + }; + + return result_570426101; + +} + +function search() { + +function wrapper_570426435() { + var elem_570426436 = document.getElementById("searchInput"); + var value_570426437 = elem_570426436.value; + if (!((((value_570426437) == null ? 0 : (value_570426437).length) == 0))) { + if ((oldtoc_570426430[0] == null)) { + oldtoc_570426430[0] = document.getElementById("tocRoot"); + } + + var results_570426441 = dosearch_570426099(value_570426437); + replaceById_570425502("tocRoot", results_570426441); + } + else { + if (!((oldtoc_570426430[0] == null))) { + replaceById_570425502("tocRoot", oldtoc_570426430[0]); + } + } + + + } + + if ((loadIndexFut_570426433[0] == null)) { + loadIndexFut_570426433[0] = loadIndex_570426272(); + var _ = then_570426450(loadIndexFut_570426433[0], wrapper_570426435, null); + } + + if (!((timer_570426431[0] == null))) { + clearTimeout(timer_570426431[0]); + } + + timer_570426431[0] = setTimeout(wrapper_570426435, 400); + + +} + +function copyToClipboard() { + + function updatePreTags() { + + const allPreTags = document.querySelectorAll("pre") + + allPreTags.forEach((e) => { + + const div = document.createElement("div") + div.classList.add("copyToClipBoard") + + const preTag = document.createElement("pre") + preTag.innerHTML = e.innerHTML + + const button = document.createElement("button") + button.value = e.textContent.replace('...', '') + button.classList.add("copyToClipBoardBtn") + button.style.cursor = "pointer" + + div.appendChild(preTag) + div.appendChild(button) + + e.outerHTML = div.outerHTML + + }) + } + + + function copyTextToClipboard(e) { + const clipBoardContent = e.target.value + navigator.clipboard.writeText(clipBoardContent).then(function() { + e.target.style.setProperty("--clipboard-image", "var(--clipboard-image-selected)") + }, function(err) { + console.error("Could not copy text: ", err); + }); + } + + window.addEventListener("click", (e) => { + if (e.target.classList.contains("copyToClipBoardBtn")) { + copyTextToClipboard(e) + } + }) + + window.addEventListener("mouseover", (e) => { + if (e.target.nodeName === "PRE") { + e.target.nextElementSibling.style.setProperty("--clipboard-image", "var(--clipboard-image-normal)") + } + }) + + window.addEventListener("DOMContentLoaded", updatePreTags) + + + + +} +var Temporary1; +var t_570425383 = window.localStorage.getItem("theme"); +if ((t_570425383 == null)) { +Temporary1 = "auto"; +} +else { +Temporary1 = t_570425383; +} + +setTheme(Temporary1); +var alternative_570426051 = [null]; +var db_570426093 = [[]]; +var contents_570426094 = [[]]; +var oldtoc_570426430 = [null]; +var timer_570426431 = [null]; +var loadIndexFut_570426433 = [null]; +copyToClipboard(); +window.addEventListener("DOMContentLoaded", onDOMLoaded, false); diff --git a/index.html b/index.html new file mode 100644 index 0000000..c9ef557 --- /dev/null +++ b/index.html @@ -0,0 +1,1642 @@ + + + + + + + +Index + + + + + + + + + + + + +
+
+

Index

+ Modules: adix, adix/althash, adix/amoft, adix/bist, adix/bitop, adix/bltab, adix/btree, adix/cpuCT, adix/cumsum, adix/ditab, adix/lghisto, adix/lptabz, adix/memutil, adix/metab, adix/mvstat, adix/nsort, adix/oats, adix/sequint, adix/stat, adix/tdigest, adix/topk, adix/uniqce, adix/xlang.

API symbols

+
`$`:
+
`&=`:
+
`*`:
+
`+=`:
+
`+`:
+
`-+-`:
+
`-`:
+
`<<=`:
+
`<=`:
+
`<`:
+
`==`:
+
`>>=`:
+
`[]=`:
+
`[]`:
+
`^=`:
+
`{}=`:
+
`{}`:
+
`|=`:
+
add:
+
addr0:
+
allItems:
+
allValues:
+
AMOft:
+
Ascending:
+
ascending:
+
BasicStats:
+
basicStats:
+
binAB:
+
bins:
+
Bist:
+
bist:
+
bits:
+
blDenom:
+
blGrowPow2:
+
blInitialSize:
+
blMinFree:
+
blNumer:
+
blRehash:
+
blRobinHood:
+
blSentinel:
+
BLTab:
+
blValueBits:
+
btLinearNode:
+
btPool:
+
card:
+
ccPreDefs:
+
cdf:
+
ceilPow2:
+
cfor:
+
Cheap:
+
clear:
+
compress:
+
contains:
+
containsOrIncl:
+
count:
+
CtMnSketch:
+
cumsum:
+
dbg:
+
debugDump:
+
defBTree:
+
del:
+
depths:
+
depthStats:
+
Descending:
+
descending:
+
diDenom:
+
difference:
+
DigesT:
+
diGrowPow2:
+
diInitialSize:
+
diMinFree:
+
diNumer:
+
diRehash:
+
diRobinHood:
+
DISet:
+
disjoint:
+
DITab:
+
editKey:
+
editOrInit:
+
excl:
+
floorPow2:
+
fromCnts:
+
fromIx:
+
getCap:
+
getItOrFail:
+
getOrDefault:
+
getSalt:
+
Group:
+
groups:
+
hash:
+
hashDegski:
+
hashIdentity:
+
hashMoreMur:
+
hashNASAM:
+
hashRevFib:
+
hashRoMu1:
+
hashRoMu2:
+
hashSplit64:
+
hashSplitMix:
+
hashWangYi1:
+
hashWY0:
+
hasKey:
+
hasKeyOrPut:
+
hcodes:
+
high:
+
inc:
+
incl:
+
indexBy:
+
init:
+
initAMOft:
+
initBist:
+
initBLTab:
+
initCtMnSketch:
+
initDigesT:
+
initDISet:
+
initDITab:
+
initLgHisto:
+
initLPSet:
+
initLPSetz:
+
initLPTab:
+
initLPTabz:
+
initMovingStat:
+
initSeqUint:
+
initSet:
+
initTab:
+
initTopK:
+
initUniqCe:
+
intersection:
+
invCDF:
+
isPow2:
+
items:
+
jaccard:
+
keys:
+
kurtosis:
+
kurtosisS:
+
last:
+
len:
+
lg:
+
lgCeil:
+
lgFloor:
+
LgHisto:
+
lgPow2:
+
load:
+
loadBLTab:
+
loadLPTabz:
+
low:
+
lpDenom:
+
lpGrowPow2:
+
lpInitialSize:
+
lpMaxWarn:
+
lpMinFree:
+
lpNumer:
+
lpRehash:
+
lpRobinHood:
+
LPSet:
+
LPSetz:
+
LPTab:
+
LPTabz:
+
lpWarn:
+
map:
+
max:
+
maybeOrdered:
+
mean:
+
merge:
+
mergeNew:
+
mgetOrPut:
+
min:
+
missingOrExcl:
+
mitems:
+
mmap:
+
mostCommon:
+
MovingStat:
+
mpairs:
+
mvalues:
+
nBin:
+
nInv:
+
normalized:
+
nsort:
+
nsortBy:
+
nsortByRaw:
+
nsortByTag:
+
nthKey:
+
nthPair:
+
numItems:
+
nUnique:
+
nUniqueErr:
+
Oat:
+
oatCounted:
+
oatKStack:
+
oatSeq:
+
oatSlot:
+
oatSlots:
+
Option:
+
orderFit:
+
OrderStats:
+
overflows:
+
pairs:
+
Partn:
+
pmf:
+
pop:
+
pua:
+
pullDown:
+
push:
+
pushUp:
+
quantile:
+
raiseNotFound:
+
ran:
+
range:
+
reverseBits:
+
reverseBitsByte:
+
rightSize:
+
rightSz:
+
ROat:
+
rotateLeftBits:
+
rotateRightBits:
+
save:
+
saw:
+
Scale:
+
scLog:
+
secureSalt:
+
SeqUint:
+
Set:
+
setCap:
+
setLen:
+
setOrIncl:
+
setPolicy:
+
skewness:
+
skewnessS:
+
space:
+
standardDeviation:
+
standardDeviationS:
+
stderror:
+
sum:
+
symmetricDifference:
+
Tab:
+
take:
+
toCnts:
+
toDITab:
+
toIx:
+
toLPTabz:
+
tooFull:
+
topByVal:
+
TopK:
+
TopKOrder:
+
toSet:
+
toTab:
+
underflows:
+
union:
+
UniqCe:
+
upSert:
+
values:
+
variance:
+
varianceS:
+
verb:
+
vmaddrSalt:
+
VOat:
+
VROat:
+
weight:
+
withIt:
+
withValue:
+
x86bmi2:
+
X86Feature:
+
x86features:
+
x86sse2:
+
x86ssse3:
+
xfFlt:
+
xfFltRev:
+
xfNone:
+
XForm:
+
xfRev:
+
xfSgn:
+
xfSgnRev:
+
zeroSalt:
+
+ +
+
+ + + + + + diff --git a/nimdoc.out.css b/nimdoc.out.css new file mode 100644 index 0000000..1417d9e --- /dev/null +++ b/nimdoc.out.css @@ -0,0 +1,1026 @@ +/* +Stylesheet for use with Docutils/rst2html. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. + +Modified from Chad Skeeters' rst2html-style +https://bitbucket.org/cskeeters/rst2html-style/ + +Modified by Boyd Greenfield and narimiran +*/ + +:root { + --primary-background: #fff; + --secondary-background: ghostwhite; + --third-background: #e8e8e8; + --info-background: #50c050; + --warning-background: #c0a000; + --error-background: #e04040; + --border: #dde; + --text: #222; + --anchor: #07b; + --anchor-focus: #607c9f; + --input-focus: #1fa0eb; + --strong: #3c3c3c; + --hint: #9A9A9A; + --nim-sprite-base64: url("data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I5GFcRWNdSxqR7VH1iHHeTV24R+X53C8hSCBvPPqnD8B+AOygn6OYAm0ORSGthLl8B0d4DtRmIKsoMsJF1U/Hi1dt6DusIN8PrsIlUdwOAITpDFlC6q3MTbgmHm011qGepOvQSXPipyOCujW6rxqk0dRWYsVFe8PRSn5JxWOoEvdfOGzfnF5tnCRK+bGi33MoB1hL0U5d1H5J5oVD6A5mp8sQS6KSWh5e0jEcR4BPmhKqJA4xTM3XuxjBlW8DuRacDU3y0myNbNTPHPjxT5m0GTN15A/zVFiI+HKYzgc/ydMlrRfgmQWuYn0F91xJEQYxVuDnMcOrQAWJi2EI72ErQviwqLEQpQ+5XBEIqzi3YWLwF+BMiMcjshEqYR1Gdk1KmxBsaR9SQviSDdRFK8fxVU+YliWZmcbcq7vSFoQR/qJWvuxD0WgLDYoSzPzAqowtjVhORwDhEaKru4GPoliGgcyy4Hj0DLT4TBCo9WO88jQ8Bns97lLghvRTOfqqDiMYqrM+HyUYdBtaLykeRmlK12C9rQOh1FM1vd/HqUIzaT5e+LVoh/VxByHShs6HFaw0VjjHhTxP5d0LT+fRnu5q3HuAodlbHW02Q5cDByM+sw1642cRylCx6PeZiuTFScUFxK+f19QovaRS+t4tsasxhvABbZbSfUCV6CM7qtQl6Fm4E1U22UqcAYqvZ42fgJMxH6vdYc5nkBlSW6Pq4fbS6hb6jg0u9yGug7FyS5U1+UcVBbwbFSuMM1sQ1bXK4A9CcviqM0e9H80HdUxCpwIa4McygA/GfgAcCJqmGKKXUixupEv7nHsLc2agWNQ0d9OzC+PHNHIo1XeLCoe8kkqXiUtwKFoWXoEKqk3BpWLaC8cXsV8HT1J+tFTZKvn+DMqFZi1knvtyKg1O2lBHADcCVxEedNSAP4HJcsr0NNWHVUAAAAASUVORK5CYII="); + + --keyword: #5e8f60; + --identifier: #222; + --comment: #484a86; + --operator: #155da4; + --punctuation: black; + --other: black; + --escapeSequence: #c4891b; + --number: #252dbe; + --literal: #a4255b; + --program: #6060c0; + --option: #508000; + --raw-data: #a4255b; + + --clipboard-image-normal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: black' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E %3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2' /%3E %3C/svg%3E"); + --clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: black' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E"); + --clipboard-image: var(--clipboard-image-normal) +} + +[data-theme="dark"] { + --primary-background: #171921; + --secondary-background: #1e202a; + --third-background: #2b2e3b; + --info-background: #008000; + --warning-background: #807000; + --error-background: #c03000; + --border: #0e1014; + --text: #fff; + --anchor: #8be9fd; + --anchor-focus: #8be9fd; + --input-focus: #8be9fd; + --strong: #bd93f9; + --hint: #7A7C85; + --nim-sprite-base64: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAABMCAYAAABOBlMuAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFFmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAi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tNAudH766XSLE8PR49ixE78/8tVnX403Zk7fUR46NUUAIPIPCMdTKJTdNjY2QKPRgE6nA51OB1tbWyCRSIDD4YBAIAAejwcCgfDYUajVakGlUoFarQadTvfY79HX1wf9/f0gl8tBLpfDvXv3HvXw+dxQPYYXMj+d+P7Mmzv+5OHr6/OJWq1GBHeB09TcUiKuq/coKS3/eqIx/wPkiIXC3w6YjAAAAABJRU5ErkJggg=="); + + --keyword: #ff79c6; + --identifier: #f8f8f2; + --comment: #6272a4; + --operator: #ff79c6; + --punctuation: #f8f8f2; + --other: #f8f8f2; + --escapeSequence: #bd93f9; + --number: #bd93f9; + --literal: #f1fa8c; + --program: #9090c0; + --option: #90b010; + --raw-data: #8be9fd; + + --clipboard-image-normal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E %3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2' /%3E %3C/svg%3E"); + --clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E"); + --clipboard-image: var(--clipboard-image-normal); +} + +@media (prefers-color-scheme: dark) { + [data-theme="auto"] { + --primary-background: #171921; + --secondary-background: #1e202a; + --third-background: #2b2e3b; + --info-background: #008000; + --warning-background: #807000; + --error-background: #c03000; + --border: #0e1014; + --text: #fff; + --anchor: #8be9fd; + --anchor-focus: #8be9fd; + --input-focus: #8be9fd; + --strong: #bd93f9; + --hint: #7A7C85; + --nim-sprite-base64: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAABMCAYAAABOBlMuAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFFmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjEuMCAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE5LTEyLTAzVDAxOjE4OjIyKzAxOjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAxOS0xMi0wM1QwMToyMDoxMCswMTowMCIgeG1wOk1ldGFkYXRhRGF0ZT0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UnsVJTEj9etzY10dHRAQAAGm81wcsZW5CVyQInL69gNCGBjwcAGBx8ANnncypOnTr3H9nn/reD55wovvrQpyIHAHFUzIocGo3mQaPRfBwdHVlubm7bXF1dgcFgABqNNvruglwuh7t374JMJoOOjo7P79y5I+ru7m7q7e1tXQi7MzOh8PIv4pCw2DdaWtte37Au7aPIyCWAxWABjUbPif9HCMbjURtKiaQBfvr5zH9evlJ0uLQ4r/nJMXNiZTIRrMAlJAcHB18HBweWo6Mjy8rKajeJRAJLS0uwtLQECwsLoFAogMfjAYvFgpmZ2XNXMyqVCoaHh2FoaAiGh4cfvwYGBqCvrw+6u7vfvnfvXlNvb29rT09Pq0QsUM7S6c4rNqS/lrZ5U+YPRBKR9M7u9xwqBUUvtNAudH766XSLE8PR49ixE78/8tVnX403Zk7fUR46NUUAIPIPCMdTKJTdNjY2QKPRgE6nA51OB1tbWyCRSIDD4YBAIAAejwcCgfDYUajVakGlUoFarQadTvfY79HX1wf9/f0gl8tBLpfDvXv3HvXw+dxQPYYXMj+d+P7Mmzv+5OHr6/OJWq1GBHeB09TcUiKuq/coKS3/eqIx/wPkiIXC3w6YjAAAAABJRU5ErkJggg=="); + + --keyword: #ff79c6; + --identifier: #f8f8f2; + --comment: #6272a4; + --operator: #ff79c6; + --punctuation: #f8f8f2; + --other: #f8f8f2; + --escapeSequence: #bd93f9; + --number: #bd93f9; + --literal: #f1fa8c; + --program: #9090c0; + --option: #90b010; + --raw-data: #8be9fd; + + --clipboard-image-normal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E %3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2' /%3E %3C/svg%3E"); + --clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E"); + --clipboard-image: var(--clipboard-image-normal); + } +} + +.theme-select-wrapper { + display: flex; + align-items: center; +} + +html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; } + +body { + font-family: "Lato", "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif; + font-weight: 400; + font-size: 1.125em; + line-height: 1.5; + color: var(--text); + background-color: var(--primary-background); } + +/* Skeleton grid */ +.container { + position: relative; + width: 100%; + max-width: 1050px; + margin: 0 auto; + padding: 0; + box-sizing: border-box; } + +.column, .columns { + width: 100%; + float: left; + box-sizing: border-box; + margin-left: 1%; } + +@media print { + #global-links, .link-seesrc, .theme-switch-wrapper, #searchInputDiv, .search-groupby { + display:none; + } + .columns { + width:100% !important; + } +} + +.column:first-child, .columns:first-child { + margin-left: 0; } + +.container .row { + display: flex; } + +.three.columns { + width: 25.0%; + height: 100vh; + position: sticky; + top: 0px; + overflow-y: auto; + padding: 2px; +} + +.nine.columns { + width: 75.0%; + padding-left: 1.5em; } + +.twelve.columns { + width: 100%; + margin-left: 0; } + +@media screen and (max-width: 860px) { + .three.columns { + display: none; + } + .nine.columns { + width: 98.0%; + } + body { + font-size: 1em; + line-height: 1.35; + } +} + +cite { + font-style: italic !important; } + + +/* Nim search input */ +div#searchInputDiv { + margin-bottom: 1em; +} +input#searchInput { + width: 80%; +} + +/* + * Some custom formatting for input forms. + * This also fixes input form colors on Firefox with a dark system theme on Linux. + */ +input { + -moz-appearance: none; + background-color: var(--secondary-background); + color: var(--text); + border: 1px solid var(--border); + font-family: "Lato", "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif; + font-size: 0.9em; + padding: 6px; +} + +input:focus { + border: 1px solid var(--input-focus); + box-shadow: 0 0 3px var(--input-focus); +} + +select { + -moz-appearance: none; + background-color: var(--secondary-background); + color: var(--text); + border: 1px solid var(--border); + font-family: "Lato", "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif; + font-size: 0.9em; + padding: 6px; +} + +select:focus { + border: 1px solid var(--input-focus); + box-shadow: 0 0 3px var(--input-focus); +} + +/* Docgen styles */ + +:target { + border: 2px solid #B5651D; + border-style: dotted; +} + +/* Links */ +a { + color: var(--anchor); + text-decoration: none; +} + +a span.Identifier { + text-decoration: underline; + text-decoration-color: #aab; +} + +a.reference-toplevel { + font-weight: bold; +} + +a.nimdoc { + word-spacing: 0.3em; +} + +a.toc-backref { + text-decoration: none; + color: var(--text); +} + +a.link-seesrc { + color: #607c9f; + font-size: 0.9em; + font-style: italic; +} + +a:hover, a:focus { + color: var(--anchor-focus); + text-decoration: underline; +} + +a:hover span.Identifier { + color: var(--anchor); +} + + +sub, sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +img { + width: auto; + height: auto; + max-width: 100%; + vertical-align: middle; + border: 0; + -ms-interpolation-mode: bicubic; } + +@media print { + * { + color: black !important; + text-shadow: none !important; + background: transparent !important; + box-shadow: none !important; } + + a, a:visited { + text-decoration: underline; } + + a[href]:after { + content: " (" attr(href) ")"; } + + abbr[title]:after { + content: " (" attr(title) ")"; } + + .ir a:after, + a[href^="javascript:"]:after, + a[href^="#"]:after { + content: ""; } + + pre, blockquote { + border: 1px solid #999; + page-break-inside: avoid; } + + thead { + display: table-header-group; } + + tr, img { + page-break-inside: avoid; } + + img { + max-width: 100% !important; } + + @page { + margin: 0.5cm; } + + h1 { + page-break-before: always; } + + h1.title { + page-break-before: avoid; } + + p, h2, h3 { + orphans: 3; + widows: 3; } + + h2, h3 { + page-break-after: avoid; } +} + + +p { + margin-top: 0.5em; + margin-bottom: 0.5em; } + +small { + font-size: 85%; } + +strong { + font-weight: 600; + font-size: 0.95em; + color: var(--strong); } + +em { + font-style: italic; } + +h1 { + font-size: 1.8em; + font-weight: 400; + padding-bottom: .25em; + border-bottom: 6px solid var(--third-background); + margin-top: 2.5em; + margin-bottom: 1em; + line-height: 1.2em; } + +h1.title { + padding-bottom: 1em; + border-bottom: 0px; + font-size: 2.5em; + text-align: center; + font-weight: 900; + margin-top: 0.75em; + margin-bottom: 0em; } + +h2 { + font-size: 1.3em; + margin-top: 2em; } + +h2.subtitle { + margin-top: 0em; + text-align: center; } + +h3 { + font-size: 1.125em; + font-style: italic; + margin-top: 1.5em; } + +h4 { + font-size: 1.125em; + margin-top: 1em; } + +h5 { + font-size: 1.125em; + margin-top: 0.75em; } + +h6 { + font-size: 1.1em; } + + +ul, ol { + padding: 0; + margin-top: 0.5em; + margin-left: 0.75em; } + +ul ul, ul ol, ol ol, ol ul { + margin-bottom: 0; + margin-left: 1.25em; } + +ul.simple > li { + list-style-type: circle; } + +ul.simple-boot li { + list-style-type: none; + margin-left: 0em; + margin-bottom: 0.5em; } + +ol.simple > li, ul.simple > li { + margin-bottom: 0.2em; + margin-left: 0.4em } + +ul.simple.simple-toc > li { + margin-top: 1em; } + +ul.simple-toc { + list-style: none; + font-size: 0.9em; + margin-left: -0.3em; + margin-top: 1em; } + +ul.simple-toc > li { + list-style-type: none; } + +ul.simple-toc-section { + list-style-type: circle; + margin-left: 0.8em; + color: #6c9aae; } + +ul.nested-toc-section { + list-style-type: circle; + margin-left: -0.75em; + color: var(--text); } + +ul.nested-toc-section > li { + margin-left: 1.25em; } + + +ol.arabic { + list-style: decimal; } + +ol.loweralpha { + list-style: lower-alpha; } + +ol.upperalpha { + list-style: upper-alpha; } + +ol.lowerroman { + list-style: lower-roman; } + +ol.upperroman { + list-style: upper-roman; } + +ul.auto-toc { + list-style-type: none; } + + +dl { + margin-bottom: 1.5em; } + +dt { + margin-bottom: -0.5em; + margin-left: 0.0em; } + +dd { + margin-left: 2.0em; + margin-bottom: 3.0em; + margin-top: 0.5em; } + + +hr { + margin: 2em 0; + border: 0; + border-top: 1px solid #aaa; } + +hr.footnote { + width: 25%; + border-top: 0.15em solid #999; + margin-bottom: 0.15em; + margin-top: 0.15em; +} +div.footnote-group { + margin-left: 1em; +} +div.footnote-label { + display: inline-block; + min-width: 1.7em; +} + +div.option-list { + border: 0.1em solid var(--border); +} +div.option-list-item { + padding-left: 12em; + padding-right: 0; + padding-bottom: 0.3em; + padding-top: 0.3em; +} +div.odd { + background-color: var(--secondary-background); +} +div.option-list-label { + margin-left: -11.5em; + margin-right: 0em; + min-width: 11.5em; + display: inline-block; + vertical-align: top; +} +div.option-list-description { + width: calc(100% - 1em); + padding-left: 1em; + padding-right: 0; + display: inline-block; +} + +blockquote { + font-size: 0.9em; + font-style: italic; + padding-left: 0.5em; + margin-left: 0; + border-left: 5px solid #bbc; +} + +blockquote.markdown-quote { + font-size: 0.9rem; /* use rem to avoid recursion */ + font-style: normal; +} + +.pre, span.tok { + font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace; + font-weight: 500; + font-size: 0.85em; + color: var(--text); + background-color: var(--third-background); + padding-left: 3px; + padding-right: 3px; + border-radius: 4px; +} + +span.tok { + border: 1px solid #808080; + padding-bottom: 0.1em; + margin-right: 0.2em; +} + +.copyToClipBoard { + position: relative; +} + +pre { + font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace; + color: var(--text); + font-weight: 500; + display: inline-block; + box-sizing: border-box; + min-width: 100%; + padding: 0.5em; + margin-top: 0.5em; + margin-bottom: 0.5em; + font-size: 0.85em; + white-space: pre !important; + overflow-y: hidden; + overflow-x: visible; + background-color: var(--secondary-background); + border: 1px solid var(--border); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + +.copyToClipBoardBtn { + visibility: hidden; + position: absolute; + width: 24px; + border-radius: 4px; + background-image: var(--clipboard-image); + right: 5px; + top: 13px; + background-color: var(--secondary-background); + padding: 11px; + border: 0; +} + +.copyToClipBoard:hover .copyToClipBoardBtn { + visibility: visible; +} + +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; } + + +/* Nim line-numbered tables */ +.line-nums-table { + width: 100%; + table-layout: fixed; } + +table.line-nums-table { + border-radius: 4px; + border: 1px solid #cccccc; + background-color: ghostwhite; + border-collapse: separate; + margin-top: 15px; + margin-bottom: 25px; } + +.line-nums-table tbody { + border: none; } + +.line-nums-table td pre { + border: none; + background-color: transparent; } + +.line-nums-table td.blob-line-nums { + width: 28px; } + +.line-nums-table td.blob-line-nums pre { + color: #b0b0b0; + -webkit-filter: opacity(75%); + filter: opacity(75%); + text-align: right; + border-color: transparent; + background-color: transparent; + padding-left: 0px; + margin-left: 0px; + padding-right: 0px; + margin-right: 0px; } + + +table { + max-width: 100%; + background-color: transparent; + margin-top: 0.5em; + margin-bottom: 1.5em; + border-collapse: collapse; + border-color: var(--third-background); + border-spacing: 0; + font-size: 0.9em; +} + +table th, table td { + padding: 0px 0.5em 0px; + border-color: var(--third-background); +} + +table th { + background-color: var(--third-background); + border-color: var(--third-background); + font-weight: bold; } + +table th.docinfo-name { + background-color: transparent; + text-align: right; +} + +table tr:hover { + background-color: var(--third-background); } + + +/* rst2html default used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0; } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 !important; } + +.admonition { + padding: 0.3em; + background-color: var(--secondary-background); + border-left: 0.4em solid #7f7f84; + margin-bottom: 0.5em; + -webkit-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); + -moz-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); + box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); +} +.admonition-info { + border-color: var(--info-background); +} +.admonition-info-text { + color: var(--info-background); +} +.admonition-warning { + border-color: var(--warning-background); +} +.admonition-warning-text { + color: var(--warning-background); +} +.admonition-error { + border-color: var(--error-background); +} +.admonition-error-text { + color: var(--error-background); +} + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 !important; } + +.last, .with-subtitle { + margin-bottom: 0 !important; } + +.hidden { + display: none; } + +blockquote.epigraph { + margin: 2em 5em; } + +dl.docutils dd { + margin-bottom: 0.5em; } + +object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] { + overflow: hidden; } + + +div.figure { + margin-left: 2em; + margin-right: 2em; } + +div.footer, div.header { + clear: both; + text-align: center; + color: #666; + font-size: smaller; } + +div.footer { + padding-top: 5em; } + +div.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; } + +div.line-block div.line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; } + +div.topic { + margin: 2em; } + +div.search_results { + background-color: var(--third-background); + margin: 3em; + padding: 1em; + border: 1px solid #4d4d4d; } + +div#global-links ul { + margin-left: 0; + list-style-type: none; } + +div#global-links > simple-boot { + margin-left: 3em; } + +hr.docutils { + width: 75%; } + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; } + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; } + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; } + +.align-left { + text-align: left; } + +.align-center { + clear: both; + text-align: center; } + +.align-right { + text-align: right; } + +/* reset inner alignment in figures */ +div.align-right { + text-align: inherit; } + +p.attribution { + text-align: right; + margin-left: 50%; } + +p.caption { + font-style: italic; } + +p.credits { + font-style: italic; + font-size: smaller; } + +p.label { + white-space: nowrap; } + +p.rubric { + font-weight: bold; + font-size: larger; + color: maroon; + text-align: center; } + +p.topic-title { + font-weight: bold; } + +pre.address { + margin-bottom: 0; + margin-top: 0; + font: inherit; } + +pre.literal-block, pre.doctest-block, pre.math, pre.code { + margin-left: 2em; + margin-right: 2em; } + +pre.code .ln { + color: grey; } + +/* line numbers */ +pre.code, code { + background-color: #eeeeee; } + +pre.code .comment, code .comment { + color: #5c6576; } + +pre.code .keyword, code .keyword { + color: #3B0D06; + font-weight: bold; } + +pre.code .literal.string, code .literal.string { + color: #0c5404; } + +pre.code .name.builtin, code .name.builtin { + color: #352b84; } + +pre.code .deleted, code .deleted { + background-color: #DEB0A1; } + +pre.code .inserted, code .inserted { + background-color: #A3D289; } + +span.classifier { + font-style: oblique; } + +span.classifier-delimiter { + font-weight: bold; } + +span.problematic { + color: #b30000; } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80%; } + +span.DecNumber { + color: var(--number); } + +span.BinNumber { + color: var(--number); } + +span.HexNumber { + color: var(--number); } + +span.OctNumber { + color: var(--number); } + +span.FloatNumber { + color: var(--number); } + +span.Identifier { + color: var(--identifier); } + +span.Keyword { + font-weight: 600; + color: var(--keyword); } + +span.StringLit { + color: var(--literal); } + +span.LongStringLit { + color: var(--literal); } + +span.CharLit { + color: var(--literal); } + +span.EscapeSequence { + color: var(--escapeSequence); } + +span.Operator { + color: var(--operator); } + +span.Punctuation { + color: var(--punctuation); } + +span.Comment, span.LongComment { + font-style: italic; + font-weight: 400; + color: var(--comment); } + +span.RegularExpression { + color: darkviolet; } + +span.TagStart { + color: darkviolet; } + +span.TagEnd { + color: darkviolet; } + +span.Key { + color: #252dbe; } + +span.Value { + color: #252dbe; } + +span.RawData { + color: var(--raw-data); } + +span.Assembler { + color: #252dbe; } + +span.Preprocessor { + color: #252dbe; } + +span.Directive { + color: #252dbe; } + +span.option { + font-weight: bold; + font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace; + color: var(--option); } + +span.Prompt { + font-weight: bold; + color: red; } + +span.ProgramOutput { + font-weight: bold; + color: #808080; } + +span.program { + font-weight: bold; + color: var(--program); + text-decoration: underline; + text-decoration-color: var(--hint); + text-decoration-thickness: 0.05em; + text-underline-offset: 0.15em; } + +span.Command, span.Rule, span.Hyperlink, +span.Label, span.Reference, span.Other { + color: var(--other); } + +/* Pop type, const, proc, and iterator defs in nim def blocks */ +dt pre > span.Identifier, dt pre > span.Operator { + color: var(--identifier); + font-weight: 700; } + +dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier, +dt pre > span.Operator ~ span.Identifier, dt pre > span.Other ~ span.Identifier { + color: var(--identifier); + font-weight: inherit; } + +/* Nim sprite for the footer (taken from main page favicon) */ +.nim-sprite { + display: inline-block; + width: 51px; + height: 14px; + background-position: 0 0; + background-size: 51px 14px; + -webkit-filter: opacity(50%); + filter: opacity(50%); + background-repeat: no-repeat; + background-image: var(--nim-sprite-base64); + margin-bottom: 5px; } + +span.pragmadots { + /* Position: relative frees us up to make the dots + look really nice without fucking up the layout and + causing bulging in the parent container */ + position: relative; + /* 1px down looks slightly nicer */ + top: 1px; + padding: 2px; + background-color: var(--third-background); + border-radius: 4px; + margin: 0 2px; + cursor: pointer; + font-size: 0.8em; } + +span.pragmadots:hover { + background-color: var(--hint); } + +span.pragmawrap { + display: none; } + +span.attachedType { + display: none; + visibility: hidden; } diff --git a/theindex.html b/theindex.html new file mode 100644 index 0000000..c9ef557 --- /dev/null +++ b/theindex.html @@ -0,0 +1,1642 @@ + + + + + + + +Index + + + + + + + + + + + + +
+
+

Index

+ Modules: adix, adix/althash, adix/amoft, adix/bist, adix/bitop, adix/bltab, adix/btree, adix/cpuCT, adix/cumsum, adix/ditab, adix/lghisto, adix/lptabz, adix/memutil, adix/metab, adix/mvstat, adix/nsort, adix/oats, adix/sequint, adix/stat, adix/tdigest, adix/topk, adix/uniqce, adix/xlang.

API symbols

+
`$`:
+
`&=`:
+
`*`:
+
`+=`:
+
`+`:
+
`-+-`:
+
`-`:
+
`<<=`:
+
`<=`:
+
`<`:
+
`==`:
+
`>>=`:
+
`[]=`:
+
`[]`:
+
`^=`:
+
`{}=`:
+
`{}`:
+
`|=`:
+
add:
+
addr0:
+
allItems:
+
allValues:
+
AMOft:
+
Ascending:
+
ascending:
+
BasicStats:
+
basicStats:
+
binAB:
+
bins:
+
Bist:
+
bist:
+
bits:
+
blDenom:
+
blGrowPow2:
+
blInitialSize:
+
blMinFree:
+
blNumer:
+
blRehash:
+
blRobinHood:
+
blSentinel:
+
BLTab:
+
blValueBits:
+
btLinearNode:
+
btPool:
+
card:
+
ccPreDefs:
+
cdf:
+
ceilPow2:
+
cfor:
+
Cheap:
+
clear:
+
compress:
+
contains:
+
containsOrIncl:
+
count:
+
CtMnSketch:
+
cumsum:
+
dbg:
+
debugDump:
+
defBTree:
+
del:
+
depths:
+
depthStats:
+
Descending:
+
descending:
+
diDenom:
+
difference:
+
DigesT:
+
diGrowPow2:
+
diInitialSize:
+
diMinFree:
+
diNumer:
+
diRehash:
+
diRobinHood:
+
DISet:
+
disjoint:
+
DITab:
+
editKey:
+
editOrInit:
+
excl:
+
floorPow2:
+
fromCnts:
+
fromIx:
+
getCap:
+
getItOrFail:
+
getOrDefault:
+
getSalt:
+
Group:
+
groups:
+
hash:
+
hashDegski:
+
hashIdentity:
+
hashMoreMur:
+
hashNASAM:
+
hashRevFib:
+
hashRoMu1:
+
hashRoMu2:
+
hashSplit64:
+
hashSplitMix:
+
hashWangYi1:
+
hashWY0:
+
hasKey:
+
hasKeyOrPut:
+
hcodes:
+
high:
+
inc:
+
incl:
+
indexBy:
+
init:
+
initAMOft:
+
initBist:
+
initBLTab:
+
initCtMnSketch:
+
initDigesT:
+
initDISet:
+
initDITab:
+
initLgHisto:
+
initLPSet:
+
initLPSetz:
+
initLPTab:
+
initLPTabz:
+
initMovingStat:
+
initSeqUint:
+
initSet:
+
initTab:
+
initTopK:
+
initUniqCe:
+
intersection:
+
invCDF:
+
isPow2:
+
items:
+
jaccard:
+
keys:
+
kurtosis:
+
kurtosisS:
+
last:
+
len:
+
lg:
+
lgCeil:
+
lgFloor:
+
LgHisto:
+
lgPow2:
+
load:
+
loadBLTab:
+
loadLPTabz:
+
low:
+
lpDenom:
+
lpGrowPow2:
+
lpInitialSize:
+
lpMaxWarn:
+
lpMinFree:
+
lpNumer:
+
lpRehash:
+
lpRobinHood:
+
LPSet:
+
LPSetz:
+
LPTab:
+
LPTabz:
+
lpWarn:
+
map:
+
max:
+
maybeOrdered:
+
mean:
+
merge:
+
mergeNew:
+
mgetOrPut:
+
min:
+
missingOrExcl:
+
mitems:
+
mmap:
+
mostCommon:
+
MovingStat:
+
mpairs:
+
mvalues:
+
nBin:
+
nInv:
+
normalized:
+
nsort:
+
nsortBy:
+
nsortByRaw:
+
nsortByTag:
+
nthKey:
+
nthPair:
+
numItems:
+
nUnique:
+
nUniqueErr:
+
Oat:
+
oatCounted:
+
oatKStack:
+
oatSeq:
+
oatSlot:
+
oatSlots:
+
Option:
+
orderFit:
+
OrderStats:
+
overflows:
+
pairs:
+
Partn:
+
pmf:
+
pop:
+
pua:
+
pullDown:
+
push:
+
pushUp:
+
quantile:
+
raiseNotFound:
+
ran:
+
range:
+
reverseBits:
+
reverseBitsByte:
+
rightSize:
+
rightSz:
+
ROat:
+
rotateLeftBits:
+
rotateRightBits:
+
save:
+
saw:
+
Scale:
+
scLog:
+
secureSalt:
+
SeqUint:
+
Set:
+
setCap:
+
setLen:
+
setOrIncl:
+
setPolicy:
+
skewness:
+
skewnessS:
+
space:
+
standardDeviation:
+
standardDeviationS:
+
stderror:
+
sum:
+
symmetricDifference:
+
Tab:
+
take:
+
toCnts:
+
toDITab:
+
toIx:
+
toLPTabz:
+
tooFull:
+
topByVal:
+
TopK:
+
TopKOrder:
+
toSet:
+
toTab:
+
underflows:
+
union:
+
UniqCe:
+
upSert:
+
values:
+
variance:
+
varianceS:
+
verb:
+
vmaddrSalt:
+
VOat:
+
VROat:
+
weight:
+
withIt:
+
withValue:
+
x86bmi2:
+
X86Feature:
+
x86features:
+
x86sse2:
+
x86ssse3:
+
xfFlt:
+
xfFltRev:
+
xfNone:
+
XForm:
+
xfRev:
+
xfSgn:
+
xfSgnRev:
+
zeroSalt:
+
+ +
+
+ + + + + +