@fluidframework/matrix 2.0.0-dev.5.3.2.178189 → 2.0.0-dev.6.4.0.191258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +4 -3
  3. package/dist/handlecache.js +3 -3
  4. package/dist/handlecache.js.map +1 -1
  5. package/dist/handletable.d.ts +8 -1
  6. package/dist/handletable.d.ts.map +1 -1
  7. package/dist/handletable.js +11 -3
  8. package/dist/handletable.js.map +1 -1
  9. package/dist/matrix.d.ts.map +1 -1
  10. package/dist/matrix.js +17 -18
  11. package/dist/matrix.js.map +1 -1
  12. package/dist/packageVersion.d.ts +1 -1
  13. package/dist/packageVersion.js +1 -1
  14. package/dist/packageVersion.js.map +1 -1
  15. package/dist/permutationvector.d.ts.map +1 -1
  16. package/dist/permutationvector.js +11 -8
  17. package/dist/permutationvector.js.map +1 -1
  18. package/dist/serialization.js +2 -2
  19. package/dist/serialization.js.map +1 -1
  20. package/dist/sparsearray2d.d.ts.map +1 -1
  21. package/dist/sparsearray2d.js +1 -0
  22. package/dist/sparsearray2d.js.map +1 -1
  23. package/dist/undoprovider.js +8 -9
  24. package/dist/undoprovider.js.map +1 -1
  25. package/lib/handlecache.js +1 -1
  26. package/lib/handlecache.js.map +1 -1
  27. package/lib/handletable.d.ts +8 -1
  28. package/lib/handletable.d.ts.map +1 -1
  29. package/lib/handletable.js +11 -3
  30. package/lib/handletable.js.map +1 -1
  31. package/lib/matrix.d.ts.map +1 -1
  32. package/lib/matrix.js +3 -4
  33. package/lib/matrix.js.map +1 -1
  34. package/lib/packageVersion.d.ts +1 -1
  35. package/lib/packageVersion.js +1 -1
  36. package/lib/packageVersion.js.map +1 -1
  37. package/lib/permutationvector.d.ts.map +1 -1
  38. package/lib/permutationvector.js +6 -3
  39. package/lib/permutationvector.js.map +1 -1
  40. package/lib/serialization.js +1 -1
  41. package/lib/serialization.js.map +1 -1
  42. package/lib/sparsearray2d.d.ts.map +1 -1
  43. package/lib/sparsearray2d.js +1 -0
  44. package/lib/sparsearray2d.js.map +1 -1
  45. package/lib/undoprovider.js +5 -6
  46. package/lib/undoprovider.js.map +1 -1
  47. package/package.json +27 -31
  48. package/src/handlecache.ts +1 -1
  49. package/src/handletable.ts +22 -2
  50. package/src/matrix.ts +2 -1
  51. package/src/packageVersion.ts +1 -1
  52. package/src/permutationvector.ts +3 -4
  53. package/src/serialization.ts +1 -1
  54. package/src/sparsearray2d.ts +1 -0
  55. package/src/undoprovider.ts +1 -1
  56. package/dist/bspSet.d.ts +0 -125
  57. package/dist/bspSet.d.ts.map +0 -1
  58. package/dist/bspSet.js +0 -425
  59. package/dist/bspSet.js.map +0 -1
  60. package/dist/productSet.d.ts +0 -61
  61. package/dist/productSet.d.ts.map +0 -1
  62. package/dist/productSet.js +0 -679
  63. package/dist/productSet.js.map +0 -1
  64. package/dist/split.d.ts +0 -41
  65. package/dist/split.d.ts.map +0 -1
  66. package/dist/split.js +0 -127
  67. package/dist/split.js.map +0 -1
  68. package/lib/bspSet.d.ts +0 -125
  69. package/lib/bspSet.d.ts.map +0 -1
  70. package/lib/bspSet.js +0 -402
  71. package/lib/bspSet.js.map +0 -1
  72. package/lib/productSet.d.ts +0 -61
  73. package/lib/productSet.d.ts.map +0 -1
  74. package/lib/productSet.js +0 -665
  75. package/lib/productSet.js.map +0 -1
  76. package/lib/split.d.ts +0 -41
  77. package/lib/split.d.ts.map +0 -1
  78. package/lib/split.js +0 -116
  79. package/lib/split.js.map +0 -1
  80. package/src/bspSet.ts +0 -722
  81. package/src/productSet.ts +0 -1038
  82. package/src/split.ts +0 -171
