@hviana/sema 0.1.5 → 0.1.6
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.
- package/AGENTS.md +6 -5
- package/CITATION.cff +49 -0
- package/HOW_IT_WORKS.md +11 -12
- package/README.md +7 -5
- package/dist/example/demo.js +25 -25
- package/dist/example/train_base.d.ts +19 -21
- package/dist/example/train_base.js +1687 -1952
- package/dist/src/alphabet.d.ts +3 -3
- package/dist/src/alphabet.js +24 -27
- package/dist/src/alu/src/alu.d.ts +169 -194
- package/dist/src/alu/src/alu.js +374 -414
- package/dist/src/alu/src/expr.d.ts +36 -43
- package/dist/src/alu/src/expr.js +252 -278
- package/dist/src/alu/src/index.d.ts +9 -98
- package/dist/src/alu/src/index.js +10 -64
- package/dist/src/alu/src/kernel-arith.d.ts +1 -5
- package/dist/src/alu/src/kernel-arith.js +195 -285
- package/dist/src/alu/src/kernel-bits.d.ts +1 -5
- package/dist/src/alu/src/kernel-bits.js +81 -115
- package/dist/src/alu/src/kernel-logic.js +33 -63
- package/dist/src/alu/src/kernel-nd.js +155 -195
- package/dist/src/alu/src/kernel-numeric.d.ts +16 -80
- package/dist/src/alu/src/kernel-numeric.js +259 -331
- package/dist/src/alu/src/operation.d.ts +112 -132
- package/dist/src/alu/src/operation.js +149 -163
- package/dist/src/alu/src/parser.d.ts +168 -175
- package/dist/src/alu/src/parser.js +382 -421
- package/dist/src/alu/src/resonance.d.ts +16 -25
- package/dist/src/alu/src/resonance.js +49 -56
- package/dist/src/alu/src/text.d.ts +3 -7
- package/dist/src/alu/src/text.js +31 -37
- package/dist/src/alu/src/value.d.ts +14 -14
- package/dist/src/alu/src/value.js +150 -160
- package/dist/src/alu/test/alu.test.js +543 -656
- package/dist/src/bytes.d.ts +1 -5
- package/dist/src/bytes.js +33 -40
- package/dist/src/config.d.ts +99 -102
- package/dist/src/config.js +78 -83
- package/dist/src/derive/src/deduction.d.ts +60 -62
- package/dist/src/derive/src/deduction.js +103 -109
- package/dist/src/derive/src/index.d.ts +1 -7
- package/dist/src/derive/src/priority-queue.d.ts +8 -8
- package/dist/src/derive/src/priority-queue.js +57 -61
- package/dist/src/derive/src/rewrite.d.ts +15 -18
- package/dist/src/derive/src/rewrite.js +59 -67
- package/dist/src/derive/src/trie.d.ts +56 -56
- package/dist/src/derive/src/trie.js +175 -179
- package/dist/src/derive/test/derive.test.js +96 -100
- package/dist/src/extension.d.ts +13 -16
- package/dist/src/geometry.d.ts +17 -42
- package/dist/src/geometry.js +235 -266
- package/dist/src/index.d.ts +2 -17
- package/dist/src/index.js +2 -12
- package/dist/src/ingest-cache.d.ts +25 -30
- package/dist/src/ingest-cache.js +108 -127
- package/dist/src/mind/articulation.d.ts +1 -5
- package/dist/src/mind/articulation.js +77 -112
- package/dist/src/mind/attention.d.ts +40 -108
- package/dist/src/mind/attention.js +749 -871
- package/dist/src/mind/canonical.d.ts +4 -19
- package/dist/src/mind/canonical.js +27 -31
- package/dist/src/mind/graph-search.d.ts +201 -225
- package/dist/src/mind/graph-search.js +742 -821
- package/dist/src/mind/index.d.ts +2 -10
- package/dist/src/mind/junction.d.ts +31 -58
- package/dist/src/mind/junction.js +172 -237
- package/dist/src/mind/learning.d.ts +16 -52
- package/dist/src/mind/learning.js +143 -165
- package/dist/src/mind/match.d.ts +20 -69
- package/dist/src/mind/match.js +259 -318
- package/dist/src/mind/mechanisms/alu.js +16 -16
- package/dist/src/mind/mechanisms/cast.d.ts +9 -13
- package/dist/src/mind/mechanisms/cast.js +363 -456
- package/dist/src/mind/mechanisms/confluence.d.ts +8 -12
- package/dist/src/mind/mechanisms/confluence.js +152 -183
- package/dist/src/mind/mechanisms/cover.d.ts +2 -8
- package/dist/src/mind/mechanisms/cover.js +148 -210
- package/dist/src/mind/mechanisms/extraction.d.ts +8 -34
- package/dist/src/mind/mechanisms/extraction.js +234 -288
- package/dist/src/mind/mechanisms/recall.d.ts +6 -10
- package/dist/src/mind/mechanisms/recall.js +126 -185
- package/dist/src/mind/mind.d.ts +129 -154
- package/dist/src/mind/mind.js +258 -288
- package/dist/src/mind/pipeline-mechanism.d.ts +112 -124
- package/dist/src/mind/pipeline-mechanism.js +161 -172
- package/dist/src/mind/pipeline.d.ts +4 -14
- package/dist/src/mind/pipeline.js +125 -189
- package/dist/src/mind/primitives.d.ts +8 -32
- package/dist/src/mind/primitives.js +99 -117
- package/dist/src/mind/rationale.d.ts +86 -98
- package/dist/src/mind/rationale.js +113 -121
- package/dist/src/mind/reasoning.d.ts +2 -13
- package/dist/src/mind/reasoning.js +129 -166
- package/dist/src/mind/recognition.d.ts +1 -4
- package/dist/src/mind/recognition.js +183 -208
- package/dist/src/mind/resonance.d.ts +5 -22
- package/dist/src/mind/resonance.js +0 -0
- package/dist/src/mind/trace.d.ts +6 -25
- package/dist/src/mind/trace.js +50 -58
- package/dist/src/mind/traverse.d.ts +16 -58
- package/dist/src/mind/traverse.js +304 -357
- package/dist/src/mind/types.d.ts +120 -127
- package/dist/src/mind/types.js +60 -69
- package/dist/src/rabitq-ivf/src/database.d.ts +113 -0
- package/dist/src/rabitq-ivf/src/database.js +201 -0
- package/dist/src/rabitq-ivf/src/index.d.ts +7 -0
- package/dist/src/{rabitq-hnsw → rabitq-ivf}/src/index.js +1 -3
- package/dist/src/rabitq-ivf/src/ivf.d.ts +200 -0
- package/dist/src/rabitq-ivf/src/ivf.js +1165 -0
- package/dist/src/rabitq-ivf/src/prng.d.ts +19 -0
- package/dist/src/rabitq-ivf/src/prng.js +36 -0
- package/dist/src/rabitq-ivf/src/rabitq.d.ts +95 -0
- package/dist/src/rabitq-ivf/src/rabitq.js +283 -0
- package/dist/src/sema.d.ts +9 -13
- package/dist/src/sema.js +26 -40
- package/dist/src/store-sqlite.d.ts +169 -166
- package/dist/src/store-sqlite.js +762 -662
- package/dist/src/store.d.ts +586 -630
- package/dist/src/store.js +1423 -1581
- package/dist/src/vec.d.ts +5 -9
- package/dist/src/vec.js +61 -73
- package/example/train_base.ts +13 -10
- package/package.json +1 -1
- package/src/alu/README.md +1 -1
- package/src/alu/src/index.ts +1 -1
- package/src/config.ts +19 -27
- package/src/index.ts +6 -11
- package/src/rabitq-ivf/README.md +56 -0
- package/src/rabitq-ivf/src/database.ts +276 -0
- package/src/{rabitq-hnsw → rabitq-ivf}/src/index.ts +2 -5
- package/src/rabitq-ivf/src/ivf.ts +1330 -0
- package/src/{rabitq-hnsw → rabitq-ivf}/src/prng.ts +1 -1
- package/src/store-sqlite.ts +196 -9
- package/src/store.ts +8 -32
- package/test/08-storage.test.mjs +3 -3
- package/test/14-scaling.test.mjs +2 -2
- package/test/35-ivf.test.mjs +263 -0
- package/test/36-bloom.test.mjs +123 -0
- package/dist/src/rabitq-hnsw/src/database.d.ts +0 -202
- package/dist/src/rabitq-hnsw/src/database.js +0 -405
- package/dist/src/rabitq-hnsw/src/heap.d.ts +0 -22
- package/dist/src/rabitq-hnsw/src/heap.js +0 -94
- package/dist/src/rabitq-hnsw/src/hnsw.d.ts +0 -125
- package/dist/src/rabitq-hnsw/src/hnsw.js +0 -500
- package/dist/src/rabitq-hnsw/src/index.d.ts +0 -15
- package/dist/src/rabitq-hnsw/src/prng.d.ts +0 -19
- package/dist/src/rabitq-hnsw/src/prng.js +0 -38
- package/dist/src/rabitq-hnsw/src/rabitq.d.ts +0 -95
- package/dist/src/rabitq-hnsw/src/rabitq.js +0 -299
- package/dist/src/rabitq-hnsw/src/store.d.ts +0 -162
- package/dist/src/rabitq-hnsw/src/store.js +0 -916
- package/dist/src/rabitq-hnsw/test/hnsw.test.d.ts +0 -1
- package/dist/src/rabitq-hnsw/test/hnsw.test.js +0 -1197
- package/src/rabitq-hnsw/README.md +0 -303
- package/src/rabitq-hnsw/src/database.ts +0 -492
- package/src/rabitq-hnsw/src/heap.ts +0 -90
- package/src/rabitq-hnsw/src/hnsw.ts +0 -514
- package/src/rabitq-hnsw/src/store.ts +0 -994
- package/src/rabitq-hnsw/test/hnsw.test.ts +0 -1213
- /package/src/{rabitq-hnsw → rabitq-ivf}/src/rabitq.ts +0 -0
|
@@ -1,100 +1,11 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
coerce,
|
|
7
|
-
decimalCodec,
|
|
8
|
-
type Domain,
|
|
9
|
-
formatReal,
|
|
10
|
-
int,
|
|
11
|
-
isNd,
|
|
12
|
-
isNumeric,
|
|
13
|
-
joinDomain,
|
|
14
|
-
nd,
|
|
15
|
-
parseValue,
|
|
16
|
-
real,
|
|
17
|
-
symbol,
|
|
18
|
-
symbolSpans,
|
|
19
|
-
tagOf,
|
|
20
|
-
type Value,
|
|
21
|
-
type ValueCodec,
|
|
22
|
-
} from "./value.js";
|
|
23
|
-
export {
|
|
24
|
-
type Arity,
|
|
25
|
-
type EvalExpr,
|
|
26
|
-
type InfixSyntax,
|
|
27
|
-
NO_RESONANCE,
|
|
28
|
-
type OpContext,
|
|
29
|
-
type Operation,
|
|
30
|
-
OperationRegistry,
|
|
31
|
-
type OpFn,
|
|
32
|
-
type OpRuntime,
|
|
33
|
-
type OpTraits,
|
|
34
|
-
type ResonanceSync,
|
|
35
|
-
} from "./operation.js";
|
|
36
|
-
export {
|
|
37
|
-
type AluResonance,
|
|
38
|
-
type ConceptAnchor,
|
|
39
|
-
NO_ALU_RESONANCE,
|
|
40
|
-
prefetchOpposites,
|
|
41
|
-
prefetchRecognisedOps,
|
|
42
|
-
prefetchResonance,
|
|
43
|
-
} from "./resonance.js";
|
|
44
|
-
export {
|
|
45
|
-
type ApplyScalar,
|
|
46
|
-
ExprGrammar,
|
|
47
|
-
freeVariables,
|
|
48
|
-
type IsUnaryFn,
|
|
49
|
-
type Token,
|
|
50
|
-
tokenize,
|
|
51
|
-
} from "./expr.js";
|
|
52
|
-
export {
|
|
53
|
-
type AluHost,
|
|
54
|
-
type ComputedSpan,
|
|
55
|
-
QueryParser,
|
|
56
|
-
type Span,
|
|
57
|
-
STRUCTURAL_HOST,
|
|
58
|
-
} from "./parser.js";
|
|
1
|
+
export { asBit, asInt, asReal, bit, coerce, decimalCodec, type Domain, formatReal, int, isNd, isNumeric, joinDomain, nd, parseValue, real, symbol, symbolSpans, tagOf, type Value, type ValueCodec, } from "./value.js";
|
|
2
|
+
export { type Arity, type EvalExpr, type InfixSyntax, NO_RESONANCE, type OpContext, type Operation, OperationRegistry, type OpFn, type OpRuntime, type OpTraits, type ResonanceSync, } from "./operation.js";
|
|
3
|
+
export { type AluResonance, type ConceptAnchor, NO_ALU_RESONANCE, prefetchOpposites, prefetchRecognisedOps, prefetchResonance, } from "./resonance.js";
|
|
4
|
+
export { type ApplyScalar, ExprGrammar, freeVariables, type IsUnaryFn, type Token, tokenize, } from "./expr.js";
|
|
5
|
+
export { type AluHost, type ComputedSpan, QueryParser, type Span, STRUCTURAL_HOST, } from "./parser.js";
|
|
59
6
|
export { registerNd } from "./kernel-nd.js";
|
|
60
7
|
export { registerLogic } from "./kernel-logic.js";
|
|
61
|
-
export {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
negateBits,
|
|
66
|
-
registerBits,
|
|
67
|
-
signBits,
|
|
68
|
-
} from "./kernel-bits.js";
|
|
69
|
-
export {
|
|
70
|
-
dot,
|
|
71
|
-
linsolve,
|
|
72
|
-
matMul,
|
|
73
|
-
matVec,
|
|
74
|
-
polyEval,
|
|
75
|
-
registerArith,
|
|
76
|
-
} from "./kernel-arith.js";
|
|
77
|
-
export {
|
|
78
|
-
converge,
|
|
79
|
-
cosSeries,
|
|
80
|
-
diff,
|
|
81
|
-
expSeries,
|
|
82
|
-
integrate,
|
|
83
|
-
interpolate,
|
|
84
|
-
logNewton,
|
|
85
|
-
odeSolve,
|
|
86
|
-
optimize,
|
|
87
|
-
powerEig,
|
|
88
|
-
registerNumeric,
|
|
89
|
-
regress,
|
|
90
|
-
sinSeries,
|
|
91
|
-
solve,
|
|
92
|
-
sqrtNewton,
|
|
93
|
-
topSingular,
|
|
94
|
-
} from "./kernel-numeric.js";
|
|
95
|
-
export {
|
|
96
|
-
Alu,
|
|
97
|
-
type AluOptions,
|
|
98
|
-
type OperandSpan,
|
|
99
|
-
type OperatorSpan,
|
|
100
|
-
} from "./alu.js";
|
|
8
|
+
export { addBits, compareBits, mulBits, negateBits, registerBits, signBits, } from "./kernel-bits.js";
|
|
9
|
+
export { dot, linsolve, matMul, matVec, polyEval, registerArith, } from "./kernel-arith.js";
|
|
10
|
+
export { converge, cosSeries, diff, expSeries, integrate, interpolate, logNewton, odeSolve, optimize, powerEig, registerNumeric, regress, sinSeries, solve, sqrtNewton, topSingular, } from "./kernel-numeric.js";
|
|
11
|
+
export { Alu, type AluOptions, type OperandSpan, type OperatorSpan, } from "./alu.js";
|
|
@@ -1,73 +1,19 @@
|
|
|
1
1
|
// alu — the ALU sub-library: a tiny irreducible kernel from which arithmetic,
|
|
2
2
|
// logic, and numerical computation are all DERIVED.
|
|
3
3
|
//
|
|
4
|
-
// Self-contained in the spirit of derive/ and rabitq-
|
|
4
|
+
// Self-contained in the spirit of derive/ and rabitq-ivf/: it imports only the
|
|
5
5
|
// pure byte helpers (../../bytes.js) and nothing else from SEMA. The host
|
|
6
6
|
// reaches meaning (operator synonymy, the symbolic inverse) through the injected
|
|
7
7
|
// AluResonance, pre-resolved into a synchronous snapshot before the search runs.
|
|
8
8
|
// See ./../README.md for the kernel and its derivation DAG.
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
coerce,
|
|
15
|
-
decimalCodec,
|
|
16
|
-
formatReal,
|
|
17
|
-
int,
|
|
18
|
-
isNd,
|
|
19
|
-
isNumeric,
|
|
20
|
-
joinDomain,
|
|
21
|
-
nd,
|
|
22
|
-
parseValue,
|
|
23
|
-
real,
|
|
24
|
-
symbol,
|
|
25
|
-
symbolSpans,
|
|
26
|
-
tagOf,
|
|
27
|
-
} from "./value.js";
|
|
28
|
-
export { NO_RESONANCE, OperationRegistry } from "./operation.js";
|
|
29
|
-
export {
|
|
30
|
-
NO_ALU_RESONANCE,
|
|
31
|
-
prefetchOpposites,
|
|
32
|
-
prefetchRecognisedOps,
|
|
33
|
-
prefetchResonance,
|
|
34
|
-
} from "./resonance.js";
|
|
35
|
-
export { ExprGrammar, freeVariables, tokenize } from "./expr.js";
|
|
36
|
-
export { QueryParser, STRUCTURAL_HOST } from "./parser.js";
|
|
9
|
+
export { asBit, asInt, asReal, bit, coerce, decimalCodec, formatReal, int, isNd, isNumeric, joinDomain, nd, parseValue, real, symbol, symbolSpans, tagOf, } from "./value.js";
|
|
10
|
+
export { NO_RESONANCE, OperationRegistry, } from "./operation.js";
|
|
11
|
+
export { NO_ALU_RESONANCE, prefetchOpposites, prefetchRecognisedOps, prefetchResonance, } from "./resonance.js";
|
|
12
|
+
export { ExprGrammar, freeVariables, tokenize, } from "./expr.js";
|
|
13
|
+
export { QueryParser, STRUCTURAL_HOST, } from "./parser.js";
|
|
37
14
|
export { registerNd } from "./kernel-nd.js";
|
|
38
15
|
export { registerLogic } from "./kernel-logic.js";
|
|
39
|
-
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
negateBits,
|
|
44
|
-
registerBits,
|
|
45
|
-
signBits,
|
|
46
|
-
} from "./kernel-bits.js";
|
|
47
|
-
export {
|
|
48
|
-
dot,
|
|
49
|
-
linsolve,
|
|
50
|
-
matMul,
|
|
51
|
-
matVec,
|
|
52
|
-
polyEval,
|
|
53
|
-
registerArith,
|
|
54
|
-
} from "./kernel-arith.js";
|
|
55
|
-
export {
|
|
56
|
-
converge,
|
|
57
|
-
cosSeries,
|
|
58
|
-
diff,
|
|
59
|
-
expSeries,
|
|
60
|
-
integrate,
|
|
61
|
-
interpolate,
|
|
62
|
-
logNewton,
|
|
63
|
-
odeSolve,
|
|
64
|
-
optimize,
|
|
65
|
-
powerEig,
|
|
66
|
-
registerNumeric,
|
|
67
|
-
regress,
|
|
68
|
-
sinSeries,
|
|
69
|
-
solve,
|
|
70
|
-
sqrtNewton,
|
|
71
|
-
topSingular,
|
|
72
|
-
} from "./kernel-numeric.js";
|
|
73
|
-
export { Alu } from "./alu.js";
|
|
16
|
+
export { addBits, compareBits, mulBits, negateBits, registerBits, signBits, } from "./kernel-bits.js";
|
|
17
|
+
export { dot, linsolve, matMul, matVec, polyEval, registerArith, } from "./kernel-arith.js";
|
|
18
|
+
export { converge, cosSeries, diff, expSeries, integrate, interpolate, logNewton, odeSolve, optimize, powerEig, registerNumeric, regress, sinSeries, solve, sqrtNewton, topSingular, } from "./kernel-numeric.js";
|
|
19
|
+
export { Alu, } from "./alu.js";
|
|
@@ -13,8 +13,4 @@ export declare function matMul(a: number[][], b: number[][]): number[][];
|
|
|
13
13
|
/** Solve A·x = b by Gaussian elimination with partial pivoting — structured
|
|
14
14
|
* arithmetic (add / multiply / divide / compare for the pivot), not a new
|
|
15
15
|
* primitive. Returns x, or null if A is singular to tolerance `tol`. */
|
|
16
|
-
export declare function linsolve(
|
|
17
|
-
A: number[][],
|
|
18
|
-
b: number[],
|
|
19
|
-
tol?: number,
|
|
20
|
-
): number[] | null;
|
|
16
|
+
export declare function linsolve(A: number[][], b: number[], tol?: number): number[] | null;
|