compiled-knowledge 4.0.0a22__cp312-cp312-win32.whl → 4.0.0a24__cp312-cp312-win32.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.

Files changed (33) hide show
  1. ck/circuit/_circuit_cy.c +50 -60
  2. ck/circuit/_circuit_cy.cp312-win32.pyd +0 -0
  3. ck/circuit/_circuit_cy.pyx +1 -1
  4. ck/circuit/_circuit_py.py +1 -1
  5. ck/circuit_compiler/circuit_compiler.py +3 -2
  6. ck/circuit_compiler/cython_vm_compiler/_compiler.c +179 -170
  7. ck/circuit_compiler/cython_vm_compiler/_compiler.cp312-win32.pyd +0 -0
  8. ck/circuit_compiler/cython_vm_compiler/_compiler.pyx +3 -3
  9. ck/circuit_compiler/cython_vm_compiler/cython_vm_compiler.py +14 -7
  10. ck/circuit_compiler/interpret_compiler.py +35 -4
  11. ck/circuit_compiler/llvm_vm_compiler.py +9 -3
  12. ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.c +1 -1
  13. ck/circuit_compiler/support/circuit_analyser/_circuit_analyser_cy.cp312-win32.pyd +0 -0
  14. ck/circuit_compiler/support/llvm_ir_function.py +18 -1
  15. ck/pgm.py +100 -102
  16. ck/pgm_compiler/pgm_compiler.py +1 -1
  17. ck/pgm_compiler/support/circuit_table/_circuit_table_cy.c +1 -1
  18. ck/pgm_compiler/support/circuit_table/_circuit_table_cy.cp312-win32.pyd +0 -0
  19. ck/pgm_compiler/support/join_tree.py +3 -3
  20. ck/probability/empirical_probability_space.py +4 -3
  21. ck/probability/pgm_probability_space.py +7 -3
  22. ck/probability/probability_space.py +21 -15
  23. ck/program/raw_program.py +40 -7
  24. ck/sampling/sampler_support.py +8 -5
  25. ck_demos/ace/simple_ace_demo.py +18 -0
  26. ck_demos/getting_started/__init__.py +0 -0
  27. ck_demos/getting_started/simple_demo.py +18 -0
  28. ck_demos/programs/demo_raw_program_dump.py +17 -0
  29. {compiled_knowledge-4.0.0a22.dist-info → compiled_knowledge-4.0.0a24.dist-info}/METADATA +1 -1
  30. {compiled_knowledge-4.0.0a22.dist-info → compiled_knowledge-4.0.0a24.dist-info}/RECORD +33 -29
  31. {compiled_knowledge-4.0.0a22.dist-info → compiled_knowledge-4.0.0a24.dist-info}/WHEEL +0 -0
  32. {compiled_knowledge-4.0.0a22.dist-info → compiled_knowledge-4.0.0a24.dist-info}/licenses/LICENSE.txt +0 -0
  33. {compiled_knowledge-4.0.0a22.dist-info → compiled_knowledge-4.0.0a24.dist-info}/top_level.txt +0 -0
ck/circuit/_circuit_cy.c CHANGED
@@ -13,7 +13,7 @@
13
13
  "/O2"
14
14
  ],
15
15
  "include_dirs": [
16
- "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-0p_rjbh1\\Lib\\site-packages\\numpy\\_core\\include"
16
+ "C:\\Users\\runneradmin\\AppData\\Local\\Temp\\build-env-b7kylfcw\\Lib\\site-packages\\numpy\\_core\\include"
17
17
  ],
18
18
  "name": "ck.circuit._circuit_cy",
