compiled-knowledge 4.0.0a23__cp312-cp312-win_amd64.whl → 4.0.0a25__cp312-cp312-win_amd64.whl
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.
Potentially problematic release.
This version of compiled-knowledge might be problematic. Click here for more details.
- ck/circuit/_circuit_cy.c +1 -1
- ck/circuit/_circuit_cy.cp312-win_amd64.pyd +0 -0
- ck/circuit/tmp_const.py +5 -4
- ck/circuit_compiler/circuit_compiler.py +3 -2
- ck/circuit_compiler/cython_vm_compiler/_compiler.c +152 -152
- ck/circuit_compiler/cython_vm_compiler/_compiler.cp312-win_amd64.pyd +0 -0
- ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.c +1 -1
- ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.cp312-win_amd64.pyd +0 -0
- ck/circuit_compiler/support/llvm_ir_function.py +4 -4
- ck/example/diamond_square.py +3 -1
- ck/example/triangle_square.py +3 -1
- ck/example/truss.py +3 -1
- ck/in_out/parse_net.py +21 -19
- ck/in_out/parser_utils.py +7 -3
- ck/pgm.py +146 -139
- ck/pgm_circuit/mpe_program.py +3 -4
- ck/pgm_circuit/pgm_circuit.py +27 -18
- ck/pgm_circuit/program_with_slotmap.py +4 -1
- ck/pgm_compiler/pgm_compiler.py +1 -1
- ck/pgm_compiler/support/circuit_table/_circuit_table_cy.c +1 -1
- ck/pgm_compiler/support/circuit_table/_circuit_table_cy.cp312-win_amd64.pyd +0 -0
- ck/pgm_compiler/support/join_tree.py +3 -3
- ck/probability/empirical_probability_space.py +4 -3
- ck/probability/pgm_probability_space.py +7 -3
- ck/probability/probability_space.py +20 -15
- ck/program/raw_program.py +23 -16
- ck/sampling/sampler_support.py +7 -5
- ck/utils/iter_extras.py +3 -2
- ck/utils/local_config.py +16 -8
- {compiled_knowledge-4.0.0a23.dist-info → compiled_knowledge-4.0.0a25.dist-info}/METADATA +1 -1
- {compiled_knowledge-4.0.0a23.dist-info → compiled_knowledge-4.0.0a25.dist-info}/RECORD +34 -34
- {compiled_knowledge-4.0.0a23.dist-info → compiled_knowledge-4.0.0a25.dist-info}/WHEEL +0 -0
- {compiled_knowledge-4.0.0a23.dist-info → compiled_knowledge-4.0.0a25.dist-info}/licenses/LICENSE.txt +0 -0
- {compiled_knowledge-4.0.0a23.dist-info → compiled_knowledge-4.0.0a25.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"/O2"
|
|
14
14
|
],
|
|
15
15
|
"include_dirs": [
|
|
16
|
-
"C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-
|
|
16
|
+
"C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-8cwjzb8_\\Lib\\site-packages\\numpy\\_core\\include"
|
|
17
17
|
],
|
|
18
18
|
"name": "ck.circuit_compiler.support.circuit_analyser._circuit_analyser_cy",
|
|
19
19
|
"sources": [
|
|
Binary file
|
|
@@ -213,10 +213,10 @@ def compile_llvm_program(
|
|
|
213
213
|
Compile the given LLVM program.
|
|
214
214
|
|
|
215
215
|
Returns:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
function
|
|
216
|
+
`engine` an LLVM execution engine, which must remain
|
|
217
|
+
in memory for the returned function to be valid,
|
|
218
|
+
|
|
219
|
+
`function` the raw Python callable for the compiled function.
|
|
220
220
|
"""
|
|
221
221
|
_init_llvm()
|
|
222
222
|
|
ck/example/diamond_square.py
CHANGED
|
@@ -8,7 +8,8 @@ class DiamondSquare(PGM):
|
|
|
8
8
|
This PGM is the 'DiamondSquare' factor graph.
|
|
9
9
|
|
|
10
10
|
The DiamondSquare is a factor graph with seven random variables (a, b, c, ..., h).
|
|
11
|
-
Binary factors are between pairs of random variables creating the pattern
|
|
11
|
+
Binary factors are between pairs of random variables creating the pattern::
|
|
12
|
+
|
|
12
13
|
b
|
|
13
14
|
/ \
|
|
14
15
|
/ \
|
|
@@ -20,6 +21,7 @@ class DiamondSquare(PGM):
|
|
|
20
21
|
\ /
|
|
21
22
|
\ /
|
|
22
23
|
g
|
|
24
|
+
|
|
23
25
|
If include_unaries then, also includes one unary factor per random variable.
|
|
24
26
|
"""
|
|
25
27
|
|
ck/example/triangle_square.py
CHANGED
|
@@ -8,12 +8,14 @@ class TriangleSquare(PGM):
|
|
|
8
8
|
This PGM is the 'TriangleSquare' factor graph.
|
|
9
9
|
|
|
10
10
|
The TriangleSquare is a factor graph with six random variables (a, b, c, ..., f).
|
|
11
|
-
Binary factors are between pairs of random variables crating the pattern
|
|
11
|
+
Binary factors are between pairs of random variables crating the pattern::
|
|
12
|
+
|
|
12
13
|
b -- d
|
|
13
14
|
/ | | \
|
|
14
15
|
a | | f
|
|
15
16
|
\ | | /
|
|
16
17
|
c -- e
|
|
18
|
+
|
|
17
19
|
If include_unaries then, also includes one unary factor per random variable.
|
|
18
20
|
"""
|
|
19
21
|
|
ck/example/truss.py
CHANGED
|
@@ -7,12 +7,14 @@ class Truss(PGM):
|
|
|
7
7
|
This PGM is the 'Truss' factor graph.
|
|
8
8
|
|
|
9
9
|
The Truss is a factor graph with five random variables (a, b, c, d, e).
|
|
10
|
-
Binary factors are between pairs of random variables creating the pattern
|
|
10
|
+
Binary factors are between pairs of random variables creating the pattern::
|
|
11
|
+
|
|
11
12
|
b ---- d
|
|
12
13
|
/ | / |
|
|
13
14
|
a | / |
|
|
14
15
|
\ | / |
|
|
15
16
|
c ---- e
|
|
17
|
+
|
|
16
18
|
If include_unaries then, also includes one unary factor per random variable.
|
|
17
19
|
"""
|
|
18
20
|
|
ck/in_out/parse_net.py
CHANGED
|
@@ -16,36 +16,37 @@ def read_network(input_stream, *, name: Optional[str] = None, network_builder: O
|
|
|
16
16
|
The input can be a string or a stream.
|
|
17
17
|
If the input is empty, then its is treated as an error.
|
|
18
18
|
|
|
19
|
-
This input is expected to conform to the following format
|
|
19
|
+
This input is expected to conform to the following format::
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
<network> ::= <net_block> <node_block>* <potential_block>*
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
<net_block> ::= 'net' <block>
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
<node_block> ::= 'node' <NAME> <block>
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
<potential_block> ::= 'potential' <link> <block>
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
<block> ::= '{' <sentence>* '}'
|
|
30
|
+
<sentence> ::= <NAME> '=' <value> ';'
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
<link> ::= '(' <NAME> ')'
|
|
33
|
+
| '(' <NAME> '|' <NAME>+ ')'
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
<value> ::= <STRING> | <NUMBER> | <list>
|
|
36
|
+
<list> ::='(' <value>* ')'
|
|
37
37
|
|
|
38
38
|
The sentences of a <net_block> are ignored.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
In a <node_block>,
|
|
41
|
+
<name> of 'states' mandatory, with value that is a list of <STRING>
|
|
42
|
+
other sentences are ignored.
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
In a <potential_block>,
|
|
45
|
+
<name> of 'data' is mandatory, with value that is a list of (list of) <NUMBER> (shape matching the link)
|
|
46
|
+
other sentences are ignored.
|
|
47
|
+
|
|
48
|
+
Here is a simple example input::
|
|
47
49
|
|
|
48
|
-
Here is a simple example input:
|
|
49
50
|
net{}
|
|
50
51
|
node a
|
|
51
52
|
{
|
|
@@ -62,8 +63,9 @@ def read_network(input_stream, *, name: Optional[str] = None, network_builder: O
|
|
|
62
63
|
}
|
|
63
64
|
potential ( b | a )
|
|
64
65
|
{
|
|
65
|
-
data = ((0.4 0.4 0.2)(0.4 0.4 0.2))
|
|
66
|
+
data = ((0.4 0.4 0.2)(0.4 0.4 0.2));
|
|
66
67
|
}
|
|
68
|
+
|
|
67
69
|
"""
|
|
68
70
|
# Decorate the input stream
|
|
69
71
|
input_stream = ParserInput(input_stream)
|
ck/in_out/parser_utils.py
CHANGED
|
@@ -57,8 +57,10 @@ class ParserInput:
|
|
|
57
57
|
|
|
58
58
|
def readline(self) -> str:
|
|
59
59
|
"""
|
|
60
|
+
Read a line of input.
|
|
61
|
+
|
|
60
62
|
Returns:
|
|
61
|
-
the next line (including the trailing
|
|
63
|
+
the next line (including the trailing newline) or empty string if EOF.
|
|
62
64
|
"""
|
|
63
65
|
line = ''
|
|
64
66
|
while True:
|
|
@@ -69,9 +71,11 @@ class ParserInput:
|
|
|
69
71
|
|
|
70
72
|
def read_past_space(self, single_line: bool, comment_char=None) -> str:
|
|
71
73
|
"""
|
|
74
|
+
Read the input up to and including the first non-whitespace character.
|
|
75
|
+
|
|
72
76
|
Returns:
|
|
73
|
-
either empty string,
|
|
74
|
-
If single_line is True, then
|
|
77
|
+
either empty string, if end of input, otherwise a single character string that is not whitespace.
|
|
78
|
+
If single_line is True, then newline is treated as eof.
|
|
75
79
|
"""
|
|
76
80
|
c = self.read_one()
|
|
77
81
|
while True:
|