@@ -1 +0,0 @@
1
- {"version":3,"file":"productSet.js","sourceRoot":"","sources":["../src/productSet.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;AAEH,qCAmBkB;AAmElB,MAAM,IAAI,GAAyC,EAAE,CAAC;AACtD,MAAM,GAAG,GAAG,CAAI,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,MAAM,CAAC;IAE3C,SAAS,IAAI,CAAC,UAAmC;QAChD,IAAI,UAAU,CAAC,UAAU,EAAE;YAC1B,OAAO,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;SAChF;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC;AAvBD,wCAuBC;AAED,SAAgB,gBAAgB,CAAI,GAAkB;IACrD,IAAI,GAAG,KAAK,cAAK,IAAI,GAAG,KAAK,cAAK,EAAE;QACnC,OAAO,CAAC,CAAC;KACT;IACD,OAAO,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AALD,4CAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBspSet,\n\tempty,\n\tdense,\n\tEmpty,\n\tDense,\n\tcombineCmp,\n\tSetOperations,\n\tintersectUntyped,\n\tcompareUntyped,\n\tCachable,\n\tUntypedBspSet,\n\tunionUntyped,\n\texceptUntyped,\n\tlazy,\n\tUntypedSparse,\n\tfromUntyped,\n\tmeetsUntyped,\n\tPair,\n} from \"./bspSet\";\n\ntype Restrict<T, Props extends (keyof T)[]> = { [Prop in Props[number]]: T[Prop] };\n\nexport type Product<T> = {\n\treadonly [dim in keyof T]: T[dim] extends BspSet<infer _TKey, infer _TId> ? T[dim] : never;\n};\n\ntype UntypedProduct<T> = {\n\treadonly [dim in keyof T]?: T[dim] extends BspSet<infer TKey, infer _TId>\n\t\t? UntypedSparse<TKey>\n\t\t: never;\n};\n\ntype Probabilities<T> = { readonly [dim in keyof T]?: number };\n\ntype ProductOperations<T> = {\n\treadonly [dim in keyof T]: T[dim] extends BspSet<infer TKey, infer TId>\n\t\t? SetOperations<TKey, TId>\n\t\t: never;\n};\n\n/** Given a cartesian product, a subspace is a subset of said space, such that it is also a cartesian product\n * and all the dimensions form subsets of the original cartesian product.\n *\n * This is a generalized notion of something like hyper-rectangles. Examples include:\n * - Rectangles\n * - Individual cells in a grid\n * - Rectangular ranges with missing rows and/or columns\n *\n * For the actual definition and properties, please read the document about *Operations on Cartesian Products*.\n */\ninterface Subspace<T> {\n\treadonly isSubspace: true;\n\t// isCoSubspace: boolean;\n\treadonly bounds: UntypedProduct<T>;\n}\n\n// type CoSubspace<T> = {\n// isSubspace: boolean;\n// isCoSubspace: true;\n// subspace: Product<T>;\n// };\n\ninterface Union<T> {\n\treadonly isSubspace: false;\n\t// readonly isCoSubspace: false;\n\treadonly left: UntypedSparseProduct<T>;\n\treadonly right: UntypedSparseProduct<T>;\n\treadonly bounds: UntypedProduct<T>;\n\treadonly subspaceCount: number;\n}\n\ntype UntypedSparseProduct<T> = Subspace<T> | Union<T>; // | CoSubspace<T>;\n\ninterface SparseProduct<T> {\n\treadonly productOperations: ProductOperations<T>;\n\treadonly root: UntypedSparseProduct<T>;\n}\n\ninterface Box<T> {\n\tbox: UntypedProduct<T>;\n\tprobabilities: Probabilities<T>;\n\tchildren?: Pair<Box<T>>;\n\tdepth: number;\n}\n\nconst tops: { [poKey in string]?: Box<unknown> } = {};\nconst top = <T>(productOperations: ProductOperations<T>): Box<T> => {\n\tconst dims: [keyof T, ProductOperations<T>[keyof T][\"id\"]][] = [];\n\tfor (const dimStr of Object.keys(productOperations)) {\n\t\tconst dim = dimStr as keyof T;\n\t\tdims.push([dim, productOperations[dim].id]);\n\t}\n\n\tconst poKey = JSON.stringify(dims.sort());\n\tlet currTop = tops[poKey];\n\tif (currTop === undefined) {\n\t\tcurrTop = { box: {}, probabilities: {}, depth: 1 };\n\t\ttops[poKey] = currTop;\n\t}\n\n\treturn currTop;\n};\n\nfunction subspace<T>(bounds: UntypedProduct<T>): Subspace<T> | Dense {\n\tlet isDense = true;\n\tfor (const dim of Object.keys(bounds)) {\n\t\tif (Object.prototype.hasOwnProperty.call(bounds, dim)) {\n\t\t\tisDense = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (isDense) {\n\t\treturn dense;\n\t}\n\treturn { isSubspace: true as const, bounds };\n}\n\nfunction getUntypedSubspaceCount<T>(set: UntypedSparseProduct<T>) {\n\tif (set.isSubspace) {\n\t\treturn 1;\n\t}\n\treturn set.subspaceCount;\n}\n\nconst union = <T>(\n\tleft: UntypedSparseProduct<T>,\n\tright: UntypedSparseProduct<T>,\n\tbounds: UntypedProduct<T>,\n): Union<T> => ({\n\tisSubspace: false as const,\n\tleft,\n\tright,\n\tbounds,\n\tsubspaceCount: getUntypedSubspaceCount(left) + getUntypedSubspaceCount(right),\n});\n\nfunction sparseProduct<T>(\n\tproductOperations: ProductOperations<T>,\n\troot: UntypedSparseProduct<T> | Dense,\n): SparseProduct<T> | Dense {\n\tif (root === dense) {\n\t\treturn root;\n\t}\n\tif (root.isSubspace) {\n\t\tlet hasSparseDimensions = false;\n\t\tfor (const dim of Object.keys(root.bounds)) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(productOperations, dim)) {\n\t\t\t\thasSparseDimensions = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!hasSparseDimensions) {\n\t\t\treturn dense;\n\t\t}\n\t}\n\treturn { productOperations, root };\n}\n\ntype UntypedProductSet<T> = Empty | Dense | UntypedSparseProduct<T>;\nexport type ProductSet<T> = Empty | Dense | SparseProduct<T>;\n\nfunction toBspSet<T>(set: UntypedBspSet<T> | undefined) {\n\tif (set === undefined) {\n\t\treturn dense;\n\t}\n\treturn set;\n}\n\n/** An object that contains all downcasts. The operations in here are generally of the kind that need dynamic\n * features, i.e. iterate over the object properties somehow. Their *usage* can be considered safe, but they warrant\n * more careful review whenever a change occurs, because we get less support from the type system and we are\n * downcasting. */\nconst unsafe = {\n\tunzip<T>(product: Product<T>): ProductSet<T> {\n\t\tconst productOperations: { [dim in keyof T]?: SetOperations<unknown, unknown> } = {};\n\t\tconst root: { [dim in keyof T]?: UntypedSparse<unknown> } = {};\n\t\tfor (const dimStr of Object.keys(product)) {\n\t\t\tconst dim = dimStr as keyof T;\n\t\t\tif (Object.prototype.hasOwnProperty.call(product, dim)) {\n\t\t\t\tconst set: BspSet<unknown, unknown> = product[dim];\n\t\t\t\tif (set === empty) {\n\t\t\t\t\treturn empty;\n\t\t\t\t}\n\t\t\t\tif (set === dense) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tproductOperations[dim] = set.setOperations;\n\t\t\t\troot[dim] = set.root;\n\t\t\t}\n\t\t}\n\n\t\treturn sparseProduct(\n\t\t\tproductOperations as ProductOperations<T>,\n\t\t\tsubspace(root as UntypedProduct<T>),\n\t\t);\n\t},\n\n\tcombineProduct<T>(\n\t\tproductOperations: ProductOperations<T>,\n\t\tleft: UntypedProduct<T>,\n\t\tright: UntypedProduct<T>,\n\t\tcombineFunc: <Key extends Cachable<Key>, Id>(\n\t\t\tsetOperations: SetOperations<Key, Id>,\n\t\t\tleft: UntypedBspSet<Key>,\n\t\t\tright: UntypedBspSet<Key>,\n\t\t) => UntypedBspSet<Key>,\n\t) {\n\t\tconst res: { [dim in keyof T]?: UntypedSparse<unknown> } = {};\n\t\tfor (const dimStr of Object.keys(productOperations)) {\n\t\t\tconst dim = dimStr as keyof T;\n\t\t\tif (Object.prototype.hasOwnProperty.call(productOperations, dim)) {\n\t\t\t\tconst combined = combineFunc<unknown, unknown>(\n\t\t\t\t\tproductOperations[dim],\n\t\t\t\t\ttoBspSet(left[dim]),\n\t\t\t\t\ttoBspSet(right[dim]),\n\t\t\t\t);\n\t\t\t\tif (combined === empty) {\n\t\t\t\t\treturn combined;\n\t\t\t\t}\n\t\t\t\tif (combined === dense) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tres[dim] = combined;\n\t\t\t}\n\t\t}\n\n\t\treturn res as UntypedProduct<T>;\n\t},\n\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\trestrict<T extends object, Props extends (keyof T)[]>(object: T, ...props: Props) {\n\t\tconst res: Partial<Restrict<T, Props>> = {};\n\t\tfor (const key of props) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(object, key)) {\n\t\t\t\tconst prop = object[key];\n\t\t\t\tres[key] = prop;\n\t\t\t}\n\t\t}\n\n\t\treturn res as Restrict<T, Props>;\n\t},\n\n\tfromUntypedProduct<T, Props extends (keyof T)[]>(\n\t\tproductOperations: ProductOperations<Restrict<T, Props>>,\n\t\tbounds: UntypedProduct<Restrict<T, Props>>,\n\t\tdims: Props,\n\t) {\n\t\tconst product: { [dim in Props[number]]?: BspSet<unknown, unknown> } = {};\n\t\tfor (const dim of dims) {\n\t\t\tconst bound: UntypedSparse<unknown> | undefined = bounds[dim];\n\t\t\tproduct[dim] = fromUntyped(productOperations[dim], bound !== undefined ? bound : dense);\n\t\t}\n\t\treturn product as Product<Restrict<T, Props>>;\n\t},\n\n\tdenseProduct<T, Props extends (keyof T)[]>(dims: Props): Product<Restrict<T, Props>> {\n\t\tconst top_inner: { [dim in Props[number]]?: Dense } = {};\n\t\tfor (const dim of dims) {\n\t\t\ttop_inner[dim] = dense;\n\t\t}\n\t\treturn top_inner as Product<Restrict<T, Props>>;\n\t},\n};\n\nexport const createFromProduct = unsafe.unzip.bind(unsafe);\n\ntype Compatible<T, U> = { [dim in keyof T & keyof U]: T[dim] };\n\nfunction joinBounds<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProduct<T>,\n\tright: UntypedProduct<T>,\n) {\n\tconst join = unsafe.combineProduct(productOperations, left, right, unionUntyped);\n\tif (join === empty) {\n\t\tthrow new Error(\"broken invariant: the union of two non-empty products cannot be empty\");\n\t}\n\n\treturn join;\n}\n\nfunction compareSubspace<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProduct<T>,\n\tright: UntypedProduct<T>,\n) {\n\tlet cmp: ReturnType<typeof combineCmp> = 0;\n\tfor (const dimStr of Object.keys(productOperations)) {\n\t\tconst dim = dimStr as keyof T;\n\t\tif (Object.prototype.hasOwnProperty.call(productOperations, dim)) {\n\t\t\tconst lProj = toBspSet(left[dim]);\n\t\t\tconst rProj = toBspSet(right[dim]);\n\t\t\tconst setOperations = productOperations[dim];\n\n\t\t\tcmp = combineCmp(cmp, compareUntyped<unknown, unknown>(setOperations, lProj, rProj));\n\n\t\t\tif (cmp === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cmp;\n}\n\nconst tryUnionSubspaces = (() => {\n\tconst cache: { left?: unknown; right?: unknown; res?: unknown } = {};\n\treturn <T>(\n\t\tproductOperations: ProductOperations<T>,\n\t\tleft: Subspace<T>,\n\t\tright: Subspace<T>,\n\t): Subspace<T> | Dense | Empty | undefined => {\n\t\tif (left === cache.left && right === cache.right) {\n\t\t\treturn cache.res as ReturnType<typeof tryUnionSubspaces>;\n\t\t}\n\t\tcache.left = left;\n\t\tcache.right = right;\n\n\t\tconst cmp = compareSubspace(productOperations, left.bounds, right.bounds);\n\t\tif (cmp !== undefined) {\n\t\t\treturn (cache.res = cmp <= 0 ? right : left);\n\t\t}\n\t\tlet differentDimension: keyof T | undefined;\n\n\t\t// because Object.keys only returns string[], we need to downcast\n\t\tconst po_keys = Object.keys(productOperations) as (keyof T)[];\n\t\tfor (const dim of po_keys) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(productOperations, dim)) {\n\t\t\t\tconst cmp_inner = compareUntyped<unknown, unknown>(\n\t\t\t\t\tproductOperations[dim],\n\t\t\t\t\ttoBspSet(left.bounds[dim]),\n\t\t\t\t\ttoBspSet(right.bounds[dim]),\n\t\t\t\t);\n\t\t\t\tif (cmp_inner !== 0) {\n\t\t\t\t\tif (differentDimension !== undefined) {\n\t\t\t\t\t\treturn (cache.res = undefined);\n\t\t\t\t\t}\n\n\t\t\t\t\tdifferentDimension = dim;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (differentDimension !== undefined) {\n\t\t\tconst newDim = unionUntyped<unknown, unknown>(\n\t\t\t\tproductOperations[differentDimension],\n\t\t\t\ttoBspSet(left.bounds[differentDimension]),\n\t\t\t\ttoBspSet(right.bounds[differentDimension]),\n\t\t\t);\n\t\t\tif (newDim === empty) {\n\t\t\t\treturn (cache.res = empty);\n\t\t\t}\n\t\t\tif (newDim === dense) {\n\t\t\t\t// we are actually deleting the `differentDimension`, so the variable\n\t\t\t\t// `deleted` must be there. Hence disabling the rule here.\n\t\t\t\tconst { [differentDimension]: deleted, ...leftBoundsWithoutDifferentDimension } =\n\t\t\t\t\tleft.bounds;\n\t\t\t\treturn (cache.res = subspace<unknown>(leftBoundsWithoutDifferentDimension));\n\t\t\t}\n\n\t\t\tconst newBounds: UntypedProduct<T> = {\n\t\t\t\t...left.bounds,\n\t\t\t\t[differentDimension]: newDim,\n\t\t\t};\n\t\t\treturn (cache.res = subspace(newBounds));\n\t\t}\n\n\t\treturn (cache.res = undefined);\n\t};\n})();\n\nfunction combineChildren<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProductSet<T>,\n\tright: UntypedProductSet<T>,\n): UntypedProductSet<T> {\n\tif (right === empty) {\n\t\treturn left;\n\t}\n\tif (right === dense) {\n\t\treturn right;\n\t}\n\tif (left === empty) {\n\t\treturn right;\n\t}\n\tif (left === dense) {\n\t\treturn left;\n\t}\n\n\tif (!left.isSubspace || !right.isSubspace) {\n\t\treturn union<T>(left, right, joinBounds(productOperations, left.bounds, right.bounds));\n\t}\n\n\tconst combinedSubspace = tryUnionSubspaces<T>(productOperations, left, right);\n\n\tif (combinedSubspace !== undefined) {\n\t\treturn combinedSubspace;\n\t}\n\treturn union(left, right, joinBounds(productOperations, left.bounds, right.bounds));\n}\n\nfunction projectUntyped<T, Props extends (keyof T)[]>(\n\tproductOperations: ProductOperations<T>,\n\tset: UntypedSparseProduct<T>,\n\t...dims: Props\n): UntypedProductSet<Restrict<T, Props>> {\n\tconst bounds = unsafe.restrict(set.bounds, ...dims);\n\tif (set.isSubspace) {\n\t\treturn subspace(bounds);\n\t}\n\n\tconst lChild = projectUntyped(productOperations, set.left, ...dims);\n\tif (lChild === dense) {\n\t\treturn dense;\n\t}\n\tconst rChild = projectUntyped(productOperations, set.right, ...dims);\n\treturn combineChildren(productOperations, lChild, rChild);\n}\n\nexport function project<T, Props extends (keyof T)[]>(\n\tset: ProductSet<T>,\n\t...dims: Props\n): ProductSet<Restrict<T, Props>> {\n\tif (set === dense || set === empty) {\n\t\treturn set;\n\t}\n\tconst productOperations = unsafe.restrict(set.productOperations, ...dims);\n\tconst root = projectUntyped(productOperations, set.root, ...dims);\n\tif (root === empty) {\n\t\treturn root;\n\t}\n\treturn sparseProduct(productOperations, root);\n}\n\nfunction splitBox<T>(productOperations: ProductOperations<T>, currentBox: Box<T>): Pair<Box<T>> {\n\tif (currentBox.children !== undefined) {\n\t\treturn currentBox.children;\n\t}\n\tconst { box, probabilities } = currentBox;\n\tlet biggestDim: keyof T | undefined;\n\tlet biggestDimKey;\n\tlet currentProb = 0;\n\t// because Object.keys only returns string[], we need to downcast\n\tconst po_keys = Object.keys(productOperations) as (keyof T)[];\n\tfor (const dim of po_keys) {\n\t\tif (Object.prototype.hasOwnProperty.call(productOperations, dim)) {\n\t\t\tconst prob: number | undefined = probabilities[dim];\n\t\t\tconst setOperations_inner = productOperations[dim];\n\t\t\tif (prob === undefined) {\n\t\t\t\tbiggestDim = dim;\n\t\t\t\tbiggestDimKey = setOperations_inner.top;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (prob > currentProb) {\n\t\t\t\tconst dimensionSet = toBspSet(box[dim]);\n\t\t\t\tif (dimensionSet === empty) {\n\t\t\t\t\tthrow new Error(\"the key split can never return empty\");\n\t\t\t\t}\n\t\t\t\tlet key = setOperations_inner.top;\n\t\t\t\tif (dimensionSet !== dense) {\n\t\t\t\t\tif (!dimensionSet.isExact) {\n\t\t\t\t\t\tthrow new Error(\"the key can always be represented exactly\");\n\t\t\t\t\t}\n\n\t\t\t\t\tkey = dimensionSet.key;\n\t\t\t\t}\n\t\t\t\tif (!setOperations_inner.canSplit(key)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbiggestDim = dim;\n\t\t\t\tcurrentProb = prob;\n\t\t\t\tbiggestDimKey = key;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (biggestDim === undefined || biggestDimKey === undefined) {\n\t\tthrow new Error(\"there has to be at least one dimension\");\n\t}\n\n\tconst setOperations = productOperations[biggestDim];\n\n\tconst [[leftDim, leftProb], [rightDim, rightProb]] = setOperations.split(biggestDimKey);\n\tconst res: ReturnType<typeof splitBox> = [\n\t\t{\n\t\t\tbox: {\n\t\t\t\t...box,\n\t\t\t\t[biggestDim]: lazy<unknown, unknown>(setOperations, setOperations.top, leftDim),\n\t\t\t},\n\t\t\tprobabilities: { ...probabilities, [biggestDim]: leftProb },\n\t\t\tdepth: currentBox.depth + 1,\n\t\t},\n\t\t{\n\t\t\tbox: {\n\t\t\t\t...box,\n\t\t\t\t[biggestDim]: lazy<unknown, unknown>(setOperations, setOperations.top, rightDim),\n\t\t\t},\n\t\t\tprobabilities: { ...probabilities, [biggestDim]: rightProb },\n\t\t\tdepth: currentBox.depth + 1,\n\t\t},\n\t];\n\tif (currentBox.depth < 10) {\n\t\tcurrentBox.children = res;\n\t}\n\treturn res;\n}\n\nfunction restrictByBounds<T>(\n\tproductOperations: ProductOperations<T>,\n\tset: UntypedProductSet<T>,\n\tleftBounds: UntypedProduct<T>,\n\trightBounds: UntypedProduct<T>,\n): Pair<UntypedProductSet<T>> {\n\tif (set === empty) {\n\t\treturn [empty, empty];\n\t}\n\tif (set === dense) {\n\t\treturn [subspace(leftBounds), subspace(rightBounds)];\n\t}\n\tconst cmp = compareSubspace(productOperations, set.bounds, leftBounds);\n\n\t// the set is fully contained in the left half, i.e. we know the pair.\n\tif (cmp !== undefined && cmp <= 0) {\n\t\treturn [set, empty];\n\t}\n\n\tconst newLeftBounds = unsafe.combineProduct(\n\t\tproductOperations,\n\t\tset.bounds,\n\t\tleftBounds,\n\t\tintersectUntyped,\n\t);\n\n\t// if we know, that the left set is completely empty, then the whole set is in the right bounds.\n\tif (newLeftBounds === empty) {\n\t\treturn [empty, set];\n\t}\n\n\tconst newRightBounds = unsafe.combineProduct(\n\t\tproductOperations,\n\t\tset.bounds,\n\t\trightBounds,\n\t\tintersectUntyped,\n\t);\n\tif (set.isSubspace) {\n\t\treturn [\n\t\t\tsubspace(newLeftBounds),\n\t\t\tnewRightBounds === empty ? empty : subspace(newRightBounds),\n\t\t];\n\t}\n\n\tconst [ll, lr] = restrictByBounds(productOperations, set.left, leftBounds, rightBounds);\n\tconst [rl, rr] = restrictByBounds(productOperations, set.right, leftBounds, rightBounds);\n\treturn [combineChildren(productOperations, ll, rl), combineChildren(productOperations, lr, rr)];\n}\n\nconst splitByBox = <T>(\n\tproductOperations: ProductOperations<T>,\n\tset: UntypedProductSet<T>,\n\t{ box: leftBounds }: Box<T>,\n\t{ box: rightBounds }: Box<T>,\n): Pair<UntypedProductSet<T>, UntypedProductSet<T>> => {\n\treturn restrictByBounds(productOperations, set, leftBounds, rightBounds);\n};\n\nfunction recurse<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProductSet<T>,\n\tright: UntypedProductSet<T>,\n\tcurrentBox: Box<T>,\n\tvisitFunc: (\n\t\tproductOperations: ProductOperations<T>,\n\t\tleft: UntypedProductSet<T>,\n\t\tright: UntypedProductSet<T>,\n\t\tbox: Box<T>,\n\t) => UntypedProductSet<T>,\n) {\n\tconst [leftBox, rightBox] = splitBox(productOperations, currentBox);\n\tconst [ll, lr] = splitByBox(productOperations, left, leftBox, rightBox);\n\tconst [rl, rr] = splitByBox(productOperations, right, leftBox, rightBox);\n\n\tconst lChild = visitFunc(productOperations, ll, rl, leftBox);\n\tif (lChild === dense) {\n\t\treturn dense;\n\t}\n\tconst rChild = visitFunc(productOperations, lr, rr, rightBox);\n\treturn combineChildren(productOperations, lChild, rChild);\n}\n\nfunction unionUntypedProduct<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProductSet<T>,\n\tright: UntypedProductSet<T>,\n\tcurrentBox: Box<T>,\n): UntypedProductSet<T> {\n\tif (right === empty) {\n\t\treturn left;\n\t}\n\tif (left === empty) {\n\t\treturn right;\n\t}\n\tif (left === dense) {\n\t\treturn left;\n\t}\n\tif (right === dense) {\n\t\treturn right;\n\t}\n\tif (left.isSubspace && right.isSubspace) {\n\t\tconst combinedSubspace = tryUnionSubspaces(productOperations, left, right);\n\t\tif (combinedSubspace !== undefined) {\n\t\t\treturn combinedSubspace;\n\t\t}\n\t}\n\n\treturn recurse(productOperations, left, right, currentBox, unionUntypedProduct);\n}\n\nexport function unionProduct<T extends Compatible<U, T>, U extends Compatible<T, U>>(\n\tleft: ProductSet<T>,\n\tright: ProductSet<U>,\n): ProductSet<T & U> {\n\tif (right === empty) {\n\t\treturn left;\n\t}\n\tif (right === dense) {\n\t\treturn right;\n\t}\n\tif (left === empty) {\n\t\treturn right;\n\t}\n\tif (left === dense) {\n\t\treturn left;\n\t}\n\tconst productOperations = { ...left.productOperations, ...right.productOperations };\n\tconst res = unionUntypedProduct(\n\t\tproductOperations,\n\t\tleft.root,\n\t\tright.root,\n\t\ttop(productOperations),\n\t);\n\tif (res === empty) {\n\t\treturn res;\n\t}\n\treturn sparseProduct(productOperations, res);\n}\n\nfunction intersectUntypedProduct<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProductSet<T>,\n\tright: UntypedProductSet<T>,\n\tcurrentBox: Box<T>,\n): UntypedProductSet<T> {\n\tif (left === empty || right === empty) {\n\t\treturn empty;\n\t}\n\tif (left === dense) {\n\t\treturn right;\n\t}\n\tif (right === dense) {\n\t\treturn left;\n\t}\n\tif (left.isSubspace && right.isSubspace) {\n\t\tconst res = unsafe.combineProduct(\n\t\t\tproductOperations,\n\t\t\tleft.bounds,\n\t\t\tright.bounds,\n\t\t\tintersectUntyped,\n\t\t);\n\t\tif (res === empty) {\n\t\t\treturn empty;\n\t\t}\n\t\treturn subspace(res);\n\t}\n\n\treturn recurse(productOperations, left, right, currentBox, intersectUntypedProduct);\n}\n\nexport function intersectProduct<T extends Compatible<U, T>, U extends Compatible<T, U>>(\n\tleft: ProductSet<T>,\n\tright: ProductSet<U>,\n): ProductSet<T & U> {\n\tif (left === empty) {\n\t\treturn left;\n\t}\n\tif (right === empty) {\n\t\treturn right;\n\t}\n\tif (left === dense) {\n\t\treturn right;\n\t}\n\tif (right === dense) {\n\t\treturn left;\n\t}\n\n\tconst productOperations = { ...left.productOperations, ...right.productOperations };\n\tconst res = intersectUntypedProduct(\n\t\tproductOperations,\n\t\tleft.root,\n\t\tright.root,\n\t\ttop(productOperations),\n\t);\n\tif (res === empty) {\n\t\treturn res;\n\t}\n\treturn sparseProduct(productOperations, res);\n}\n\nfunction tryExceptSubspaces<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: Subspace<T>,\n\tright: Subspace<T>,\n): Subspace<T> | Dense | Empty | undefined {\n\tconst cmp = compareSubspace(productOperations, left.bounds, right.bounds);\n\tif (cmp === 0 || cmp === -1) {\n\t\treturn empty;\n\t}\n\tlet notContainedDimension: keyof T | undefined;\n\t// because Object.keys only returns string[], we need to downcast\n\tconst po_keys = Object.keys(productOperations) as (keyof T)[];\n\tfor (const dim of po_keys) {\n\t\tif (Object.prototype.hasOwnProperty.call(productOperations, dim)) {\n\t\t\tconst cmp_inner = compareUntyped<unknown, unknown>(\n\t\t\t\tproductOperations[dim],\n\t\t\t\ttoBspSet(left.bounds[dim]),\n\t\t\t\ttoBspSet(right.bounds[dim]),\n\t\t\t);\n\t\t\tif (cmp_inner === undefined || cmp_inner > 0) {\n\t\t\t\tif (notContainedDimension !== undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tnotContainedDimension = dim;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (notContainedDimension !== undefined) {\n\t\tconst newDim = exceptUntyped<unknown, unknown>(\n\t\t\tproductOperations[notContainedDimension],\n\t\t\ttoBspSet(left.bounds[notContainedDimension]),\n\t\t\ttoBspSet(right.bounds[notContainedDimension]),\n\t\t);\n\n\t\tif (newDim === empty) {\n\t\t\treturn empty;\n\t\t}\n\t\tif (newDim === dense) {\n\t\t\t// we are actually deleting the `differentDimension`, so the variable\n\t\t\t// `deleted` must be there. Hence disabling the rule here.\n\t\t\tconst { [notContainedDimension]: deleted, ...leftBoundsWithoutDifferentDimension } =\n\t\t\t\tleft.bounds;\n\t\t\treturn subspace<unknown>(leftBoundsWithoutDifferentDimension);\n\t\t}\n\t\tconst newBounds: UntypedProduct<T> = {\n\t\t\t...left.bounds,\n\t\t\t[notContainedDimension]: newDim,\n\t\t};\n\t\treturn subspace(newBounds);\n\t}\n\n\treturn undefined;\n}\n\nfunction exceptUntypedProduct<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProductSet<T>,\n\tright: UntypedProductSet<T>,\n\tcurrentBox: Box<T>,\n): UntypedProductSet<T> {\n\tif (left === empty) {\n\t\treturn left;\n\t}\n\tif (right === dense) {\n\t\treturn empty;\n\t}\n\tif (right === empty) {\n\t\treturn left;\n\t}\n\n\tif (left === dense) {\n\t\treturn recurse(productOperations, left, right, currentBox, exceptUntypedProduct);\n\t}\n\n\tif (left.isSubspace && right.isSubspace) {\n\t\tconst combinedSubspace = tryExceptSubspaces(productOperations, left, right);\n\t\tif (combinedSubspace !== undefined) {\n\t\t\treturn combinedSubspace;\n\t\t}\n\t}\n\n\treturn recurse(productOperations, left, right, currentBox, exceptUntypedProduct);\n}\n\nexport function exceptProduct<T extends Compatible<U, T>, U extends Compatible<T, U>>(\n\tleft: ProductSet<T>,\n\tright: ProductSet<U>,\n): ProductSet<T & U> {\n\tif (left === empty) {\n\t\treturn left;\n\t}\n\tif (right === empty) {\n\t\treturn left;\n\t}\n\tif (right === dense) {\n\t\treturn empty;\n\t}\n\tif (left === dense) {\n\t\tconst res_inner = exceptUntypedProduct(\n\t\t\tright.productOperations,\n\t\t\tdense,\n\t\t\tright.root,\n\t\t\ttop(right.productOperations),\n\t\t);\n\t\tif (res_inner === empty) {\n\t\t\treturn res_inner;\n\t\t}\n\t\treturn sparseProduct(right.productOperations, res_inner);\n\t}\n\n\tconst productOperations = { ...left.productOperations, ...right.productOperations };\n\tconst res = exceptUntypedProduct(\n\t\tproductOperations,\n\t\tleft.root,\n\t\tright.root,\n\t\ttop(productOperations),\n\t);\n\tif (res === empty) {\n\t\treturn res;\n\t}\n\treturn sparseProduct(productOperations, res);\n}\n\nfunction compareUntypedProduct<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProductSet<T>,\n\tright: UntypedProductSet<T>,\n\tboundingBox: Box<T>,\n): -1 | 0 | 1 | undefined {\n\tif (left === right) {\n\t\treturn 0;\n\t}\n\n\tif (left === empty) {\n\t\treturn -1;\n\t}\n\n\tif (right === empty) {\n\t\treturn 1;\n\t}\n\n\tif (left === dense) {\n\t\tif (right === dense) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif (right === dense) {\n\t\treturn -1;\n\t}\n\n\tif (left.isSubspace) {\n\t\tif (right.isSubspace) {\n\t\t\treturn compareSubspace(productOperations, left.bounds, right.bounds);\n\t\t}\n\t}\n\n\tconst [leftBox, rightBox] = splitBox(productOperations, boundingBox);\n\tconst [ll, lr] = splitByBox(productOperations, left, leftBox, rightBox);\n\tconst [rl, rr] = splitByBox(productOperations, right, leftBox, rightBox);\n\n\tconst leftCmp = compareUntypedProduct(productOperations, ll, rl, leftBox);\n\tif (leftCmp === undefined) {\n\t\treturn undefined;\n\t}\n\treturn combineCmp(leftCmp, compareUntypedProduct(productOperations, lr, rr, rightBox));\n}\n\nexport function compareProduct<T extends Compatible<U, T>, U extends Compatible<T, U>>(\n\tleft: ProductSet<T>,\n\tright: ProductSet<U>,\n) {\n\tif (left === right) {\n\t\treturn 0;\n\t}\n\n\tif (left === empty) {\n\t\treturn -1;\n\t}\n\n\tif (right === empty) {\n\t\treturn 1;\n\t}\n\n\tif (left === dense) {\n\t\tif (right === dense) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif (right === dense) {\n\t\treturn -1;\n\t}\n\n\tconst productOperations = { ...left.productOperations, ...right.productOperations };\n\treturn compareUntypedProduct(productOperations, left.root, right.root, top(productOperations));\n}\n\nfunction meetsSubspace<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProduct<T>,\n\tright: UntypedProduct<T>,\n) {\n\tfor (const dimStr of Object.keys(productOperations)) {\n\t\tconst dim = dimStr as keyof T;\n\t\tif (Object.prototype.hasOwnProperty.call(productOperations, dim)) {\n\t\t\tconst lProj = toBspSet(left[dim]);\n\t\t\tconst rProj = toBspSet(right[dim]);\n\t\t\tconst setOperations = productOperations[dim];\n\t\t\tif (!meetsUntyped<unknown, unknown>(setOperations, lProj, rProj)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n}\n\nfunction meetsUntypedProduct<T>(\n\tproductOperations: ProductOperations<T>,\n\tleft: UntypedProductSet<T>,\n\tright: UntypedProductSet<T>,\n\tboundingBox: Box<T>,\n): boolean {\n\tif (left === empty || right === empty) {\n\t\treturn false;\n\t}\n\tif (left === dense || right === dense) {\n\t\treturn true;\n\t}\n\tif (!meetsSubspace(productOperations, left.bounds, right.bounds)) {\n\t\treturn false;\n\t}\n\tif (left.isSubspace && right.isSubspace) {\n\t\treturn true;\n\t}\n\n\tconst [leftBox, rightBox] = splitBox(productOperations, boundingBox);\n\tconst [ll, lr] = splitByBox(productOperations, left, leftBox, rightBox);\n\tconst [rl, rr] = splitByBox(productOperations, right, leftBox, rightBox);\n\n\treturn (\n\t\tmeetsUntypedProduct(productOperations, ll, rl, leftBox) ||\n\t\tmeetsUntypedProduct(productOperations, lr, rr, rightBox)\n\t);\n}\n\nexport function meetsProduct<T extends Compatible<U, T>, U extends Compatible<T, U>>(\n\tleft: ProductSet<T>,\n\tright: ProductSet<U>,\n) {\n\tif (left === empty || right === empty) {\n\t\treturn false;\n\t}\n\tif (left === dense || right === dense) {\n\t\treturn true;\n\t}\n\n\tconst productOperations = { ...left.productOperations, ...right.productOperations };\n\treturn meetsUntypedProduct(productOperations, left.root, right.root, top(productOperations));\n}\n\nexport const complementProduct = <T>(set: ProductSet<T>) => exceptProduct(dense, set);\n\nexport const symmetricDiffProduct = <T>(left: ProductSet<T>, right: ProductSet<T>) =>\n\tunionProduct(exceptProduct(left, right), exceptProduct(right, left));\n\nexport function getSubspaces<T>(set: ProductSet<T>) {\n\tif (set === empty || set === dense) {\n\t\treturn [];\n\t}\n\tconst res: UntypedProduct<T>[] = [];\n\tfunction loop(root: UntypedSparseProduct<T>) {\n\t\tif (root.isSubspace) {\n\t\t\tres.push(root.bounds);\n\t\t\treturn;\n\t\t}\n\n\t\tloop(root.left);\n\t\tloop(root.right);\n\t}\n\n\tloop(set.root);\n\treturn res;\n}\n\nexport function forEachProduct<T, Props extends (keyof T)[]>(\n\tset: ProductSet<T>,\n\tf: (product: Product<Restrict<T, Props>>) => boolean,\n\t...dims: Props\n): boolean {\n\tconst newSet = project(set, ...dims);\n\tif (newSet === empty) {\n\t\treturn true;\n\t}\n\tif (newSet === dense) {\n\t\treturn f(unsafe.denseProduct(dims));\n\t}\n\n\tconst { productOperations, root } = newSet;\n\n\tfunction loop(root_inner: UntypedSparseProduct<T>): boolean {\n\t\tif (root_inner.isSubspace) {\n\t\t\treturn f(unsafe.fromUntypedProduct(productOperations, root_inner.bounds, dims));\n\t\t}\n\t\treturn loop(root_inner.left) && loop(root_inner.right);\n\t}\n\n\treturn loop(root);\n}\n\nexport function getSubspaceCount<T>(set: ProductSet<T>) {\n\tif (set === empty || set === dense) {\n\t\treturn 0;\n\t}\n\treturn getUntypedSubspaceCount(set.root);\n}\n"]}
package/dist/split.d.ts DELETED
@@ -1,41 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { SetOperations, Pair } from "./bspSet";
6
- /** Represents a half-open interval [a, b) */
7
- export declare type Ivl<Index extends number = number> = Pair<Index>;
8
- export declare function ivlJoin<Index extends number>(ivl1: Ivl<Index>, ivl2: Ivl<Index>): Ivl<Index>;
9
- export declare function ivlMeets(ivl1: Ivl, ivl2: Ivl): boolean;
10
- export declare function ivlMeetsOrTouches(ivl1: Ivl, ivl2: Ivl): boolean;
11
- /** computes the set difference on intervals. Precondition: they meet */
12
- export declare function ivlExcept<Index extends number>(ivl1: Ivl<Index>, ivl2: Ivl<Index>): Ivl<Index> | undefined;
13
- export declare function ivlCompare<Index extends number>(ivl1: Ivl<Index>, ivl2: Ivl<Index>): -1 | 0 | 1 | undefined;
14
- export interface Distribution {
15
- /** The cummulative distribution function. This is used to compute the probabilty mass of a given interval. */
16
- readonly cdf: (x: number) => number;
17
- /** The inverse cummulative distribution function. This is used to estimate a point given a quantile. */
18
- readonly invCdf: (x: number) => number;
19
- }
20
- /** This is a bounded pareto distribution with a shape parameter `alpha`, a lower bound `L` and an upper bound `H`.
21
- * It has good properties for being used as a space splitting function in sofar, as it causes the indices to grow
22
- * exponentially. This behavior guarantees `O(log k)` as worst-case execution time when it's used as a space-splitting
23
- * function.
24
- *
25
- * On the other hand, we now can use it to approximate the access to grids better than just binary search, a
26
- * similar argument as for using exponential search. But we can use it to give exact probability masses for arbitrary
27
- * intervals. This allows us to search in both dimensions of a grid and use the probability mass to decide what axis
28
- * to cut next.
29
- */
30
- export declare function boundedPareto(alpha: number, L: number, H: number): Distribution;
31
- /** Creates a dimension splitter that operates on integer interval values and is based on a bounded Pareto
32
- * distribution. */
33
- export declare function boundedParetoSplitter<Index extends number>(alpha: number, L: number, H: number): DimensionSplitter<Pair<Index>>;
34
- export declare function boundedParetoSetOperations<Index extends number, Id>(alpha: number, L: number, H: number, top: Pair<Index>, id: Id): SetOperations<Pair<Index>, Id>;
35
- export interface DimensionSplitter<Key> {
36
- /** For a given key, returns if the key can be further sub-divided. */
37
- canSplit(key: Key): boolean;
38
- /** Splits a key and returns the probability mass for either half. */
39
- split(key: Key): Pair<Pair<Key, number>>;
40
- }
41
- //# sourceMappingURL=split.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../src/split.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE/C,6CAA6C;AAC7C,oBAAY,GAAG,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AAQ7D,wBAAgB,OAAO,CAAC,KAAK,SAAS,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAI5F;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAItD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAI/D;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,EAC7C,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,EAChB,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,GACd,GAAG,CAAC,KAAK,CAAC,GAAG,SAAS,CAUxB;AAQD,wBAAgB,UAAU,CAAC,KAAK,SAAS,MAAM,EAC9C,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,EAChB,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,GACd,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAaxB;AAED,MAAM,WAAW,YAAY;IAC5B,8GAA8G;IAC9G,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEpC,wGAAwG;IACxG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,YAAY,CAkB/E;AAED;mBACmB;AACnB,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,EACzD,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACP,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAwBhC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,SAAS,MAAM,EAAE,EAAE,EAClE,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAChB,EAAE,EAAE,EAAE,GACJ,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAahC;AAED,MAAM,WAAW,iBAAiB,CAAC,GAAG;IACrC,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC;IAC5B,qEAAqE;IACrE,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;CACzC"}
package/dist/split.js DELETED
@@ -1,127 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.boundedParetoSetOperations = exports.boundedParetoSplitter = exports.boundedPareto = exports.ivlCompare = exports.ivlExcept = exports.ivlMeetsOrTouches = exports.ivlMeets = exports.ivlJoin = void 0;
8
- /** A much faster version of `Math.max` specialized to two numeric arguments. */
9
- const fastMax = (x1, x2) => (x1 < x2 ? x2 : x1);
10
- /** A much faster version of `Math.min` specialized to two numeric arguments. */
11
- const fastMin = (x1, x2) => (x1 < x2 ? x1 : x2);
12
- function ivlJoin(ivl1, ivl2) {
13
- const [x1a, x1b] = ivl1;
14
- const [x2a, x2b] = ivl2;
15
- return [fastMin(x1a, x2a), fastMax(x1b, x2b)];
16
- }
17
- exports.ivlJoin = ivlJoin;
18
- function ivlMeets(ivl1, ivl2) {
19
- const [x1a, x1b] = ivl1;
20
- const [x2a, x2b] = ivl2;
21
- return fastMax(x1a, x2a) < fastMin(x1b, x2b);
22
- }
23
- exports.ivlMeets = ivlMeets;
24
- function ivlMeetsOrTouches(ivl1, ivl2) {
25
- const [x1a, x1b] = ivl1;
26
- const [x2a, x2b] = ivl2;
27
- return fastMax(x1a, x2a) <= fastMin(x1b, x2b);
28
- }
29
- exports.ivlMeetsOrTouches = ivlMeetsOrTouches;
30
- /** computes the set difference on intervals. Precondition: they meet */
31
- function ivlExcept(ivl1, ivl2) {
32
- const [x1a, x1b] = ivl1;
33
- const [x2a, x2b] = ivl2;
34
- if (x1a < x2a && x2b >= x1b) {
35
- return [x1a, x2a];
36
- }
37
- if (x1a >= x2a && x2b < x1b) {
38
- return [x2b, x1b];
39
- }
40
- return undefined;
41
- }
42
- exports.ivlExcept = ivlExcept;
43
- function ivlMeet(ivl1, ivl2) {
44
- const [x1a, x1b] = ivl1;
45
- const [x2a, x2b] = ivl2;
46
- return [fastMax(x1a, x2a), fastMin(x1b, x2b)];
47
- }
48
- function ivlCompare(ivl1, ivl2) {
49
- const [x1a, x1b] = ivl1;
50
- const [x2a, x2b] = ivl2;
51
- if (x1a === x2a && x1b === x2b) {
52
- return 0;
53
- }
54
- if (x1a >= x2a && x1b <= x2b) {
55
- return -1;
56
- }
57
- if (x1a <= x2a && x1b >= x2b) {
58
- return 1;
59
- }
60
- return undefined;
61
- }
62
- exports.ivlCompare = ivlCompare;
63
- /** This is a bounded pareto distribution with a shape parameter `alpha`, a lower bound `L` and an upper bound `H`.
64
- * It has good properties for being used as a space splitting function in sofar, as it causes the indices to grow
65
- * exponentially. This behavior guarantees `O(log k)` as worst-case execution time when it's used as a space-splitting
66
- * function.
67
- *
68
- * On the other hand, we now can use it to approximate the access to grids better than just binary search, a
69
- * similar argument as for using exponential search. But we can use it to give exact probability masses for arbitrary
70
- * intervals. This allows us to search in both dimensions of a grid and use the probability mass to decide what axis
71
- * to cut next.
72
- */
73
- function boundedPareto(alpha, L, H) {
74
- const lAlpha = L ** alpha;
75
- const cdfDenom = 1 - (L / H) ** alpha;
76
- const hAlpha = H ** alpha;
77
- const hlAlpha = hAlpha * lAlpha;
78
- const hAlphaSubLAlpha = hAlpha - lAlpha;
79
- const negAlphaInv = -1 / alpha;
80
- const cdf = alpha === 1
81
- ? (x) => (1 - lAlpha / x) / cdfDenom
82
- : (x) => (1 - lAlpha * x ** -alpha) / cdfDenom;
83
- const invCdf = alpha === 1
84
- ? (y) => 1 / ((hAlpha - y * hAlphaSubLAlpha) / hlAlpha)
85
- : (y) => ((hAlpha - y * hAlphaSubLAlpha) / hlAlpha) ** negAlphaInv;
86
- return { cdf, invCdf };
87
- }
88
- exports.boundedPareto = boundedPareto;
89
- /** Creates a dimension splitter that operates on integer interval values and is based on a bounded Pareto
90
- * distribution. */
91
- function boundedParetoSplitter(alpha, L, H) {
92
- const distribution = boundedPareto(alpha, L, H);
93
- return {
94
- canSplit: ([keyLb, keyUb]) => keyUb - keyLb > 1,
95
- split([keyLb, keyUb]) {
96
- const ubCdf = distribution.cdf(keyUb);
97
- const lbCdf = distribution.cdf(keyLb + 1);
98
- const cuttingPoint = distribution.invCdf((ubCdf + lbCdf) / 2);
99
- // pick a cutting point, but making sure either side has at least one element in it.
100
- const discreteCuttingPoint = Math.min(Math.max(Math.round(cuttingPoint), keyLb + 1), keyUb - 1);
101
- const leftProb = distribution.cdf(discreteCuttingPoint) - distribution.cdf(keyLb + 1);
102
- const rightProb = distribution.cdf(keyUb) - distribution.cdf(discreteCuttingPoint);
103
- const result = [
104
- [[keyLb, discreteCuttingPoint], leftProb],
105
- [[discreteCuttingPoint, keyUb], rightProb],
106
- ];
107
- return result;
108
- },
109
- };
110
- }
111
- exports.boundedParetoSplitter = boundedParetoSplitter;
112
- function boundedParetoSetOperations(alpha, L, H, top, id) {
113
- const splitter = boundedParetoSplitter(alpha, L, H);
114
- return {
115
- id,
116
- split: (key) => splitter.split(key),
117
- canSplit: (key) => splitter.canSplit(key),
118
- meets: ivlMeets,
119
- intersect: ivlMeet,
120
- union: (x, y) => (ivlMeetsOrTouches(x, y) ? ivlJoin(x, y) : undefined),
121
- except: ivlExcept,
122
- compare: ivlCompare,
123
- top,
124
- };
125
- }
126
- exports.boundedParetoSetOperations = boundedParetoSetOperations;
127
- //# sourceMappingURL=split.js.map
package/dist/split.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"split.js","sourceRoot":"","sources":["../src/split.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,gFAAgF;AAChF,MAAM,OAAO,GAAG,CAAuB,EAAS,EAAE,EAAS,EAAS,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE3F,gFAAgF;AAChF,MAAM,OAAO,GAAG,CAAuB,EAAS,EAAE,EAAS,EAAS,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE3F,SAAgB,OAAO,CAAuB,IAAgB,EAAE,IAAgB;IAC/E,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACxB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,G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n * Licensed under the MIT License.\n */\n\nimport { SetOperations, Pair } from \"./bspSet\";\n\n/** Represents a half-open interval [a, b) */\nexport type Ivl<Index extends number = number> = Pair<Index>;\n\n/** A much faster version of `Math.max` specialized to two numeric arguments. */\nconst fastMax = <Index extends number>(x1: Index, x2: Index): Index => (x1 < x2 ? x2 : x1);\n\n/** A much faster version of `Math.min` specialized to two numeric arguments. */\nconst fastMin = <Index extends number>(x1: Index, x2: Index): Index => (x1 < x2 ? x1 : x2);\n\nexport function ivlJoin<Index extends number>(ivl1: Ivl<Index>, ivl2: Ivl<Index>): Ivl<Index> {\n\tconst [x1a, x1b] = ivl1;\n\tconst [x2a, x2b] = ivl2;\n\treturn [fastMin(x1a, x2a), fastMax(x1b, x2b)];\n}\n\nexport function ivlMeets(ivl1: Ivl, ivl2: Ivl): boolean {\n\tconst [x1a, x1b] = ivl1;\n\tconst [x2a, x2b] = ivl2;\n\treturn fastMax(x1a, x2a) < fastMin(x1b, x2b);\n}\n\nexport function ivlMeetsOrTouches(ivl1: Ivl, ivl2: Ivl): boolean {\n\tconst [x1a, x1b] = ivl1;\n\tconst [x2a, x2b] = ivl2;\n\treturn fastMax(x1a, x2a) <= fastMin(x1b, x2b);\n}\n\n/** computes the set difference on intervals. Precondition: they meet */\nexport function ivlExcept<Index extends number>(\n\tivl1: Ivl<Index>,\n\tivl2: Ivl<Index>,\n): Ivl<Index> | undefined {\n\tconst [x1a, x1b] = ivl1;\n\tconst [x2a, x2b] = ivl2;\n\tif (x1a < x2a && x2b >= x1b) {\n\t\treturn [x1a, x2a];\n\t}\n\tif (x1a >= x2a && x2b < x1b) {\n\t\treturn [x2b, x1b];\n\t}\n\treturn undefined;\n}\n\nfunction ivlMeet<Index extends number>(ivl1: Ivl<Index>, ivl2: Ivl<Index>): Ivl<Index> {\n\tconst [x1a, x1b] = ivl1;\n\tconst [x2a, x2b] = ivl2;\n\treturn [fastMax(x1a, x2a), fastMin(x1b, x2b)];\n}\n\nexport function ivlCompare<Index extends number>(\n\tivl1: Ivl<Index>,\n\tivl2: Ivl<Index>,\n): -1 | 0 | 1 | undefined {\n\tconst [x1a, x1b] = ivl1;\n\tconst [x2a, x2b] = ivl2;\n\tif (x1a === x2a && x1b === x2b) {\n\t\treturn 0;\n\t}\n\tif (x1a >= x2a && x1b <= x2b) {\n\t\treturn -1;\n\t}\n\tif (x1a <= x2a && x1b >= x2b) {\n\t\treturn 1;\n\t}\n\treturn undefined;\n}\n\nexport interface Distribution {\n\t/** The cummulative distribution function. This is used to compute the probabilty mass of a given interval. */\n\treadonly cdf: (x: number) => number;\n\n\t/** The inverse cummulative distribution function. This is used to estimate a point given a quantile. */\n\treadonly invCdf: (x: number) => number;\n}\n\n/** This is a bounded pareto distribution with a shape parameter `alpha`, a lower bound `L` and an upper bound `H`.\n * It has good properties for being used as a space splitting function in sofar, as it causes the indices to grow\n * exponentially. This behavior guarantees `O(log k)` as worst-case execution time when it's used as a space-splitting\n * function.\n *\n * On the other hand, we now can use it to approximate the access to grids better than just binary search, a\n * similar argument as for using exponential search. But we can use it to give exact probability masses for arbitrary\n * intervals. This allows us to search in both dimensions of a grid and use the probability mass to decide what axis\n * to cut next.\n */\nexport function boundedPareto(alpha: number, L: number, H: number): Distribution {\n\tconst lAlpha = L ** alpha;\n\tconst cdfDenom = 1 - (L / H) ** alpha;\n\tconst hAlpha = H ** alpha;\n\tconst hlAlpha = hAlpha * lAlpha;\n\tconst hAlphaSubLAlpha = hAlpha - lAlpha;\n\tconst negAlphaInv = -1 / alpha;\n\n\tconst cdf =\n\t\talpha === 1\n\t\t\t? (x: number) => (1 - lAlpha / x) / cdfDenom\n\t\t\t: (x: number) => (1 - lAlpha * x ** -alpha) / cdfDenom;\n\tconst invCdf =\n\t\talpha === 1\n\t\t\t? (y: number) => 1 / ((hAlpha - y * hAlphaSubLAlpha) / hlAlpha)\n\t\t\t: (y: number) => ((hAlpha - y * hAlphaSubLAlpha) / hlAlpha) ** negAlphaInv;\n\n\treturn { cdf, invCdf };\n}\n\n/** Creates a dimension splitter that operates on integer interval values and is based on a bounded Pareto\n * distribution. */\nexport function boundedParetoSplitter<Index extends number>(\n\talpha: number,\n\tL: number,\n\tH: number,\n): DimensionSplitter<Pair<Index>> {\n\tconst distribution = boundedPareto(alpha, L, H);\n\treturn {\n\t\tcanSplit: ([keyLb, keyUb]) => keyUb - keyLb > 1,\n\t\tsplit([keyLb, keyUb]: Pair<Index>) {\n\t\t\tconst ubCdf = distribution.cdf(keyUb);\n\t\t\tconst lbCdf = distribution.cdf(keyLb + 1);\n\t\t\tconst cuttingPoint = distribution.invCdf((ubCdf + lbCdf) / 2);\n\t\t\t// pick a cutting point, but making sure either side has at least one element in it.\n\t\t\tconst discreteCuttingPoint = Math.min(\n\t\t\t\tMath.max(Math.round(cuttingPoint), keyLb + 1),\n\t\t\t\tkeyUb - 1,\n\t\t\t) as Index;\n\n\t\t\tconst leftProb = distribution.cdf(discreteCuttingPoint) - distribution.cdf(keyLb + 1);\n\t\t\tconst rightProb = distribution.cdf(keyUb) - distribution.cdf(discreteCuttingPoint);\n\n\t\t\tconst result: Pair<Pair<Pair<Index>, number>> = [\n\t\t\t\t[[keyLb, discreteCuttingPoint], leftProb],\n\t\t\t\t[[discreteCuttingPoint, keyUb], rightProb],\n\t\t\t];\n\t\t\treturn result;\n\t\t},\n\t};\n}\n\nexport function boundedParetoSetOperations<Index extends number, Id>(\n\talpha: number,\n\tL: number,\n\tH: number,\n\ttop: Pair<Index>,\n\tid: Id,\n): SetOperations<Pair<Index>, Id> {\n\tconst splitter = boundedParetoSplitter<Index>(alpha, L, H);\n\treturn {\n\t\tid,\n\t\tsplit: (key) => splitter.split(key),\n\t\tcanSplit: (key) => splitter.canSplit(key),\n\t\tmeets: ivlMeets,\n\t\tintersect: ivlMeet,\n\t\tunion: (x, y) => (ivlMeetsOrTouches(x, y) ? ivlJoin(x, y) : undefined),\n\t\texcept: ivlExcept,\n\t\tcompare: ivlCompare,\n\t\ttop,\n\t};\n}\n\nexport interface DimensionSplitter<Key> {\n\t/** For a given key, returns if the key can be further sub-divided. */\n\tcanSplit(key: Key): boolean;\n\t/** Splits a key and returns the probability mass for either half. */\n\tsplit(key: Key): Pair<Pair<Key, number>>;\n}\n"]}
package/lib/bspSet.d.ts DELETED
@@ -1,125 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /** An interface for representing a readonly pair */
6
- export declare type Pair<S, T = S> = readonly [S, T];
7
- export declare const pair: <S, T = S>(left: S, right: T) => Pair<S, T>;
8
- export declare enum SetKind {
9
- Dense = 0,
10
- Empty = 1
11
- }
12
- interface TreeNode<Left, Right> {
13
- readonly left: Left;
14
- readonly right: Right;
15
- }
16
- interface KeyNode<Key, Exact> {
17
- readonly key: Key;
18
- readonly pathKey: Key;
19
- readonly isExact: Exact;
20
- }
21
- export declare type Empty = SetKind.Empty;
22
- /** The term *Dense* means that a given subset contains all the elements of its particular
23
- * bounds. E.g. the whole set would be dense w.r.t. the bounds of the whole space. Or
24
- * if a set represents an interval [a, b), then it would be dense, if there are no holes in it,
25
- * i.e. the set is represented exactly using the current bounds.
26
- */
27
- export declare type Dense = SetKind.Dense;
28
- export declare const dense = SetKind.Dense;
29
- export declare const empty = SetKind.Empty;
30
- declare type KeyUnexact<Key> = KeyNode<Key, false>;
31
- /** In the BSP-set, each node carries with it implicit bounds just by the position in the tree.
32
- * Furthermore, it can carry around a key. The key can either be an approximation, i.e. an upper bound
33
- * or it can be *exact*. Exact means, that the whole set can be exactly represented in terms of just the key.
34
- *
35
- * One might wonder, why we don't prune the tree at this point. This has to do with the fact that we are
36
- * representing arbitrary sets and so even though one of two sets could be represented exactly the other
37
- * might not be able to yet. In this case we need to unfold the key by splitting further. In order to avoid
38
- * excessive splitting and pruning, we just carry around the key but allow the tree to also be materialized, on-demand.
39
- */
40
- declare type KeyExact<Key> = KeyNode<Key, true>;
41
- declare type KeyUndefined = KeyNode<undefined, false>;
42
- declare type KeyDefined<Key> = KeyUnexact<Key> | KeyExact<Key>;
43
- declare type BalancePropertyHelper<Key, Left, Right> = TreeNode<UntypedSparse<Key> | Left, UntypedSparse<Key> | Right>;
44
- declare type TreeDefined<Key> = BalancePropertyHelper<Key, Empty, Dense> | BalancePropertyHelper<Key, Dense, Empty>;
45
- declare type TreeUndefined = TreeNode<undefined, undefined>;
46
- declare type KeyDefinednessProperty<Key> = KeyDefined<Key> | KeyUndefined;
47
- export declare type UntypedSparse<Key> = (KeyDefinednessProperty<Key> & TreeDefined<Key>) | (KeyDefined<Key> & TreeUndefined);
48
- /** The term *untyped* refers to the tree representation of a BSP set. Because BSP set trees are only compared in terms
49
- * of their structure, we need to ensure that cuts occur at the same exact points across all possible sets. This is
50
- * enforced by the fact, that at construction time, we attach an `Id` to each BSP set and only allow operations to
51
- * occur on sets with the same `Id`.
52
- *
53
- * The BSP set becomes *untyped*, when we drop that `Id`; now it is possible to operate on sets that are incompatible.
54
- * Doing this, however, allows us to store the set operations only once per set as opposed to carrying them around with
55
- * every node.
56
- */
57
- export declare type UntypedBspSet<Key> = Empty | Dense | UntypedSparse<Key>;
58
- /** A set is considred *sparse*, if we know that w.r.t. to it's bounds it is neither empty, nor dense. */
59
- interface Sparse<Key extends Cachable<Key>, Id> {
60
- setOperations: SetOperations<Key, Id>;
61
- root: UntypedSparse<Key>;
62
- }
63
- export declare type BspSet<Key extends Cachable<Key>, Id> = Empty | Dense | Sparse<Key, Id>;
64
- export interface KeyCache<T> {
65
- depth?: number;
66
- split?: Pair<Pair<CachedKey<T>, number>>;
67
- }
68
- export declare type CachedKey<T> = T & KeyCache<T>;
69
- export declare type Cachable<T> = Disjoint<keyof T, keyof KeyCache<T>>;
70
- export declare type Disjoint<T, U> = [T, U] extends [Exclude<T, U>, Exclude<U, T>] ? any : never;
71
- export declare type RequireAtLeastOne<T> = {
72
- [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
73
- }[keyof T];
74
- /** This is a concrete set operations implementation, tagged with an arbitrary id. */
75
- export interface SetOperations<Key extends Cachable<Key>, Id> {
76
- /** Id here is just a phantom type, so that we can associate the various set instances together */
77
- readonly id: Id;
78
- /** Split the key into two. This will only be called when the current key is incomparable with an element.
79
- * E.g. this would never be called if the key is already a 1x1 rectangle. */
80
- readonly split: (key: CachedKey<Key>) => Pair<Pair<CachedKey<Key>, number>>;
81
- /** Tells, if a given key can be split further */
82
- readonly canSplit: (key: CachedKey<Key>) => boolean;
83
- /** Tells if two keys overlap at all. */
84
- readonly meets: (key1: Key, key2: Key) => boolean;
85
- /** Intersect the keys, if it is possible to exactly respresent their intersection.
86
- * An implementation is never required to compute the intersection as this is just an optimization.
87
- * Precondition: It is guaranteed that the keys meet and that they are incomparable.
88
- */
89
- readonly intersect: (key1: Key, key2: Key) => Key | undefined;
90
- /** Unions the keys, if it is possible to exactly represent their union.
91
- * An implementation is never required to compute the union as this is just an optimization.
92
- * Precondition: It is guaranteed that the keys are incomparable.
93
- */
94
- readonly union: (key1: Key, key2: Key) => Key | undefined;
95
- /** Computes the set difference between two keys, if it is possible to exactly represent their set difference.
96
- * An implementation is never required to compute the difference as this is just an optimization.
97
- * Precondition: It is guaranteed that the keys meet.
98
- */
99
- readonly except: (key1: Key, key2: Key) => Key | undefined;
100
- /** Compare two keys */
101
- readonly compare: (key1: Key, key2: Key) => -1 | 0 | 1 | undefined;
102
- /** The top element of the set. */
103
- readonly top: Key;
104
- }
105
- export declare const cacheKeySplitting: <Key>(splitFunction: (key: CachedKey<Key>) => Pair<Pair<CachedKey<Key>, number>, Pair<CachedKey<Key>, number>>, top: CachedKey<Key>, maxDepth?: number) => (key: CachedKey<Key>) => Pair<Pair<CachedKey<Key>, number>, Pair<CachedKey<Key>, number>>;
106
- export declare function fromUntyped<Key extends Cachable<Key>, Id>(setOperations: SetOperations<Key, Id>, root: UntypedBspSet<Key>): BspSet<Key, Id>;
107
- export declare function lazy<Key extends Cachable<Key>, Id>(setOperations: SetOperations<Key, Id>, pathKey: Key, key: Key): UntypedBspSet<Key>;
108
- export declare function createFromKey<Key extends Cachable<Key>, Id>(uncachedSetOperations: SetOperations<Key, Id>): (key: Key) => BspSet<Key, Id>;
109
- export declare function unionUntyped<Key extends Cachable<Key>, Id>(setOperations: SetOperations<Key, Id>, left: UntypedBspSet<Key>, right: UntypedBspSet<Key>): UntypedBspSet<Key>;
110
- export declare function union<Key extends Cachable<Key>, Id>(left: BspSet<Key, Id>, right: BspSet<Key, Id>): BspSet<Key, Id>;
111
- export declare function intersectUntyped<Key extends Cachable<Key>, Id>(setOperations: SetOperations<Key, Id>, left: UntypedBspSet<Key>, right: UntypedBspSet<Key>): UntypedBspSet<Key>;
112
- export declare function intersect<Key extends Cachable<Key>, Id>(left: BspSet<Key, Id>, right: BspSet<Key, Id>): BspSet<Key, Id>;
113
- export declare function meetsUntyped<Key extends Cachable<Key>, Id>(setOperations: SetOperations<Key, Id>, left: UntypedBspSet<Key>, right: UntypedBspSet<Key>): boolean;
114
- export declare function meets<Key extends Cachable<Key>, Id>(left: BspSet<Key, Id>, right: BspSet<Key, Id>): boolean;
115
- export declare function exceptUntyped<Key extends Cachable<Key>, Id>(setOperations: SetOperations<Key, Id>, left: UntypedBspSet<Key>, right: UntypedBspSet<Key>): UntypedBspSet<Key>;
116
- export declare function except<Key extends Cachable<Key>, Id>(left: BspSet<Key, Id>, right: BspSet<Key, Id>): BspSet<Key, Id>;
117
- export declare function combineCmp(left: -1 | 0 | 1 | undefined, right: -1 | 0 | 1 | undefined): 0 | 1 | -1 | undefined;
118
- export declare function compareUntyped<Key extends Cachable<Key>, Id>(setOperations: SetOperations<Key, Id>, left: UntypedBspSet<Key>, right: UntypedBspSet<Key>): -1 | 0 | 1 | undefined;
119
- export declare function compare<Key extends Cachable<Key>, Id>(left: BspSet<Key, Id>, right: BspSet<Key, Id>): 0 | 1 | -1 | undefined;
120
- export declare const symmetricDiff: <Key extends Disjoint<keyof Key, keyof KeyCache<T>>, Id>(left: BspSet<Key, Id>, right: BspSet<Key, Id>) => BspSet<Key, Id>;
121
- export declare const complement: <Key extends Disjoint<keyof Key, keyof KeyCache<T>>, Id>(set: BspSet<Key, Id>) => BspSet<Key, Id>;
122
- export declare function getNodeCount<Key extends Cachable<Key>, Id>(set: BspSet<Key, Id>): number;
123
- export declare function forEachKey<Key extends Cachable<Key>, Id>(set: Empty | Sparse<Key, Id>, f: (key: Key) => boolean): boolean;
124
- export {};
125
- //# sourceMappingURL=bspSet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bspSet.d.ts","sourceRoot":"","sources":["../src/bspSet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,oDAAoD;AACpD,oBAAY,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7C,eAAO,MAAM,IAAI,6CAA6D,CAAC;AAK/E,oBAAY,OAAO;IAClB,KAAK,IAAA;IACL,KAAK,IAAA;CACL;AAED,UAAU,QAAQ,CAAC,IAAI,EAAE,KAAK;IAC7B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACtB;AAED,UAAU,OAAO,CAAC,GAAG,EAAE,KAAK;IAC3B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;CACxB;AAED,oBAAY,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AAElC;;;;GAIG;AACH,oBAAY,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AAElC,eAAO,MAAM,KAAK,gBAAgB,CAAC;AACnC,eAAO,MAAM,KAAK,gBAAgB,CAAC;AAEnC,aAAK,UAAU,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAE3C;;;;;;;;GAQG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