19
19
  "sources": [
@@ -1767,7 +1767,7 @@ struct __pyx_obj_2ck_7circuit_11_circuit_cy___pyx_scope_struct_6_dump {
1767
1767
 
1768
1768
 
1769
1769
  /* "ck/circuit/_circuit_cy.pyx":364
1770
- * for op in reversed(self.ops):
1770
+ * for op in self.ops:
1771
1771
  * op_name = node_name[id(op)]
1772
1772
  * args_str = ' '.join(node_name[id(arg)] for arg in op.args) # <<<<<<<<<<<<<<
1773
1773
  * print(f'{next_prefix}{op_name}: {args_str}')
@@ -3045,7 +3045,6 @@ static PyObject *__pyx_builtin_range;
3045
3045
  static PyObject *__pyx_builtin_print;
3046
3046
  static PyObject *__pyx_builtin_id;
3047
3047
  static PyObject *__pyx_builtin_enumerate;
3048
- static PyObject *__pyx_builtin_reversed;
3049
3048
  static PyObject *__pyx_builtin_RuntimeError;
3050
3049
  static PyObject *__pyx_builtin_super;
3051
3050
  /* #### Code section: string_decls ### */
@@ -3184,7 +3183,6 @@ static const char __pyx_k_op_nodes[] = "op nodes: ";
3184
3183
  static const char __pyx_k_overload[] = "overload";
3185
3184
  static const char __pyx_k_pyx_type[] = "__pyx_type";
3186
3185
  static const char __pyx_k_qualname[] = "__qualname__";
3187
- static const char __pyx_k_reversed[] = "reversed";
3188
3186
  static const char __pyx_k_set_name[] = "__set_name__";
3189
3187
  static const char __pyx_k_setstate[] = "__setstate__";
3190
3188
  static const char __pyx_k_var_name[] = "var_name";
@@ -3323,7 +3321,7 @@ static const char __pyx_k_T_a_G1F_a_vWA_q_t87_s_fG1_q_d_7[] = "\200\001\360\010\
3323
3321
  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";
3324
3322
  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";
3325
3323
  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";
3326
- 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(\230!\2304\230q\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
+ 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";
3327
3325
  static const char __pyx_k_Circuit_remove_derivatives_cache[] = "Circuit.remove_derivatives_cache";
3328
3326
  static const char __pyx_k_Circuit_remove_unreachable_op_no[] = "Circuit.remove_unreachable_op_nodes";
3329
3327
  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))";
@@ -3538,7 +3536,7 @@ typedef struct {
3538
3536
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
3539
3537
  PyObject *__pyx_tuple[8];
3540
3538
  PyObject *__pyx_codeobj_tab[49];
3541
- PyObject *__pyx_string_tab[243];
3539
+ PyObject *__pyx_string_tab[242];
3542
3540
  PyObject *__pyx_int_0;
3543
3541
  PyObject *__pyx_int_1;
3544
3542
  PyObject *__pyx_int_16976299;
@@ -3869,42 +3867,41 @@ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_stati
3869
3867
  #define __pyx_n_u_remove_unreachable_op_nodes __pyx_string_tab[204]
3870
3868
  #define __pyx_n_u_result __pyx_string_tab[205]
3871
3869
  #define __pyx_n_u_return __pyx_string_tab[206]
3872
- #define __pyx_n_u_reversed __pyx_string_tab[207]
3873
- #define __pyx_n_u_self __pyx_string_tab[208]
3874
- #define __pyx_n_u_self_multiply __pyx_string_tab[209]
3875
- #define __pyx_n_u_send __pyx_string_tab[210]
3876
- #define __pyx_n_u_set_name __pyx_string_tab[211]
3877
- #define __pyx_n_u_setstate __pyx_string_tab[212]
3878
- #define __pyx_n_u_setstate_cython __pyx_string_tab[213]
3879
- #define __pyx_n_u_single_result __pyx_string_tab[214]
3880
- #define __pyx_kp_u_src_ck_circuit__circuit_cy_pyx __pyx_string_tab[215]
3881
- #define __pyx_n_u_state __pyx_string_tab[216]
3882
- #define __pyx_n_u_str __pyx_string_tab[217]
3883
- #define __pyx_kp_u_stringsource __pyx_string_tab[218]
3884
- #define __pyx_n_u_sum __pyx_string_tab[219]
3885
- #define __pyx_n_u_super __pyx_string_tab[220]
3886
- #define __pyx_n_u_symbol __pyx_string_tab[221]
3887
- #define __pyx_n_u_test __pyx_string_tab[222]
3888
- #define __pyx_n_u_throw __pyx_string_tab[223]
3889
- #define __pyx_n_u_to_add __pyx_string_tab[224]
3890
- #define __pyx_n_u_to_mul __pyx_string_tab[225]
3891
- #define __pyx_n_u_typing __pyx_string_tab[226]
3892
- #define __pyx_n_u_update __pyx_string_tab[227]
3893
- #define __pyx_n_u_use_setstate __pyx_string_tab[228]
3894
- #define __pyx_n_u_value __pyx_string_tab[229]
3895
- #define __pyx_n_u_values __pyx_string_tab[230]
3896
- #define __pyx_kp_u_var __pyx_string_tab[231]
3897
- #define __pyx_n_u_var_2 __pyx_string_tab[232]
3898
- #define __pyx_n_u_var_name __pyx_string_tab[233]
3899
- #define __pyx_n_u_var_names __pyx_string_tab[234]
3900
- #define __pyx_kp_u_var_nodes __pyx_string_tab[235]
3901
- #define __pyx_n_u_x __pyx_string_tab[236]
3902
- #define __pyx_n_u_xs __pyx_string_tab[237]
3903
- #define __pyx_n_u_xs_list __pyx_string_tab[238]
3904
- #define __pyx_n_u_y __pyx_string_tab[239]
3905
- #define __pyx_n_u_ys __pyx_string_tab[240]
3906
- #define __pyx_n_u_ys_list __pyx_string_tab[241]
3907
- #define __pyx_n_u_zero __pyx_string_tab[242]
3870
+ #define __pyx_n_u_self __pyx_string_tab[207]
3871
+ #define __pyx_n_u_self_multiply __pyx_string_tab[208]
3872
+ #define __pyx_n_u_send __pyx_string_tab[209]
3873
+ #define __pyx_n_u_set_name __pyx_string_tab[210]
3874
+ #define __pyx_n_u_setstate __pyx_string_tab[211]
3875
+ #define __pyx_n_u_setstate_cython __pyx_string_tab[212]
3876
+ #define __pyx_n_u_single_result __pyx_string_tab[213]
3877
+ #define __pyx_kp_u_src_ck_circuit__circuit_cy_pyx __pyx_string_tab[214]
3878
+ #define __pyx_n_u_state __pyx_string_tab[215]
3879
+ #define __pyx_n_u_str __pyx_string_tab[216]
3880
+ #define __pyx_kp_u_stringsource __pyx_string_tab[217]
3881
+ #define __pyx_n_u_sum __pyx_string_tab[218]
3882
+ #define __pyx_n_u_super __pyx_string_tab[219]
3883
+ #define __pyx_n_u_symbol __pyx_string_tab[220]
3884
+ #define __pyx_n_u_test __pyx_string_tab[221]
3885
+ #define __pyx_n_u_throw __pyx_string_tab[222]
3886
+ #define __pyx_n_u_to_add __pyx_string_tab[223]
3887
+ #define __pyx_n_u_to_mul __pyx_string_tab[224]
3888
+ #define __pyx_n_u_typing __pyx_string_tab[225]
3889
+ #define __pyx_n_u_update __pyx_string_tab[226]
3890
+ #define __pyx_n_u_use_setstate __pyx_string_tab[227]
3891
+ #define __pyx_n_u_value __pyx_string_tab[228]
3892
+ #define __pyx_n_u_values __pyx_string_tab[229]
3893
+ #define __pyx_kp_u_var __pyx_string_tab[230]
3894
+ #define __pyx_n_u_var_2 __pyx_string_tab[231]
3895
+ #define __pyx_n_u_var_name __pyx_string_tab[232]
3896
+ #define __pyx_n_u_var_names __pyx_string_tab[233]
3897
+ #define __pyx_kp_u_var_nodes __pyx_string_tab[234]
3898
+ #define __pyx_n_u_x __pyx_string_tab[235]
3899
+ #define __pyx_n_u_xs __pyx_string_tab[236]
3900
+ #define __pyx_n_u_xs_list __pyx_string_tab[237]
3901
+ #define __pyx_n_u_y __pyx_string_tab[238]
3902
+ #define __pyx_n_u_ys __pyx_string_tab[239]
3903
+ #define __pyx_n_u_ys_list __pyx_string_tab[240]
3904
+ #define __pyx_n_u_zero __pyx_string_tab[241]
3908
3905
  /* #### Code section: module_state_clear ### */
3909
3906
  #if CYTHON_USE_MODULE_STATE
3910
3907
  static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
@@ -3965,7 +3962,7 @@ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
3965
3962
  Py_CLEAR(clear_module_state->__pyx_type_2ck_7circuit_11_circuit_cy___pyx_scope_struct_10_genexpr);
3966
3963
  for (int i=0; i<8; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
3967
3964
  for (int i=0; i<49; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
3968
- for (int i=0; i<243; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
3965
+ for (int i=0; i<242; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
3969
3966
  Py_CLEAR(clear_module_state->__pyx_int_0);
3970
3967
  Py_CLEAR(clear_module_state->__pyx_int_1);
3971
3968
  Py_CLEAR(clear_module_state->__pyx_int_16976299);
@@ -4052,7 +4049,7 @@ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void
4052
4049
  Py_VISIT(traverse_module_state->__pyx_type_2ck_7circuit_11_circuit_cy___pyx_scope_struct_10_genexpr);
4053
4050
  for (int i=0; i<8; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
4054
4051
  for (int i=0; i<49; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
4055
- for (int i=0; i<243; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
4052
+ for (int i=0; i<242; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
4056
4053
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_0);
4057
4054
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_1);
4058
4055
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_16976299);
@@ -8195,7 +8192,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
8195
8192
  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 */
8196
8193
 
8197
8194
  /* "ck/circuit/_circuit_cy.pyx":364
8198
- * for op in reversed(self.ops):
8195
+ * for op in self.ops:
8199
8196
  * op_name = node_name[id(op)]
8200
8197
  * args_str = ' '.join(node_name[id(arg)] for arg in op.args) # <<<<<<<<<<<<<<
8201
8198
  * print(f'{next_prefix}{op_name}: {args_str}')
@@ -9274,7 +9271,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
9274
9271
  * f'{prefix}op nodes: {self.number_of_op_nodes} '
9275
9272
  * f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})' # <<<<<<<<<<<<<<
9276
9273
  * )
9277
- * for op in reversed(self.ops):
9274
+ * for op in self.ops:
9278
9275
  */
9279
9276
  __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)
9280
9277
  __Pyx_GOTREF(__pyx_t_13);
@@ -9323,7 +9320,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
9323
9320
  /* "ck/circuit/_circuit_cy.pyx":362
9324
9321
  * f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})'
9325
9322
  * )
9326
- * for op in reversed(self.ops): # <<<<<<<<<<<<<<
9323
+ * for op in self.ops: # <<<<<<<<<<<<<<
9327
9324
  * op_name = node_name[id(op)]
9328
9325
  * args_str = ' '.join(node_name[id(arg)] for arg in op.args)
9329
9326
  */
@@ -9332,13 +9329,8 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
9332
9329
  __PYX_ERR(0, 362, __pyx_L1_error)
9333
9330
  }
9334
9331
  __pyx_t_1 = __pyx_v_self->ops; __Pyx_INCREF(__pyx_t_1);
9335
- __pyx_t_8 = __Pyx_PyList_GET_SIZE(__pyx_t_1);
9336
- #if !CYTHON_ASSUME_SAFE_SIZE
9337
- if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 362, __pyx_L1_error)
9338
- #endif
9339
- --__pyx_t_8;
9332
+ __pyx_t_8 = 0;
9340
9333
  for (;;) {
9341
- if (__pyx_t_8 < 0) break;
9342
9334
  {
9343
9335
  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
9344
9336
  #if !CYTHON_ASSUME_SAFE_SIZE
@@ -9347,7 +9339,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
9347
9339
  if (__pyx_t_8 >= __pyx_temp) break;
9348
9340
  }
9349
9341
  __pyx_t_14 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_8);
9350
- --__pyx_t_8;
9342
+ ++__pyx_t_8;
9351
9343
  if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 362, __pyx_L1_error)
9352
9344
  __Pyx_GOTREF(__pyx_t_14);
9353
9345
  __Pyx_XDECREF_SET(__pyx_v_op, __pyx_t_14);
@@ -9355,7 +9347,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
9355
9347
 
9356
9348
  /* "ck/circuit/_circuit_cy.pyx":363
9357
9349
  * )
9358
- * for op in reversed(self.ops):
9350
+ * for op in self.ops:
9359
9351
  * op_name = node_name[id(op)] # <<<<<<<<<<<<<<
9360
9352
  * args_str = ' '.join(node_name[id(arg)] for arg in op.args)
9361
9353
  * print(f'{next_prefix}{op_name}: {args_str}')
@@ -9379,7 +9371,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
9379
9371
  __pyx_t_2 = 0;
9380
9372
 
9381
9373
  /* "ck/circuit/_circuit_cy.pyx":364
9382
- * for op in reversed(self.ops):
9374
+ * for op in self.ops:
9383
9375
  * op_name = node_name[id(op)]
9384
9376
  * args_str = ' '.join(node_name[id(arg)] for arg in op.args) # <<<<<<<<<<<<<<
9385
9377
  * print(f'{next_prefix}{op_name}: {args_str}')
@@ -9437,7 +9429,7 @@ static PyObject *__pyx_pf_2ck_7circuit_11_circuit_cy_7Circuit_30dump(struct __py
9437
9429
  /* "ck/circuit/_circuit_cy.pyx":362
9438
9430
  * f'(arcs: {self.number_of_arcs}, ops: {self.number_of_operations})'
9439
9431
  * )
9440
- * for op in reversed(self.ops): # <<<<<<<<<<<<<<
9432
+ * for op in self.ops: # <<<<<<<<<<<<<<
9441
9433
  * op_name = node_name[id(op)]
9442
9434
  * args_str = ' '.join(node_name[id(arg)] for arg in op.args)
9443
9435
  */
@@ -28897,7 +28889,6 @@ static const __Pyx_StringTabEntry __pyx_string_tab[] = {
28897
28889
  {__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 */
28898
28890
  {__pyx_k_result, sizeof(__pyx_k_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_result */
28899
28891
  {__pyx_k_return, sizeof(__pyx_k_return), 0, 1, 1}, /* PyObject cname: __pyx_n_u_return */
28900
- {__pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reversed */
28901
28892
  {__pyx_k_self, sizeof(__pyx_k_self), 0, 1, 1}, /* PyObject cname: __pyx_n_u_self */
28902
28893
  {__pyx_k_self_multiply, sizeof(__pyx_k_self_multiply), 0, 1, 1}, /* PyObject cname: __pyx_n_u_self_multiply */
28903
28894
  {__pyx_k_send, sizeof(__pyx_k_send), 0, 1, 1}, /* PyObject cname: __pyx_n_u_send */
@@ -28947,7 +28938,6 @@ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
28947
28938
  __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 327, __pyx_L1_error)
28948
28939
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_id); if (!__pyx_builtin_id) __PYX_ERR(0, 335, __pyx_L1_error)
28949
28940
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 355, __pyx_L1_error)
28950
- __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 362, __pyx_L1_error)
28951
28941
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 424, __pyx_L1_error)
28952
28942
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_super); if (!__pyx_builtin_super) __PYX_ERR(0, 473, __pyx_L1_error)
28953
28943
  return 0;
@@ -29173,7 +29163,7 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
29173
29163
  __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;
29174
29164
  }
29175
29165
  {
29176
- const __Pyx_PyCode_New_function_description descr = {1, 0, 4, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 304, 499};
29166
+ const __Pyx_PyCode_New_function_description descr = {1, 0, 4, 16, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 304, 495};
29177
29167
  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};
29178
29168
  __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;
29179
29169
  }
Binary file
@@ -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 reversed(self.ops):
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}')
ck/circuit/_circuit_py.py CHANGED
@@ -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 reversed(self.ops):
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 circuit compiler is a function with this signature.
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. Default is to use all circuit variables, in index order.
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: