compiled-knowledge 4.0.0a9__cp312-cp312-win_amd64.whl → 4.0.0a10__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.

Files changed (30) hide show
  1. ck/circuit/circuit.c +38860 -0
  2. ck/circuit/circuit.cp312-win_amd64.pyd +0 -0
  3. ck/circuit/circuit.pyx +9 -3
  4. ck/circuit_compiler/cython_vm_compiler/_compiler.c +17373 -0
  5. ck/circuit_compiler/cython_vm_compiler/_compiler.cp312-win_amd64.pyd +0 -0
  6. ck/pgm.py +78 -37
  7. ck/pgm_circuit/pgm_circuit.py +13 -9
  8. ck/pgm_circuit/program_with_slotmap.py +6 -4
  9. ck/pgm_compiler/ace/ace.py +48 -4
  10. ck/pgm_compiler/factor_elimination.py +6 -4
  11. ck/pgm_compiler/recursive_conditioning.py +8 -3
  12. ck/pgm_compiler/support/circuit_table/circuit_table.c +16042 -0
  13. ck/pgm_compiler/support/circuit_table/circuit_table.cp312-win_amd64.pyd +0 -0
  14. ck/pgm_compiler/support/clusters.py +1 -1
  15. ck/pgm_compiler/variable_elimination.py +3 -3
  16. ck/probability/empirical_probability_space.py +3 -0
  17. ck/probability/pgm_probability_space.py +32 -0
  18. ck/probability/probability_space.py +66 -12
  19. ck/sampling/sampler_support.py +1 -1
  20. ck/sampling/uniform_sampler.py +10 -4
  21. ck/sampling/wmc_direct_sampler.py +4 -2
  22. ck/sampling/wmc_gibbs_sampler.py +6 -0
  23. ck/sampling/wmc_metropolis_sampler.py +7 -1
  24. ck/sampling/wmc_rejection_sampler.py +2 -0
  25. ck/utils/iter_extras.py +9 -6
  26. {compiled_knowledge-4.0.0a9.dist-info → compiled_knowledge-4.0.0a10.dist-info}/METADATA +1 -1
  27. {compiled_knowledge-4.0.0a9.dist-info → compiled_knowledge-4.0.0a10.dist-info}/RECORD +30 -26
  28. {compiled_knowledge-4.0.0a9.dist-info → compiled_knowledge-4.0.0a10.dist-info}/WHEEL +0 -0
  29. {compiled_knowledge-4.0.0a9.dist-info → compiled_knowledge-4.0.0a10.dist-info}/licenses/LICENSE.txt +0 -0
  30. {compiled_knowledge-4.0.0a9.dist-info → compiled_knowledge-4.0.0a10.dist-info}/top_level.txt +0 -0
Binary file
ck/circuit/circuit.pyx CHANGED
@@ -334,6 +334,7 @@ cdef class Circuit:
334
334
  prefix: str = '',
335
335
  indent: str = ' ',
336
336
  var_names: Optional[List[str]] = None,
337
+ include_consts: bool = False,
337
338
  ) -> None:
338
339
  """
339
340
  Print a dump of the Circuit.
@@ -343,6 +344,7 @@ cdef class Circuit:
343
344
  prefix: optional prefix for indenting all lines.
344
345
  indent: additional prefix to use for extra indentation.
345
346
  var_names: optional variable names to show.
347
+ include_consts: if true, then constant values are dumped.
346
348
  """
347
349
 
348
350
  next_prefix: str = prefix + indent
@@ -367,10 +369,14 @@ cdef class Circuit:
367
369
  elif var.is_const():
368
370
  print(f'{next_prefix}var[{var.idx}]: {var.const.value}')
369
371
 
370
- print(f'{prefix}const nodes: {self.number_of_consts}')
372
+ if include_consts:
373
+ print(f'{prefix}const nodes: {self.number_of_consts}')
374
+ for const in self._const_map.values():
375
+ print(f'{next_prefix}{const.value!r}')
376
+
377
+ # Add const nodes to the node_name dict
371
378
  for const in self._const_map.values():
372
- node_name[id(const)] = str(const.value)
373
- print(f'{next_prefix}{const.value}')
379
+ node_name[id(const)] = repr(const.value)
374
380
 
375
381
  # Add op nodes to the node_name dict
376
382
  for i, op in enumerate(self.ops):