compiled-knowledge 4.0.0a22__tar.gz → 4.0.0a24__tar.gz
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.
- {compiled_knowledge-4.0.0a22/src/compiled_knowledge.egg-info → compiled_knowledge-4.0.0a24}/PKG-INFO +1 -1
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/pyproject.toml +1 -1
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit/_circuit_cy.c +49 -59
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit/_circuit_cy.pyx +1 -1
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit/_circuit_py.py +1 -1
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/circuit_compiler.py +3 -2
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/cython_vm_compiler/_compiler.c +27 -18
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/cython_vm_compiler/_compiler.pyx +3 -3
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/cython_vm_compiler/cython_vm_compiler.py +14 -7
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/interpret_compiler.py +35 -4
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/llvm_vm_compiler.py +9 -3
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/support/llvm_ir_function.py +18 -1
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm.py +100 -102
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/pgm_compiler.py +1 -1
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/join_tree.py +3 -3
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/probability/empirical_probability_space.py +4 -3
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/probability/pgm_probability_space.py +7 -3
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/probability/probability_space.py +21 -15
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/program/raw_program.py +40 -7
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/sampler_support.py +8 -5
- compiled_knowledge-4.0.0a24/src/ck_demos/ace/simple_ace_demo.py +18 -0
- compiled_knowledge-4.0.0a24/src/ck_demos/getting_started/simple_demo.py +18 -0
- compiled_knowledge-4.0.0a24/src/ck_demos/programs/demo_raw_program_dump.py +17 -0
- compiled_knowledge-4.0.0a24/src/ck_demos/utils/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24/src/compiled_knowledge.egg-info}/PKG-INFO +1 -1
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/compiled_knowledge.egg-info/SOURCES.txt +4 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/LICENSE.txt +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/MANIFEST.in +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/README.md +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/setup.cfg +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/setup.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit/_circuit_cy.pxd +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit/tmp_const.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/cython_vm_compiler/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/llvm_compiler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/named_circuit_compilers.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/support/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/support/circuit_analyser/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.c +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.pyx +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_py.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/circuit_compiler/support/input_vars.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/alarm.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/asia.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/binary_clique.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/bow_tie.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/cancer.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/chain.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/child.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/clique.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/cnf_pgm.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/diamond_square.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/earthquake.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/empty.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/hailfinder.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/hepar2.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/insurance.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/loop.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/mildew.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/munin.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/pathfinder.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/rain.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/rectangle.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/run.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/sachs.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/sprinkler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/star.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/stress.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/student.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/survey.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/triangle_square.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/example/truss.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/parse_ace_lmap.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/parse_ace_nnf.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/parse_net.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/parser_utils.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/pgm_pickle.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/pgm_python.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/render_bugs.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/render_net.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/in_out/render_pomegranate.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/marginals_program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/mpe_program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/pgm_circuit.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/program_with_slotmap.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/slot_map.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/support/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/support/compile_circuit.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/target_marginals_program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_circuit/wmc_program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/ace/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/ace/ace.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/factor_elimination.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/named_pgm_compilers.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/recursive_conditioning.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/circuit_table/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/circuit_table/_circuit_table_cy.c +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/circuit_table/_circuit_table_cy.pyx +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/circuit_table/_circuit_table_py.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/clusters.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/factor_tables.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/support/named_compiler_maker.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/pgm_compiler/variable_elimination.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/probability/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/program/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/program/program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/program/program_buffer.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/forward_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/marginals_direct_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/uniform_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/wmc_direct_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/wmc_gibbs_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/wmc_metropolis_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/sampling/wmc_rejection_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/iter_extras.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/local_config.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/map_list.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/map_set.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/np_extras.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/random_extras.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck/utils/tmp_dir.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/ace/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/ace/copy_ace_to_ck.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/ace/demo_ace.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/all_demos.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/circuit/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/circuit/demo_circuit_dump.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/circuit/demo_derivatives.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/circuit_compiler/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/circuit_compiler/compare_circuit_compilers.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/circuit_compiler/show_llvm_program.py +0 -0
- {compiled_knowledge-4.0.0a22/src/ck_demos/pgm → compiled_knowledge-4.0.0a24/src/ck_demos/getting_started}/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22/src/ck_demos/pgm_compiler → compiled_knowledge-4.0.0a24/src/ck_demos/pgm}/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm/demo_pgm_dump.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm/demo_pgm_dump_stress.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm/demo_pgm_string_rendering.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm/show_examples.py +0 -0
- {compiled_knowledge-4.0.0a22/src/ck_demos/pgm_inference → compiled_knowledge-4.0.0a24/src/ck_demos/pgm_compiler}/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/compare_pgm_compilers.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_compiler_dump.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_factor_elimination.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_join_tree.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_marginals_program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_mpe_program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_pgm_compiler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_recursive_conditioning.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_variable_elimination.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/demo_wmc_program.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_compiler/time_fe_compiler.py +0 -0
- {compiled_knowledge-4.0.0a22/src/ck_demos/programs → compiled_knowledge-4.0.0a24/src/ck_demos/pgm_inference}/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_inference/demo_inferencing_basic.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_inference/demo_inferencing_mpe_cancer.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_inference/demo_inferencing_wmc_and_mpe_sprinkler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/pgm_inference/demo_inferencing_wmc_student.py +0 -0
- {compiled_knowledge-4.0.0a22/src/ck_demos/sampling → compiled_knowledge-4.0.0a24/src/ck_demos/programs}/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/programs/demo_program_buffer.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/programs/demo_program_multi.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/programs/demo_program_none.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/programs/demo_program_single.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/programs/demo_raw_program_interpreted.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/programs/demo_raw_program_llvm.py +0 -0
- {compiled_knowledge-4.0.0a22/src/ck_demos/utils → compiled_knowledge-4.0.0a24/src/ck_demos/sampling}/__init__.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/sampling/check_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/sampling/demo_marginal_direct_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/sampling/demo_uniform_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/sampling/demo_wmc_direct_sampler.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/utils/compare.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/utils/convert_network.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/utils/sample_model.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/ck_demos/utils/stop_watch.py +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/compiled_knowledge.egg-info/dependency_links.txt +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/compiled_knowledge.egg-info/requires.txt +0 -0
- {compiled_knowledge-4.0.0a22 → compiled_knowledge-4.0.0a24}/src/compiled_knowledge.egg-info/top_level.txt +0 -0
{compiled_knowledge-4.0.0a22/src/compiled_knowledge.egg-info → compiled_knowledge-4.0.0a24}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compiled-knowledge
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.0a24
|
|
4
4
|
Summary: A Python package for compiling and querying discrete probabilistic graphical models.
|
|
5
5
|
Author-email: Barry Drake <barry@compiledknowledge.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -1764,7 +1764,7 @@ struct __pyx_obj_2ck_7circuit_11_circuit_cy___pyx_scope_struct_6_dump {
|
|
|
1764
1764
|
|
|
1765
1765
|
|
|
1766
1766
|
/* "ck/circuit/_circuit_cy.pyx":364
|
|
1767
|
-
* for op in
|
|
1767
|
+
* for op in self.ops:
|
|
1768
1768
|
* op_name = node_name[id(op)]
|
|
1769
1769
|
* args_str = ' '.join(node_name[id(arg)] for arg in op.args) # <<<<<<<<<<<<<<
|
|
1770
1770
|
* print(f'{next_prefix}{op_name}: {args_str}')
|
|
@@ -3042,7 +3042,6 @@ static PyObject *__pyx_builtin_range;
|
|
|
3042
3042
|
static PyObject *__pyx_builtin_print;
|
|
3043
3043
|
static PyObject *__pyx_builtin_id;
|
|
3044
3044
|
static PyObject *__pyx_builtin_enumerate;
|
|
3045
|
-
static PyObject *__pyx_builtin_reversed;
|
|
3046
3045
|
static PyObject *__pyx_builtin_RuntimeError;
|
|
3047
3046
|
static PyObject *__pyx_builtin_super;
|
|
3048
3047
|
/* #### Code section: string_decls ### */
|
|
@@ -3181,7 +3180,6 @@ static const char __pyx_k_op_nodes[] = "op nodes: ";
|
|
|
3181
3180
|
static const char __pyx_k_overload[] = "overload";
|
|
3182
3181
|
static const char __pyx_k_pyx_type[] = "__pyx_type";
|
|
3183
3182
|
static const char __pyx_k_qualname[] = "__qualname__";
|
|
3184
|
-
static const char __pyx_k_reversed[] = "reversed";
|
|
3185
3183
|
static const char __pyx_k_set_name[] = "__set_name__";
|
|
3186
3184
|
static const char __pyx_k_setstate[] = "__setstate__";
|
|
3187
3185
|
static const char __pyx_k_var_name[] = "var_name";
|
|
@@ -3320,7 +3318,7 @@ static const char __pyx_k_T_a_G1F_a_vWA_q_t87_s_fG1_q_d_7[] = "\200\001\360\010\
|
|
|
3320
3318
|
static const char __pyx_k_T_d_8_G4_SWWX_G1F_a_vWA_q_t_we3[] = "\200\001\360\010\000\005\016\210T\220\035\230d\320\"8\270\004\270G\3004\300|\320SW\320WX\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\230<\240w\250e\2603\260d\320:O\310w\320V[\320[^\320^b\320bh\320ho\320ot\320tw\320w{\360\000\000|\001F\002\360\000\000F\002M\002\360\000\000M\002N\002\330\004\007\200q\330\010\017\320\017'\240t\2501\250G\260;\270g\300Q\340\010\017\320\017'\240t\2501\250G\260;\270a";
|
|
3321
3319
|
static const char __pyx_k_T_fD_dRYY_G1F_a_vWA_q_t_2_c_QXX[] = "\200\001\360\010\000\005\016\210T\320\021)\250\024\250]\270$\270f\300D\310\006\310d\320RY\320Y]\320]^\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\320\0332\260'\270\025\270c\300\024\300\\\320QX\320X]\320]`\320`d\320di\320ip\320pu\320ux\320x|\360\000\000}\001B\002\360\000\000B\002I\002\360\000\000I\002N\002\360\000\000N\002Q\002\360\000\000Q\002U\002\360\000\000U\002[\002\360\000\000[\002b\002\360\000\000b\002g\002\360\000\000g\002j\002\360\000\000j\002n\002\360\000\000n\002t\002\360\000\000t\002{\002\360\000\000{\002|\002\330\004\007\200q\330\010\017\320\017(\250\004\250A\250W\260K\270w\300a\340\010\017\320\017(\250\004\250A\250W\260K\270q";
|
|
3322
3320
|
static const char __pyx_k_T_j_F_it1_G1F_a_vWA_q_t87_s_iwa[] = "\200\001\360\010\000\005\016\210T\220\031\230$\230j\250\004\250F\260$\260i\270t\3001\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250%\250s\260$\260i\270w\300a\330\004\007\200q\330\010\017\320\017(\250\004\250A\250W\260K\270w\300a\340\010\017\320\017(\250\004\250A\250W\260K\270q";
|
|
3323
|
-
static const char __pyx_k_A_Q_1_7_A_A_Qb_D_Qb_34q_Qb_0_A_Q[] = "\200A\360\006\000\025\033\230!\330\024\032\230!\330\027-\250Q\330\034#\2401\330\t\n\360\030\000\t\034\2307\240\"\240A\340\010$\240A\340\010\r\210Q\210b\220\004\320\024,\250D\260\001\330\010\r\210Q\210b\220\004\320\0243\2604\260q\330\010\r\210Q\210b\220\004\320\0240\260\004\260A\330\010\r\210Q\210b\220\004\320\0242\260$\260a\330\010\r\210Q\210b\220\004\320\024,\250D\260\001\340\010\r\210Q\210b\220\004\320\024'\240t\2501\330\010\014\210G\2204\220q\330\014\025\220Q\220b\230\001\230\030\240\022\2408\2503\250a\330\014\034\230F\240*\250C\250u\260C\260s\270%\270s\300#\300Q\320FV\320V_\320_`\320`c\320cd\330\014\017\210y\230\003\2301\330\020\023\2203\220i\230q\330\024\031\230\021\230\"\230D\320 1\260\023\260I\270\\\310\023\310F\320RS\340\024\031\230\021\230\"\230D\320 1\260\023\260I\270Q\330\021\024\220I\230Q\330\020\025\220Q\220b\230\004\320\034-\250S\260\t\270\023\270F\300!\340\010\013\2101\330\014\021\220\021\220\"\220D\320\030-\250T\260\021\330\014\020\220\t\230\024\230[\250\007\250q\330\020\025\220Q\220b\230\004\230M\250\025\250a\360\006\000\t\r\210I\220T\230\033\240G\2501\330\014\025\220Q\220b\230\001\230\032\2404\240q\250\005\250Q\360\006\000\t\r\210C\210v\220Y\230a\230t\2401\330\014\025\220Q\220b\230\001\230\027\240\002\240$\240b\250\007\250u\260A\340\010\r\210Q\330\014\016\210d\320\022$\240D\250\001\330\016\031\230\024\320\0355\260T\270\021\340\010\014\210F\220
|
|
3321
|
+
static const char __pyx_k_A_Q_1_7_A_A_Qb_D_Qb_34q_Qb_0_A_Q[] = "\200A\360\006\000\025\033\230!\330\024\032\230!\330\027-\250Q\330\034#\2401\330\t\n\360\030\000\t\034\2307\240\"\240A\340\010$\240A\340\010\r\210Q\210b\220\004\320\024,\250D\260\001\330\010\r\210Q\210b\220\004\320\0243\2604\260q\330\010\r\210Q\210b\220\004\320\0240\260\004\260A\330\010\r\210Q\210b\220\004\320\0242\260$\260a\330\010\r\210Q\210b\220\004\320\024,\250D\260\001\340\010\r\210Q\210b\220\004\320\024'\240t\2501\330\010\014\210G\2204\220q\330\014\025\220Q\220b\230\001\230\030\240\022\2408\2503\250a\330\014\034\230F\240*\250C\250u\260C\260s\270%\270s\300#\300Q\320FV\320V_\320_`\320`c\320cd\330\014\017\210y\230\003\2301\330\020\023\2203\220i\230q\330\024\031\230\021\230\"\230D\320 1\260\023\260I\270\\\310\023\310F\320RS\340\024\031\230\021\230\"\230D\320 1\260\023\260I\270Q\330\021\024\220I\230Q\330\020\025\220Q\220b\230\004\320\034-\250S\260\t\270\023\270F\300!\340\010\013\2101\330\014\021\220\021\220\"\220D\320\030-\250T\260\021\330\014\020\220\t\230\024\230[\250\007\250q\330\020\025\220Q\220b\230\004\230M\250\025\250a\360\006\000\t\r\210I\220T\230\033\240G\2501\330\014\025\220Q\220b\230\001\230\032\2404\240q\250\005\250Q\360\006\000\t\r\210C\210v\220Y\230a\230t\2401\330\014\025\220Q\220b\230\001\230\027\240\002\240$\240b\250\007\250u\260A\340\010\r\210Q\330\014\016\210d\320\022$\240D\250\001\330\016\031\230\024\320\0355\260T\270\021\340\010\014\210F\220$\220a\330\014\026\220i\230q\240\002\240!\2401\330\014\027\220s\230%\230z\250\021\330\014\021\220\021\220\"\220D\230\r\240[\260\001";
|
|
3324
3322
|
static const char __pyx_k_Circuit_remove_derivatives_cache[] = "Circuit.remove_derivatives_cache";
|
|
3325
3323
|
static const char __pyx_k_Circuit_remove_unreachable_op_no[] = "Circuit.remove_unreachable_op_nodes";
|
|
3326
3324
|
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x769839a, 0xe0847da, 0xcebc8c6) = (_Circuit__derivatives, _const_map, one, ops, vars, zero))";
|
|
@@ -3535,7 +3533,7 @@ typedef struct {
|
|
|
3535
3533
|
__Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
|
|
3536
3534
|
PyObject *__pyx_tuple[8];
|
|
3537
3535
|
PyObject *__pyx_codeobj_tab[49];
|
|
3538
|
-
PyObject *__pyx_string_tab[
|
|
3536
|
+
PyObject *__pyx_string_tab[242];
|
|
3539
3537
|
PyObject *__pyx_int_0;
|
|
3540
3538
|
PyObject *__pyx_int_1;
|
|
3541
3539
|
PyObject *__pyx_int_16976299;
|
|
@@ -3866,42 +3864,41 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati
|
|
|
3866
3864
|
#define __pyx_n_u_remove_unreachable_op_nodes __pyx_string_tab[204]
|
|
3867
3865
|
#define __pyx_n_u_result __pyx_string_tab[205]
|
|
3868
3866
|
#define __pyx_n_u_return __pyx_string_tab[206]
|
|
3869
|
-
#define
|
|
3870
|
-
#define
|
|
3871
|
-
#define
|
|
3872
|
-
#define
|
|
3873
|
-
#define
|
|
3874
|
-
#define
|
|
3875
|
-
#define
|
|
3876
|
-
#define
|
|
3877
|
-
#define
|
|
3878
|
-
#define
|
|
3879
|
-
#define
|
|
3880
|
-
#define
|
|
3881
|
-
#define
|
|
3882
|
-
#define
|
|
3883
|
-
#define
|
|
3884
|
-
#define
|
|
3885
|
-
#define
|
|
3886
|
-
#define
|
|
3887
|
-
#define
|
|
3888
|
-
#define
|
|
3889
|
-
#define
|
|
3890
|
-
#define
|
|
3891
|
-
#define
|
|
3892
|
-
#define
|
|
3893
|
-
#define
|
|
3894
|
-
#define
|
|
3895
|
-
#define
|
|
3896
|
-
#define
|
|
3897
|
-
#define
|
|
3898
|
-
#define
|
|
3899
|
-
#define
|
|
3900
|
-
#define
|
|
3901
|
-
#define
|
|
3902
|
-
#define
|
|
3903
|
-
#define
|
|
3904
|
-
#define __pyx_n_u_zero __pyx_string_tab[242]
|
|
3867
|
+
#define __pyx_n_u_self __pyx_string_tab[207]
|
|
3868
|
+
#define __pyx_n_u_self_multiply __pyx_string_tab[208]
|
|
3869
|
+
#define __pyx_n_u_send __pyx_string_tab[209]
|
|
3870
|
+
#define __pyx_n_u_set_name __pyx_string_tab[210]
|
|
3871
|
+
#define __pyx_n_u_setstate __pyx_string_tab[211]
|
|
3872
|
+
#define __pyx_n_u_setstate_cython __pyx_string_tab[212]
|
|
3873
|
+
#define __pyx_n_u_single_result __pyx_string_tab[213]
|
|
3874
|
+
#define __pyx_kp_u_src_ck_circuit__circuit_cy_pyx __pyx_string_tab[214]
|
|
3875
|
+
#define __pyx_n_u_state __pyx_string_tab[215]
|
|
3876
|
+
#define __pyx_n_u_str __pyx_string_tab[216]
|
|
3877
|
+
#define __pyx_kp_u_stringsource __pyx_string_tab[217]
|
|
3878
|
+
#define __pyx_n_u_sum __pyx_string_tab[218]
|
|
3879
|
+
#define __pyx_n_u_super __pyx_string_tab[219]
|
|
3880
|
+
#define __pyx_n_u_symbol __pyx_string_tab[220]
|
|
3881
|
+
#define __pyx_n_u_test __pyx_string_tab[221]
|
|
3882
|
+
#define __pyx_n_u_throw __pyx_string_tab[222]
|
|
3883
|
+
#define __pyx_n_u_to_add __pyx_string_tab[223]
|
|
3884
|
+
#define __pyx_n_u_to_mul __pyx_string_tab[224]
|
|
3885
|
+
#define __pyx_n_u_typing __pyx_string_tab[225]
|
|
3886
|
+
#define __pyx_n_u_update __pyx_string_tab[226]
|
|
3887
|
+
#define __pyx_n_u_use_setstate __pyx_string_tab[227]
|
|
3888
|
+
#define __pyx_n_u_value __pyx_string_tab[228]
|
|
3889
|
+
#define __pyx_n_u_values __pyx_string_tab[229]
|
|
3890
|
+
#define __pyx_kp_u_var __pyx_string_tab[230]
|
|
3891
|
+
#define __pyx_n_u_var_2 __pyx_string_tab[231]
|
|
3892
|
+
#define __pyx_n_u_var_name __pyx_string_tab[232]
|
|
3893
|
+
#define __pyx_n_u_var_names __pyx_string_tab[233]
|
|
3894
|
+
#define __pyx_kp_u_var_nodes __pyx_string_tab[234]
|
|
3895
|
+
#define __pyx_n_u_x __pyx_string_tab[235]
|
|
3896
|
+
#define __pyx_n_u_xs __pyx_string_tab[236]
|
|
3897
|
+
#define __pyx_n_u_xs_list __pyx_string_tab[237]
|
|
3898
|
+
#define __pyx_n_u_y __pyx_string_tab[238]
|
|
3899
|
+
#define __pyx_n_u_ys __pyx_string_tab[239]
|
|
3900
|
+
#define __pyx_n_u_ys_list __pyx_string_tab[240]
|
|
3901
|
+
#define __pyx_n_u_zero __pyx_string_tab[241]
|
|
3905
3902
|
/* #### Code section: module_state_clear ### */
|
|
3906
3903
|
#if CYTHON_USE_MODULE_STATE
|
|
3907
3904
|
static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
|
|
@@ -3962,7 +3959,7 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
|
|
|
3962
3959
|
Py_CLEAR(clear_module_state->__pyx_type_2ck_7circuit_11_circuit_cy___pyx_scope_struct_10_genexpr);
|
|
3963
3960
|
for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
|
|
3964
3961
|
for (int i=0; i<49; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
|
|
3965
|
-
for (int i=0; i<
|
|
3962
|
+
for (int i=0; i<242; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
|
|
3966
3963
|
Py_CLEAR(clear_module_state->__pyx_int_0);
|
|
3967
3964
|
Py_CLEAR(clear_module_state->__pyx_int_1);
|
|
3968
3965
|
Py_CLEAR(clear_module_state->__pyx_int_16976299);
|
|
@@ -4049,7 +4046,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void
|
|
|
4049
4046
|
Py_VISIT(traverse_module_state->__pyx_type_2ck_7circuit_11_circuit_cy___pyx_scope_struct_10_genexpr);
|
|
4050
4047
|
for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
|
|
4051
4048
|
for (int i=0; i<49; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
|
|
4052
|
-
for (int i=0; i<
|
|
4049
|
+
for (int i=0; i<242; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
|
|
4053
4050
|
__Pyx_VISIT_CONST(traverse_module_state->__pyx_int_0);
|
|
4054
4051
|
__Pyx_VISIT_CONST(traverse_module_state->__pyx_int_1);
|
|
4055
4052
|
__Pyx_VISIT_CONST(traverse_module_state->__pyx_int_16976299);
|
|
@@ -8192,7 +8189,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
|
8192
8189
|
static PyObject *__pyx_gb_2ck_7circuit_11_circuit_cy_7Circuit_4dump_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
|
|
8193
8190
|
|
|
8194
8191
|
/* "ck/circuit/_circuit_cy.pyx":364
|
|
8195
|
-
* for op in
|
|
8192
|
+
* for op in self.ops:
|
|
8196
8193
|
* op_name = node_name[id(op)]
|
|
8197
8194
|
* args_str = ' '.join(node_name[id(arg)] for arg in op.args) # <<<<<<<<<<<<<<
|
|
8198
8195
|
* print(f'{next_prefix}{op_name}: {args_str}')
|
|
@@ -9271,7 +9268,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
|
|
|
9271
9268
|
* f'{prefix}op nodes: {self.number_of_op_nodes} '
|
|
9272
9269
|
* f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})' # <<<<<<<<<<<<<<
|
|
9273
9270
|
* )
|
|
9274
|
-
* for op in
|
|
9271
|
+
* for op in self.ops:
|
|
9275
9272
|
*/
|
|
9276
9273
|
__pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_number_of_arcs); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 360, __pyx_L1_error)
|
|
9277
9274
|
__Pyx_GOTREF(__pyx_t_13);
|
|
@@ -9320,7 +9317,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
|
|
|
9320
9317
|
/* "ck/circuit/_circuit_cy.pyx":362
|
|
9321
9318
|
* f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})'
|
|
9322
9319
|
* )
|
|
9323
|
-
* for op in
|
|
9320
|
+
* for op in self.ops: # <<<<<<<<<<<<<<
|
|
9324
9321
|
* op_name = node_name[id(op)]
|
|
9325
9322
|
* args_str = ' '.join(node_name[id(arg)] for arg in op.args)
|
|
9326
9323
|
*/
|
|
@@ -9329,13 +9326,8 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
|
|
|
9329
9326
|
__PYX_ERR(0, 362, __pyx_L1_error)
|
|
9330
9327
|
}
|
|
9331
9328
|
__pyx_t_1 = __pyx_v_self->ops; __Pyx_INCREF(__pyx_t_1);
|
|
9332
|
-
__pyx_t_8 =
|
|
9333
|
-
#if !CYTHON_ASSUME_SAFE_SIZE
|
|
9334
|
-
if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 362, __pyx_L1_error)
|
|
9335
|
-
#endif
|
|
9336
|
-
--__pyx_t_8;
|
|
9329
|
+
__pyx_t_8 = 0;
|
|
9337
9330
|
for (;;) {
|
|
9338
|
-
if (__pyx_t_8 < 0) break;
|
|
9339
9331
|
{
|
|
9340
9332
|
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
|
|
9341
9333
|
#if !CYTHON_ASSUME_SAFE_SIZE
|
|
@@ -9344,7 +9336,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
|
|
|
9344
9336
|
if (__pyx_t_8 >= __pyx_temp) break;
|
|
9345
9337
|
}
|
|
9346
9338
|
__pyx_t_14 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_8);
|
|
9347
|
-
|
|
9339
|
+
++__pyx_t_8;
|
|
9348
9340
|
if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 362, __pyx_L1_error)
|
|
9349
9341
|
__Pyx_GOTREF(__pyx_t_14);
|
|
9350
9342
|
__Pyx_XDECREF_SET(__pyx_v_op, __pyx_t_14);
|
|
@@ -9352,7 +9344,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
|
|
|
9352
9344
|
|
|
9353
9345
|
/* "ck/circuit/_circuit_cy.pyx":363
|
|
9354
9346
|
* )
|
|
9355
|
-
* for op in
|
|
9347
|
+
* for op in self.ops:
|
|
9356
9348
|
* op_name = node_name[id(op)] # <<<<<<<<<<<<<<
|
|
9357
9349
|
* args_str = ' '.join(node_name[id(arg)] for arg in op.args)
|
|
9358
9350
|
* print(f'{next_prefix}{op_name}: {args_str}')
|
|
@@ -9376,7 +9368,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
|
|
|
9376
9368
|
__pyx_t_2 = 0;
|
|
9377
9369
|
|
|
9378
9370
|
/* "ck/circuit/_circuit_cy.pyx":364
|
|
9379
|
-
* for op in
|
|
9371
|
+
* for op in self.ops:
|
|
9380
9372
|
* op_name = node_name[id(op)]
|
|
9381
9373
|
* args_str = ' '.join(node_name[id(arg)] for arg in op.args) # <<<<<<<<<<<<<<
|
|
9382
9374
|
* print(f'{next_prefix}{op_name}: {args_str}')
|
|
@@ -9434,7 +9426,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
|
|
|
9434
9426
|
/* "ck/circuit/_circuit_cy.pyx":362
|
|
9435
9427
|
* f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})'
|
|
9436
9428
|
* )
|
|
9437
|
-
* for op in
|
|
9429
|
+
* for op in self.ops: # <<<<<<<<<<<<<<
|
|
9438
9430
|
* op_name = node_name[id(op)]
|
|
9439
9431
|
* args_str = ' '.join(node_name[id(arg)] for arg in op.args)
|
|
9440
9432
|
*/
|
|
@@ -28894,7 +28886,6 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
|
|
|
28894
28886
|
{__pyx_k_remove_unreachable_op_nodes, sizeof(__pyx_k_remove_unreachable_op_nodes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_remove_unreachable_op_nodes */
|
|
28895
28887
|
{__pyx_k_result, sizeof(__pyx_k_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_result */
|
|
28896
28888
|
{__pyx_k_return, sizeof(__pyx_k_return), 0, 1, 1}, /* PyObject cname: __pyx_n_u_return */
|
|
28897
|
-
{__pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reversed */
|
|
28898
28889
|
{__pyx_k_self, sizeof(__pyx_k_self), 0, 1, 1}, /* PyObject cname: __pyx_n_u_self */
|
|
28899
28890
|
{__pyx_k_self_multiply, sizeof(__pyx_k_self_multiply), 0, 1, 1}, /* PyObject cname: __pyx_n_u_self_multiply */
|
|
28900
28891
|
{__pyx_k_send, sizeof(__pyx_k_send), 0, 1, 1}, /* PyObject cname: __pyx_n_u_send */
|
|
@@ -28944,7 +28935,6 @@ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
|
|
|
28944
28935
|
__pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 327, __pyx_L1_error)
|
|
28945
28936
|
__pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(0, 335, __pyx_L1_error)
|
|
28946
28937
|
__pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 355, __pyx_L1_error)
|
|
28947
|
-
__pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 362, __pyx_L1_error)
|
|
28948
28938
|
__pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 424, __pyx_L1_error)
|
|
28949
28939
|
__pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_super); if (!__pyx_builtin_super) __PYX_ERR(0, 473, __pyx_L1_error)
|
|
28950
28940
|
return 0;
|
|
@@ -29170,7 +29160,7 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
|
|
|
29170
29160
|
__pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_ck_circuit__circuit_cy_pyx, __pyx_mstate->__pyx_n_u_reachable_op_nodes, __pyx_k_2_4_AQ_t_1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
|
|
29171
29161
|
}
|
|
29172
29162
|
{
|
|
29173
|
-
const __Pyx_PyCode_New_function_description descr = {1, 0, 4, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 304,
|
|
29163
|
+
const __Pyx_PyCode_New_function_description descr = {1, 0, 4, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 304, 495};
|
|
29174
29164
|
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_prefix, __pyx_mstate->__pyx_n_u_indent, __pyx_mstate->__pyx_n_u_var_names, __pyx_mstate->__pyx_n_u_include_consts, __pyx_mstate->__pyx_n_u_next_prefix, __pyx_mstate->__pyx_n_u_node_name, __pyx_mstate->__pyx_n_u_var_2, __pyx_mstate->__pyx_n_u_var_name, __pyx_mstate->__pyx_n_u_const, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_op, __pyx_mstate->__pyx_n_u_op_name, __pyx_mstate->__pyx_n_u_args_str, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
|
|
29175
29165
|
__pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_ck_circuit__circuit_cy_pyx, __pyx_mstate->__pyx_n_u_dump, __pyx_k_A_Q_1_7_A_A_Qb_D_Qb_34q_Qb_0_A_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
|
|
29176
29166
|
}
|
|
@@ -359,7 +359,7 @@ cdef class Circuit:
|
|
|
359
359
|
f'{prefix}op nodes: {self.number_of_op_nodes} '
|
|
360
360
|
f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})'
|
|
361
361
|
)
|
|
362
|
-
for op in
|
|
362
|
+
for op in self.ops:
|
|
363
363
|
op_name = node_name[id(op)]
|
|
364
364
|
args_str = ' '.join(node_name[id(arg)] for arg in op.args)
|
|
365
365
|
print(f'{next_prefix}{op_name}: {args_str}')
|
|
@@ -413,7 +413,7 @@ class Circuit:
|
|
|
413
413
|
f'{prefix}op nodes: {self.number_of_op_nodes} '
|
|
414
414
|
f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})'
|
|
415
415
|
)
|
|
416
|
-
for op in
|
|
416
|
+
for op in self.ops:
|
|
417
417
|
op_name = node_name[id(op)]
|
|
418
418
|
args_str = ' '.join(node_name[id(arg)] for arg in op.args)
|
|
419
419
|
print(f'{next_prefix}{op_name}: {args_str}')
|
|
@@ -13,12 +13,13 @@ class CircuitCompiler(Protocol):
|
|
|
13
13
|
circuit: Optional[Circuit] = None,
|
|
14
14
|
) -> RawProgram:
|
|
15
15
|
"""
|
|
16
|
-
A
|
|
16
|
+
A PGM compiler compiles selected results nodes of an arithmetic circuit to a program.
|
|
17
17
|
|
|
18
18
|
Args:
|
|
19
19
|
*result: one or more circuit of nodes defining the result of the program function.
|
|
20
20
|
All result node must be from the same circuit.
|
|
21
|
-
input_vars: how to determine the input variables.
|
|
21
|
+
input_vars: how to determine the input variables. Either a sequence of VarNodes, or a single
|
|
22
|
+
VarNode, or a `InferVars` member. The default is to use all circuit variables, in index order.
|
|
22
23
|
circuit: optionally explicitly specify the Circuit (mandatory if no result nodes are provided).
|
|
23
24
|
|
|
24
25
|
Returns:
|
|
@@ -1800,7 +1800,7 @@ struct __pyx_obj_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_Instruct
|
|
|
1800
1800
|
/* "ck/circuit_compiler/cython_vm_compiler/_compiler.pyx":41
|
|
1801
1801
|
*
|
|
1802
1802
|
*
|
|
1803
|
-
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int]: # <<<<<<<<<<<<<<
|
|
1803
|
+
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int, int]: # <<<<<<<<<<<<<<
|
|
1804
1804
|
* """
|
|
1805
1805
|
* Make a RawProgram function that interprets the circuit.
|
|
1806
1806
|
*/
|
|
@@ -3005,12 +3005,12 @@ static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
|
|
|
3005
3005
|
static const char __pyx_k_ck_program_raw_program[] = "ck.program.raw_program";
|
|
3006
3006
|
static const char __pyx_k_cvm_type_name_unexpected[] = "cvm_type_name unexpected: ";
|
|
3007
3007
|
static const char __pyx_k_Instructions___reduce_cython[] = "Instructions.__reduce_cython__";
|
|
3008
|
-
static const char __pyx_k_Tuple_RawProgramFunction_int[] = "Tuple[RawProgramFunction, int]";
|
|
3009
3008
|
static const char __pyx_k_make_function_locals_function[] = "make_function.<locals>.function";
|
|
3010
|
-
static const char __pyx_k_44EQ_az_r_JoQa_7_1_1_S_Yl_HOST[] = "\320\000\034\320\0344\3204E\300Q\360\034\000\005\023\220,\320\036>\270a\270z\310\021\340\004\017\210r\220\030\230\021\230\"\230J\240o\260Q\260a\330\004\022\220)\2307\240(\250!\2501\340\004\031\320\031*\250!\2501\360\006\000\005\010\200~\220S\230\001\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\032\000\t\017\210j\230\001\230\022\320\0339\270\021\340\004\013\210:\220S\230\001\230\030\240\021";
|
|
3009
|
+
static const char __pyx_k_44EQ_az_r_JoQa_7_1_1_S_Yl_HOST[] = "\320\000\034\320\0344\3204E\300Q\360\034\000\005\023\220,\320\036>\270a\270z\310\021\340\004\017\210r\220\030\230\021\230\"\230J\240o\260Q\260a\330\004\022\220)\2307\240(\250!\2501\340\004\031\320\031*\250!\2501\360\006\000\005\010\200~\220S\230\001\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\030\000\n\030\220s\230!\330\010\025\220Y\230l\250&\260\014\270H\300O\320ST\360\032\000\t\017\210j\230\001\230\022\320\0339\270\021\340\004\013\210:\220S\230\001\230\030\240\035\250c\260\021\260(\270!";
|
|
3011
3010
|
static const char __pyx_k_Instructions___setstate_cython[] = "Instructions.__setstate_cython__";
|
|
3012
3011
|
static const char __pyx_k_00DOST_r_ay_A_Be1F_Ja_b_Qm2Zq_b[] = "\320\010\036\320\0360\3200D\300O\320ST\330\014'\240r\250\025\250a\250y\270\002\270*\300A\330\014$\240B\240e\2501\250F\260\"\260J\270a\330\014&\240b\250\005\250Q\250m\2702\270Z\300q\330\014&\240b\250\005\250Q\250h\260b\270\n\300!\330\014\017\210q\220\007\220q\330\020\033\2301\330\020\033\2301\330\020\033\2301\330\020\033\2301\330\020\021";
|
|
3013
3012
|
static const char __pyx_k_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'array'";
|
|
3013
|
+
static const char __pyx_k_Tuple_RawProgramFunction_int_int[] = "Tuple[RawProgramFunction, int, int]";
|
|
3014
3014
|
static const char __pyx_k_ck_circuit_compiler_cython_vm_co[] = "ck.circuit_compiler.cython_vm_compiler._compiler";
|
|
3015
3015
|
static const char __pyx_k_ck_circuit_compiler_support_circ[] = "ck.circuit_compiler.support.circuit_analyser";
|
|
3016
3016
|
static const char __pyx_k_numpy__core_multiarray_failed_to[] = "numpy._core.multiarray failed to import";
|
|
@@ -3161,7 +3161,7 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati
|
|
|
3161
3161
|
#define __pyx_n_u_POINTER __pyx_string_tab[19]
|
|
3162
3162
|
#define __pyx_n_u_RawProgramFunction __pyx_string_tab[20]
|
|
3163
3163
|
#define __pyx_n_u_Tuple __pyx_string_tab[21]
|
|
3164
|
-
#define
|
|
3164
|
+
#define __pyx_kp_u_Tuple_RawProgramFunction_int_int __pyx_string_tab[22]
|
|
3165
3165
|
#define __pyx_n_u_TypeError __pyx_string_tab[23]
|
|
3166
3166
|
#define __pyx_n_u_ValueError __pyx_string_tab[24]
|
|
3167
3167
|
#define __pyx_kp_u__2 __pyx_string_tab[25]
|
|
@@ -5408,7 +5408,7 @@ static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObjec
|
|
|
5408
5408
|
/* "ck/circuit_compiler/cython_vm_compiler/_compiler.pyx":41
|
|
5409
5409
|
*
|
|
5410
5410
|
*
|
|
5411
|
-
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int]: # <<<<<<<<<<<<<<
|
|
5411
|
+
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int, int]: # <<<<<<<<<<<<<<
|
|
5412
5412
|
* """
|
|
5413
5413
|
* Make a RawProgram function that interprets the circuit.
|
|
5414
5414
|
*/
|
|
@@ -5421,7 +5421,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
|
5421
5421
|
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
5422
5422
|
#endif
|
|
5423
5423
|
); /*proto*/
|
|
5424
|
-
PyDoc_STRVAR(__pyx_doc_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_make_function, "\n Make a RawProgram function that interprets the circuit.\n\n Args:\n analysis: A circuit analysis object defining the function.\n dtype: a numpy data type that must be a key in the dictionary, DTYPE_TO_CVM_TYPE.\n\n Returns:\n (function, number_of_tmps)\n ");
|
|
5424
|
+
PyDoc_STRVAR(__pyx_doc_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_make_function, "\n Make a RawProgram function that interprets the circuit.\n\n Args:\n analysis: A circuit analysis object defining the function.\n dtype: a numpy data type that must be a key in the dictionary, DTYPE_TO_CVM_TYPE.\n\n Returns:\n (function, number_of_tmps, number_of_instructions)\n ");
|
|
5425
5425
|
static PyMethodDef __pyx_mdef_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_1make_function = {"make_function", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_1make_function, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_make_function};
|
|
5426
5426
|
static PyObject *__pyx_pw_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_1make_function(PyObject *__pyx_self,
|
|
5427
5427
|
#if CYTHON_METH_FASTCALL
|
|
@@ -7320,7 +7320,7 @@ static PyObject *__pyx_pf_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler
|
|
|
7320
7320
|
/* "ck/circuit_compiler/cython_vm_compiler/_compiler.pyx":41
|
|
7321
7321
|
*
|
|
7322
7322
|
*
|
|
7323
|
-
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int]: # <<<<<<<<<<<<<<
|
|
7323
|
+
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int, int]: # <<<<<<<<<<<<<<
|
|
7324
7324
|
* """
|
|
7325
7325
|
* Make a RawProgram function that interprets the circuit.
|
|
7326
7326
|
*/
|
|
@@ -7693,7 +7693,7 @@ static PyObject *__pyx_pf_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler
|
|
|
7693
7693
|
* else:
|
|
7694
7694
|
* raise ValueError(f'cvm_type_name unexpected: {cvm_type_name!r}') # <<<<<<<<<<<<<<
|
|
7695
7695
|
*
|
|
7696
|
-
* return function, len(analysis.op_to_tmp)
|
|
7696
|
+
* return function, len(analysis.op_to_tmp), len(analysis.op_nodes)
|
|
7697
7697
|
*/
|
|
7698
7698
|
/*else*/ {
|
|
7699
7699
|
__pyx_t_2 = NULL;
|
|
@@ -7723,7 +7723,7 @@ static PyObject *__pyx_pf_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler
|
|
|
7723
7723
|
/* "ck/circuit_compiler/cython_vm_compiler/_compiler.pyx":131
|
|
7724
7724
|
* raise ValueError(f'cvm_type_name unexpected: {cvm_type_name!r}')
|
|
7725
7725
|
*
|
|
7726
|
-
* return function, len(analysis.op_to_tmp) # <<<<<<<<<<<<<<
|
|
7726
|
+
* return function, len(analysis.op_to_tmp), len(analysis.op_nodes) # <<<<<<<<<<<<<<
|
|
7727
7727
|
*
|
|
7728
7728
|
* # VM instructions
|
|
7729
7729
|
*/
|
|
@@ -7734,22 +7734,31 @@ static PyObject *__pyx_pf_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler
|
|
|
7734
7734
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
7735
7735
|
__pyx_t_1 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
7736
7736
|
__Pyx_GOTREF(__pyx_t_1);
|
|
7737
|
-
__pyx_t_4 =
|
|
7737
|
+
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_analysis, __pyx_mstate_global->__pyx_n_u_op_nodes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
7738
7738
|
__Pyx_GOTREF(__pyx_t_4);
|
|
7739
|
+
__pyx_t_10 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
7740
|
+
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
7741
|
+
__pyx_t_4 = PyLong_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
7742
|
+
__Pyx_GOTREF(__pyx_t_4);
|
|
7743
|
+
__pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
7744
|
+
__Pyx_GOTREF(__pyx_t_7);
|
|
7739
7745
|
__Pyx_INCREF(__pyx_v_function);
|
|
7740
7746
|
__Pyx_GIVEREF(__pyx_v_function);
|
|
7741
|
-
if (__Pyx_PyTuple_SET_ITEM(
|
|
7747
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_function) != (0)) __PYX_ERR(0, 131, __pyx_L1_error);
|
|
7742
7748
|
__Pyx_GIVEREF(__pyx_t_1);
|
|
7743
|
-
if (__Pyx_PyTuple_SET_ITEM(
|
|
7749
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 131, __pyx_L1_error);
|
|
7750
|
+
__Pyx_GIVEREF(__pyx_t_4);
|
|
7751
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 131, __pyx_L1_error);
|
|
7744
7752
|
__pyx_t_1 = 0;
|
|
7745
|
-
__pyx_r = ((PyObject*)__pyx_t_4);
|
|
7746
7753
|
__pyx_t_4 = 0;
|
|
7754
|
+
__pyx_r = ((PyObject*)__pyx_t_7);
|
|
7755
|
+
__pyx_t_7 = 0;
|
|
7747
7756
|
goto __pyx_L0;
|
|
7748
7757
|
|
|
7749
7758
|
/* "ck/circuit_compiler/cython_vm_compiler/_compiler.pyx":41
|
|
7750
7759
|
*
|
|
7751
7760
|
*
|
|
7752
|
-
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int]: # <<<<<<<<<<<<<<
|
|
7761
|
+
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int, int]: # <<<<<<<<<<<<<<
|
|
7753
7762
|
* """
|
|
7754
7763
|
* Make a RawProgram function that interprets the circuit.
|
|
7755
7764
|
*/
|
|
@@ -12186,7 +12195,7 @@ __Pyx_RefNannySetupContext("PyInit__compiler", 0);
|
|
|
12186
12195
|
/* "ck/circuit_compiler/cython_vm_compiler/_compiler.pyx":41
|
|
12187
12196
|
*
|
|
12188
12197
|
*
|
|
12189
|
-
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int]: # <<<<<<<<<<<<<<
|
|
12198
|
+
* def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int, int]: # <<<<<<<<<<<<<<
|
|
12190
12199
|
* """
|
|
12191
12200
|
* Make a RawProgram function that interprets the circuit.
|
|
12192
12201
|
*/
|
|
@@ -12194,7 +12203,7 @@ __Pyx_RefNannySetupContext("PyInit__compiler", 0);
|
|
|
12194
12203
|
__Pyx_GOTREF(__pyx_t_3);
|
|
12195
12204
|
if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_analysis, __pyx_mstate_global->__pyx_n_u_CircuitAnalysis) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
|
|
12196
12205
|
if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_DTypeNumeric) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
|
|
12197
|
-
if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->
|
|
12206
|
+
if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_Tuple_RawProgramFunction_int_int) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
|
|
12198
12207
|
__pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_2ck_16circuit_compiler_18cython_vm_compiler_9_compiler_1make_function, 0, __pyx_mstate_global->__pyx_n_u_make_function, NULL, __pyx_mstate_global->__pyx_n_u_ck_circuit_compiler_cython_vm_co, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error)
|
|
12199
12208
|
__Pyx_GOTREF(__pyx_t_5);
|
|
12200
12209
|
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
|
|
@@ -12400,7 +12409,7 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
|
|
|
12400
12409
|
{__pyx_k_POINTER, sizeof(__pyx_k_POINTER), 0, 1, 1}, /* PyObject cname: __pyx_n_u_POINTER */
|
|
12401
12410
|
{__pyx_k_RawProgramFunction, sizeof(__pyx_k_RawProgramFunction), 0, 1, 1}, /* PyObject cname: __pyx_n_u_RawProgramFunction */
|
|
12402
12411
|
{__pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Tuple */
|
|
12403
|
-
{
|
|
12412
|
+
{__pyx_k_Tuple_RawProgramFunction_int_int, sizeof(__pyx_k_Tuple_RawProgramFunction_int_int), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Tuple_RawProgramFunction_int_int */
|
|
12404
12413
|
{__pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TypeError */
|
|
12405
12414
|
{__pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ValueError */
|
|
12406
12415
|
{__pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__2 */
|
|
@@ -12595,7 +12604,7 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
|
|
|
12595
12604
|
__pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_ck_circuit_compiler_cython_v, __pyx_mstate->__pyx_n_u_function, __pyx_k_00DOST_r_ay_A_Be1F_Ja_b_Qm2Zq_b_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
|
|
12596
12605
|
}
|
|
12597
12606
|
{
|
|
12598
|
-
const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 41,
|
|
12607
|
+
const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 41, 243};
|
|
12599
12608
|
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_analysis, __pyx_mstate->__pyx_n_u_dtype, __pyx_mstate->__pyx_n_u_instructions, __pyx_mstate->__pyx_n_u_np_consts, __pyx_mstate->__pyx_n_u_ptr_type, __pyx_mstate->__pyx_n_u_c_np_consts, __pyx_mstate->__pyx_n_u_cvm_type_name, __pyx_mstate->__pyx_n_u_function, __pyx_mstate->__pyx_n_u_function, __pyx_mstate->__pyx_n_u_function, __pyx_mstate->__pyx_n_u_function, __pyx_mstate->__pyx_n_u_function, __pyx_mstate->__pyx_n_u_function};
|
|
12600
12609
|
__pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_src_ck_circuit_compiler_cython_v, __pyx_mstate->__pyx_n_u_make_function, __pyx_k_44EQ_az_r_JoQa_7_1_1_S_Yl_HOST, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
|
|
12601
12610
|
}
|
|
@@ -38,7 +38,7 @@ DTYPE_TO_CVM_TYPE: Dict[DTypeNumeric, str] = {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int]:
|
|
41
|
+
def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawProgramFunction, int, int]:
|
|
42
42
|
"""
|
|
43
43
|
Make a RawProgram function that interprets the circuit.
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawPr
|
|
|
47
47
|
dtype: a numpy data type that must be a key in the dictionary, DTYPE_TO_CVM_TYPE.
|
|
48
48
|
|
|
49
49
|
Returns:
|
|
50
|
-
(function, number_of_tmps)
|
|
50
|
+
(function, number_of_tmps, number_of_instructions)
|
|
51
51
|
"""
|
|
52
52
|
|
|
53
53
|
cdef Instructions instructions
|
|
@@ -128,7 +128,7 @@ def make_function(analysis: CircuitAnalysis, dtype: DTypeNumeric) -> Tuple[RawPr
|
|
|
128
128
|
else:
|
|
129
129
|
raise ValueError(f'cvm_type_name unexpected: {cvm_type_name!r}')
|
|
130
130
|
|
|
131
|
-
return function, len(analysis.op_to_tmp)
|
|
131
|
+
return function, len(analysis.op_to_tmp), len(analysis.op_nodes)
|
|
132
132
|
|
|
133
133
|
# VM instructions
|
|
134
134
|
cdef int ADD = circuit.ADD
|
|
@@ -48,15 +48,16 @@ class CythonRawProgram(RawProgram):
|
|
|
48
48
|
result: Sequence[CircuitNode],
|
|
49
49
|
dtype: DTypeNumeric,
|
|
50
50
|
):
|
|
51
|
-
|
|
52
|
-
self.result = result
|
|
53
|
-
|
|
54
|
-
function, number_of_tmps = _make_function(
|
|
51
|
+
function, number_of_tmps, number_of_instructions = _make_function(
|
|
55
52
|
var_nodes=in_vars,
|
|
56
53
|
result_nodes=result,
|
|
57
54
|
dtype=dtype,
|
|
58
55
|
)
|
|
59
56
|
|
|
57
|
+
self.in_vars = in_vars
|
|
58
|
+
self.result = result
|
|
59
|
+
self.number_of_instructions = number_of_instructions
|
|
60
|
+
|
|
60
61
|
super().__init__(
|
|
61
62
|
function=function,
|
|
62
63
|
dtype=dtype,
|
|
@@ -66,6 +67,10 @@ class CythonRawProgram(RawProgram):
|
|
|
66
67
|
var_indices=tuple(var.idx for var in in_vars),
|
|
67
68
|
)
|
|
68
69
|
|
|
70
|
+
def dump(self, *, prefix: str = '', indent: str = ' ') -> None:
|
|
71
|
+
super().dump(prefix=prefix, indent=indent)
|
|
72
|
+
print(f'{prefix}number of instructions = {self.number_of_instructions}')
|
|
73
|
+
|
|
69
74
|
def __getstate__(self):
|
|
70
75
|
"""
|
|
71
76
|
Support for pickle.
|
|
@@ -94,7 +99,7 @@ class CythonRawProgram(RawProgram):
|
|
|
94
99
|
self.in_vars = state['in_vars']
|
|
95
100
|
self.result = state['result']
|
|
96
101
|
|
|
97
|
-
self.function, _ = _make_function(
|
|
102
|
+
self.function, _, self.number_of_instructions = _make_function(
|
|
98
103
|
var_nodes=self.in_vars,
|
|
99
104
|
result_nodes=self.result,
|
|
100
105
|
dtype=self.dtype,
|
|
@@ -105,7 +110,7 @@ def _make_function(
|
|
|
105
110
|
var_nodes: Sequence[VarNode],
|
|
106
111
|
result_nodes: Sequence[CircuitNode],
|
|
107
112
|
dtype: DTypeNumeric,
|
|
108
|
-
) -> Tuple[RawProgramFunction, int]:
|
|
113
|
+
) -> Tuple[RawProgramFunction, int, int]:
|
|
109
114
|
"""
|
|
110
115
|
Make a RawProgram function that interprets the circuit.
|
|
111
116
|
|
|
@@ -115,7 +120,9 @@ def _make_function(
|
|
|
115
120
|
dtype: a numpy data type that must be a key in the dictionary, DTYPE_TO_CVM_TYPE.
|
|
116
121
|
|
|
117
122
|
Returns:
|
|
118
|
-
(function, number_of_tmps)
|
|
123
|
+
(function, number_of_tmps, number_of_instructions)
|
|
119
124
|
"""
|
|
120
125
|
analysis: CircuitAnalysis = analyze_circuit(var_nodes, result_nodes)
|
|
126
|
+
DEBUG = _compiler.make_function(analysis, dtype)
|
|
127
|
+
|
|
121
128
|
return _compiler.make_function(analysis, dtype)
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import ctypes as ct
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
from typing import Sequence, Optional, Dict, List, Tuple, Callable
|
|
5
6
|
|
|
6
7
|
import numpy as np
|
|
7
|
-
import ctypes as ct
|
|
8
8
|
|
|
9
|
+
from .support.circuit_analyser import CircuitAnalysis, analyze_circuit
|
|
10
|
+
from .support.input_vars import InputVars, InferVars, infer_input_vars
|
|
9
11
|
from ..circuit import Circuit, CircuitNode, VarNode, OpNode, ADD, MUL
|
|
10
12
|
from ..program.raw_program import RawProgram, RawProgramFunction
|
|
11
13
|
from ..utils.iter_extras import multiply, first
|
|
12
14
|
from ..utils.np_extras import NDArrayNumeric, DTypeNumeric
|
|
13
|
-
from .support.circuit_analyser import CircuitAnalysis, analyze_circuit
|
|
14
|
-
from .support.input_vars import InputVars, InferVars, infer_input_vars
|
|
15
15
|
|
|
16
16
|
# index to a value array
|
|
17
17
|
_VARS = 0
|
|
@@ -85,6 +85,15 @@ class InterpreterRawProgram(RawProgram):
|
|
|
85
85
|
var_indices=tuple(var.idx for var in in_vars),
|
|
86
86
|
)
|
|
87
87
|
|
|
88
|
+
def dump(self, *, prefix: str = '', indent: str = ' ', show_instructions: bool = True) -> None:
|
|
89
|
+
super().dump(prefix=prefix, indent=indent)
|
|
90
|
+
print(f'{prefix}number of instructions = {len(self.instructions)}')
|
|
91
|
+
if show_instructions:
|
|
92
|
+
print(f'{prefix}instructions:')
|
|
93
|
+
next_prefix: str = prefix + indent
|
|
94
|
+
for instruction in self.instructions:
|
|
95
|
+
print(f'{next_prefix}{instruction.to_str(self.var_indices, self.np_consts)}')
|
|
96
|
+
|
|
88
97
|
def __getstate__(self):
|
|
89
98
|
"""
|
|
90
99
|
Support for pickle.
|
|
@@ -123,7 +132,6 @@ def _make_instructions(
|
|
|
123
132
|
analysis: CircuitAnalysis,
|
|
124
133
|
dtype: DTypeNumeric,
|
|
125
134
|
) -> Tuple[Sequence[_Instruction], NDArrayNumeric]:
|
|
126
|
-
|
|
127
135
|
# Store const values in a numpy array
|
|
128
136
|
node_to_const_idx: Dict[int, int] = {
|
|
129
137
|
id(node): i
|
|
@@ -216,9 +224,32 @@ class _ElementID:
|
|
|
216
224
|
array: int # VARS, TMPS, CONSTS, RESULT
|
|
217
225
|
index: int # index into the array
|
|
218
226
|
|
|
227
|
+
def to_str(self, var_indices: Sequence[int], consts: NDArrayNumeric) -> str:
|
|
228
|
+
if self.array == _VARS:
|
|
229
|
+
return f'var[{var_indices[self.index]}]'
|
|
230
|
+
elif self.array == _TMPS:
|
|
231
|
+
return f'tmp[{self.index}]'
|
|
232
|
+
elif self.array == _CONSTS:
|
|
233
|
+
return str(consts.item(self.index))
|
|
234
|
+
elif self.array == _RESULT:
|
|
235
|
+
return f'result[{self.index}]'
|
|
236
|
+
else:
|
|
237
|
+
return f'?[{self.index}]'
|
|
238
|
+
|
|
219
239
|
|
|
220
240
|
@dataclass
|
|
221
241
|
class _Instruction:
|
|
222
242
|
operation: Callable
|
|
223
243
|
args: Sequence[_ElementID]
|
|
224
244
|
dest: _ElementID
|
|
245
|
+
|
|
246
|
+
def to_str(self, var_indices: Sequence[int], consts: NDArrayNumeric) -> str:
|
|
247
|
+
symbol: str
|
|
248
|
+
if self.operation is multiply:
|
|
249
|
+
symbol = 'mul'
|
|
250
|
+
elif self.operation == sum:
|
|
251
|
+
symbol = 'sum'
|
|
252
|
+
else:
|
|
253
|
+
symbol = '<?>'
|
|
254
|
+
args: str = ' '.join(elem.to_str(var_indices, consts) for elem in self.args)
|
|
255
|
+
return f'{self.dest.to_str(var_indices, consts)} = {symbol} {args}'
|