csdigit 0.3__tar.gz → 0.4__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.
Files changed (87) hide show
  1. {csdigit-0.3 → csdigit-0.4}/.gitignore +4 -0
  2. csdigit-0.4/CHANGELOG.md +19 -0
  3. {csdigit-0.3/src/csdigit.egg-info → csdigit-0.4}/PKG-INFO +1 -2
  4. csdigit-0.4/benches/bench_csd.py +20 -0
  5. csdigit-0.4/benches/verify_output.py +36 -0
  6. {csdigit-0.3 → csdigit-0.4}/docs/conf.py +1 -0
  7. csdigit-0.4/docs/examples/plot_csd_conversion.py +20 -0
  8. csdigit-0.4/docs/examples/plot_csd_distribution.py +30 -0
  9. csdigit-0.4/docs/figures_demo.md +25 -0
  10. {csdigit-0.3 → csdigit-0.4}/docs/index.md +1 -0
  11. {csdigit-0.3 → csdigit-0.4}/mypy.ini +0 -5
  12. {csdigit-0.3 → csdigit-0.4}/setup.cfg +0 -3
  13. csdigit-0.4/src/csdigit/__init__.py +10 -0
  14. {csdigit-0.3 → csdigit-0.4}/src/csdigit/csd.py +8 -0
  15. {csdigit-0.3 → csdigit-0.4/src/csdigit.egg-info}/PKG-INFO +1 -2
  16. {csdigit-0.3 → csdigit-0.4}/src/csdigit.egg-info/SOURCES.txt +7 -1
  17. {csdigit-0.3 → csdigit-0.4}/src/csdigit.egg-info/requires.txt +0 -3
  18. csdigit-0.4/src/csdigit.egg-info/scm_file_list.json +79 -0
  19. csdigit-0.4/src/csdigit.egg-info/scm_version.json +8 -0
  20. csdigit-0.3/CHANGELOG.md +0 -7
  21. csdigit-0.3/IFLOW.md +0 -75
  22. csdigit-0.3/src/csdigit/__init__.py +0 -16
  23. {csdigit-0.3 → csdigit-0.4}/.coveragerc +0 -0
  24. {csdigit-0.3 → csdigit-0.4}/.github/workflows/ci.yml +0 -0
  25. {csdigit-0.3 → csdigit-0.4}/.github/workflows/codecov.yml +0 -0
  26. {csdigit-0.3 → csdigit-0.4}/.github/workflows/jekyll-gh-pages.yml +0 -0
  27. {csdigit-0.3 → csdigit-0.4}/.github/workflows/multi-platforms.yml +0 -0
  28. {csdigit-0.3 → csdigit-0.4}/.github/workflows/python-app.yml +0 -0
  29. {csdigit-0.3 → csdigit-0.4}/.github/workflows/python-package.yml +0 -0
  30. {csdigit-0.3 → csdigit-0.4}/.github/workflows/python-publish.yml +0 -0
  31. {csdigit-0.3 → csdigit-0.4}/.isort.cfg +0 -0
  32. {csdigit-0.3 → csdigit-0.4}/.pre-commit-config.yaml +0 -0
  33. {csdigit-0.3 → csdigit-0.4}/.readthedocs.yml +0 -0
  34. {csdigit-0.3 → csdigit-0.4}/.vscode/settings.json +0 -0
  35. {csdigit-0.3 → csdigit-0.4}/AUTHORS.md +0 -0
  36. {csdigit-0.3 → csdigit-0.4}/CONTRIBUTING.md +0 -0
  37. {csdigit-0.3 → csdigit-0.4}/GEMINI.md +0 -0
  38. {csdigit-0.3 → csdigit-0.4}/LICENSE.txt +0 -0
  39. {csdigit-0.3 → csdigit-0.4}/README.md +0 -0
  40. {csdigit-0.3 → csdigit-0.4}/_config.yml +0 -0
  41. {csdigit-0.3 → csdigit-0.4}/benches/test_bench.py +0 -0
  42. {csdigit-0.3 → csdigit-0.4}/docs/Makefile +0 -0
  43. {csdigit-0.3 → csdigit-0.4}/docs/_static/.gitignore +0 -0
  44. {csdigit-0.3 → csdigit-0.4}/docs/authors.md +0 -0
  45. {csdigit-0.3 → csdigit-0.4}/docs/changelog.md +0 -0
  46. {csdigit-0.3 → csdigit-0.4}/docs/contributing.md +0 -0
  47. {csdigit-0.3 → csdigit-0.4}/docs/license.md +0 -0
  48. {csdigit-0.3 → csdigit-0.4}/docs/readme.md +0 -0
  49. {csdigit-0.3 → csdigit-0.4}/docs/requirements.txt +0 -0
  50. {csdigit-0.3 → csdigit-0.4}/environment.yml +0 -0
  51. {csdigit-0.3 → csdigit-0.4}/experiments/notes.md +0 -0
  52. {csdigit-0.3 → csdigit-0.4}/experiments/random_gen.py +0 -0
  53. {csdigit-0.3 → csdigit-0.4}/pyproject.toml +0 -0
  54. {csdigit-0.3 → csdigit-0.4}/requirements/README.md +0 -0
  55. {csdigit-0.3 → csdigit-0.4}/requirements/default.txt +0 -0
  56. {csdigit-0.3 → csdigit-0.4}/requirements/doc.txt +0 -0
  57. {csdigit-0.3 → csdigit-0.4}/requirements/extras.txt +0 -0
  58. {csdigit-0.3 → csdigit-0.4}/requirements/test.txt +0 -0
  59. {csdigit-0.3 → csdigit-0.4}/requirements.txt +0 -0
  60. {csdigit-0.3 → csdigit-0.4}/setup.py +0 -0
  61. {csdigit-0.3 → csdigit-0.4}/src/csdigit/cli.py +0 -0
  62. {csdigit-0.3 → csdigit-0.4}/src/csdigit/csd_multiplier.py +0 -0
  63. {csdigit-0.3 → csdigit-0.4}/src/csdigit/lcsre.py +0 -0
  64. {csdigit-0.3 → csdigit-0.4}/src/csdigit/py.typed +0 -0
  65. {csdigit-0.3 → csdigit-0.4}/src/csdigit.egg-info/dependency_links.txt +0 -0
  66. {csdigit-0.3 → csdigit-0.4}/src/csdigit.egg-info/not-zip-safe +0 -0
  67. {csdigit-0.3 → csdigit-0.4}/src/csdigit.egg-info/top_level.txt +0 -0
  68. {csdigit-0.3 → csdigit-0.4}/src/pycsd/README +0 -0
  69. {csdigit-0.3 → csdigit-0.4}/src/pycsd/__init__.py +0 -0
  70. {csdigit-0.3 → csdigit-0.4}/src/pycsd/csd/__init__.py +0 -0
  71. {csdigit-0.3 → csdigit-0.4}/src/pycsd/csd/csd.py +0 -0
  72. {csdigit-0.3 → csdigit-0.4}/src/pycsd/csd_orig.py +0 -0
  73. {csdigit-0.3 → csdigit-0.4}/src/pycsd/dev/csd_numbers.py +0 -0
  74. {csdigit-0.3 → csdigit-0.4}/src/pycsd/from_csd +0 -0
  75. {csdigit-0.3 → csdigit-0.4}/src/pycsd/run_tests.py +0 -0
  76. {csdigit-0.3 → csdigit-0.4}/src/pycsd/test/__init__.py +0 -0
  77. {csdigit-0.3 → csdigit-0.4}/src/pycsd/test/decimal_tests.py +0 -0
  78. {csdigit-0.3 → csdigit-0.4}/src/pycsd/test/test_csd_decimals.py +0 -0
  79. {csdigit-0.3 → csdigit-0.4}/src/pycsd/test/test_csd_integers.py +0 -0
  80. {csdigit-0.3 → csdigit-0.4}/src/pycsd/test/test_to_and_fro_10bits.py +0 -0
  81. {csdigit-0.3 → csdigit-0.4}/src/pycsd/to_csd +0 -0
  82. {csdigit-0.3 → csdigit-0.4}/tests/conftest.py +0 -0
  83. {csdigit-0.3 → csdigit-0.4}/tests/test_cli.py +0 -0
  84. {csdigit-0.3 → csdigit-0.4}/tests/test_csd.py +0 -0
  85. {csdigit-0.3 → csdigit-0.4}/tests/test_csd_multiplier.py +0 -0
  86. {csdigit-0.3 → csdigit-0.4}/tests/test_lcsre.py +0 -0
  87. {csdigit-0.3 → csdigit-0.4}/tox.ini +0 -0
@@ -176,3 +176,7 @@ MANIFEST
176
176
 
177
177
  # my stuffs
178
178
  .hypothesis
179
+
180
+ # Cache dirs
181
+ .ruff_cache/
182
+ .benchmarks/
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ ## Version 0.4 (2026-07-16)
4
+
5
+ ### Documentation
6
+ - **Sphinx docs with plot_directive and svgbob**: Enabled matplotlib `plot_directive` for auto-generated figures and `sphinxcontrib.svgbob` for ASCII-to-SVG diagrams. Added CSD distribution and conversion example plots under `docs/examples/`. Added svgbob diagram to `csd.py` module docstring. (#a6e57f8)
7
+
8
+ ### Code Cleanup
9
+ - **Removed PyScaffold boilerplate**: Deleted `skeleton.py` and `test_skeleton.py` (unused Fibonacci CLI scaffold). (#27813b4)
10
+ - **Dropped Python < 3.9 compat**: Removed `importlib-metadata` conditional dependency and compat guard from `__init__.py` (project now targets 3.10+). (#27813b4)
11
+ - **Config cleanup**: Removed dead `fibonacci = skeleton:run` entry point from `setup.cfg` and unused `ignore_missing_imports` from `mypy.ini`. (#27813b4)
12
+ - **Removed stale files**: Deleted `IFLOW.md` and duplicate `LICENSE`. (#27813b4)
13
+ - **Updated `.gitignore`**: Added `.ruff_cache/` and `.benchmarks/`. (#27813b4)
14
+
15
+ ### Build & CI
16
+ - **CI repair**: Fixed broken `entry_points` configuration and lingering `skeleton` imports breaking the CI pipeline. (#0b2459b)
17
+
18
+ ### Testing & Code Quality
19
+ - **Benchmark & verification scripts**: Added `benches/bench_csd.py` and `benches/verify_output.py` for performance tracking and output verification. (#09da08a)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csdigit
3
- Version: 0.3
3
+ Version: 0.4
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: Wai-Shing Luk
@@ -12,7 +12,6 @@ Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Programming Language :: Python
13
13
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
14
  License-File: LICENSE.txt
15
- Requires-Dist: importlib-metadata; python_version < "3.9"
16
15
  Provides-Extra: testing
17
16
  Requires-Dist: setuptools; extra == "testing"
18
17
  Requires-Dist: pytest; extra == "testing"
@@ -0,0 +1,20 @@
1
+ import timeit
2
+ from csdigit.csd import to_csd, to_csd_i, to_decimal, to_decimal_using_pow, to_csdnnz
3
+
4
+ def bench(name, stmt, globals_dict=None, number=50000):
5
+ if globals_dict is None:
6
+ globals_dict = globals()
7
+ t = timeit.timeit(stmt, globals=globals_dict, number=number)
8
+ ns_per_op = t * 1e9 / number
9
+ print(f" {name:<30} {ns_per_op:>8.1f} ns/op ({number} iters)")
10
+
11
+ print("=== CSD Benchmarks (Python) ===")
12
+ bench("to_csd(28.5, 10)", "to_csd(28.5, 10)")
13
+ bench("to_csd_i(28)", "to_csd_i(28)")
14
+ bench("to_csdnnz(28.5, 4)", "to_csdnnz(28.5, 4)")
15
+ bench("to_decimal('+00-00.+0')", "to_decimal('+00-00.+0')")
16
+ bench("to_decimal_using_pow('+00-00')", "to_decimal_using_pow('+00-00')")
17
+ bench("to_csd(0.0, 10) [zero]", "to_csd(0.0, 10)")
18
+ bench("to_csd(-28.5, 10) [neg]", "to_csd(-28.5, 10)")
19
+ bench("to_csd(0.5, 10) [small]", "to_csd(0.5, 10)")
20
+ bench("to_csd(1024.75, 10) [large]", "to_csd(1024.75, 10)")
@@ -0,0 +1,36 @@
1
+ from csdigit.csd import to_csd, to_csd_i, to_decimal, to_decimal_using_pow, to_csdnnz, to_csdnnz_i
2
+
3
+ print("=== to_csd (float) ===")
4
+ for v, p in [(28.5,2), (-0.5,2), (0.0,2), (2.5,4), (0.0,0), (7.0,0), (-7.0,0), (28.5,0)]:
5
+ res = to_csd(v, p)
6
+ print(f' to_csd({v}, {p}) = "{res}"')
7
+
8
+ print()
9
+ print("=== to_csd_i (integer) ===")
10
+ for v in [28, 0, -28, 7, -7, 1, -1]:
11
+ res = to_csd_i(v)
12
+ print(f' to_csd_i({v}) = "{res}"')
13
+
14
+ print()
15
+ print("=== to_decimal ===")
16
+ for s in ["+00-00.+", "0.-", "0", "0.0", "0.+", "0.-", "0.++", "0.-+", "+00-00"]:
17
+ res = to_decimal(s)
18
+ print(f' to_decimal("{s}") = {res}')
19
+
20
+ print()
21
+ print("=== to_decimal_using_pow (integer CSD) ===")
22
+ for s in ["+00-00", "0", "-00+00"]:
23
+ res = to_decimal_using_pow(s)
24
+ print(f' to_decimal_using_pow("{s}") = {res}')
25
+
26
+ print()
27
+ print("=== to_csdnnz (float, limited nnz) ===")
28
+ for v, n in [(28.5,4), (-0.5,4), (0.0,4), (0.5,4), (0.0,0), (28.5,2), (28.5,1)]:
29
+ res = to_csdnnz(v, n)
30
+ print(f' to_csdnnz({v}, {n}) = "{res}"')
31
+
32
+ print()
33
+ print("=== to_csdnnz_i (integer, limited nnz) ===")
34
+ for v, n in [(28,4), (0,4)]:
35
+ res = to_csdnnz_i(v, n)
36
+ print(f' to_csdnnz_i({v}, {n}) = "{res}"')
@@ -69,6 +69,7 @@ extensions = [
69
69
  "sphinx.ext.ifconfig",
70
70
  "sphinx.ext.mathjax",
71
71
  "sphinx.ext.napoleon",
72
+ "sphinxcontrib.svgbob",
72
73
  ]
73
74
 
74
75
  # Add any paths that contain templates here, relative to this directory.
@@ -0,0 +1,20 @@
1
+ """
2
+ CSD Conversion Examples
3
+ ========================
4
+
5
+ Demonstrates CSD representation of various numbers.
6
+ """
7
+ import matplotlib.pyplot as plt
8
+
9
+ from csdigit.csd import to_csd
10
+
11
+ test_values = [0.5, 1.0, 7.5, 15.25, 28.5, 63.125, 127.0625, 255.5]
12
+
13
+ plt.figure(figsize=(8, 5))
14
+ x_pos = range(len(test_values))
15
+ csd_strs = [to_csd(v, 4) for v in test_values]
16
+ plt.bar(x_pos, test_values, color="lightcoral", alpha=0.7)
17
+ plt.xticks(x_pos, [f"{v}\n({s})" for v, s in zip(test_values, csd_strs)], fontsize=8)
18
+ plt.ylabel("Decimal Value")
19
+ plt.title("CSD Representation of Various Numbers")
20
+ plt.grid(True, alpha=0.3, axis="y")
@@ -0,0 +1,30 @@
1
+ """
2
+ CSD Non-zero Digit Distribution
3
+ ================================
4
+
5
+ Shows the distribution of non-zero digits in CSD representation
6
+ for integers from 0 to 255.
7
+ """
8
+ import matplotlib.pyplot as plt
9
+
10
+ from csdigit.csd import to_csd
11
+
12
+
13
+ def count_nonzero(csd_str):
14
+ """Count non-zero digits in CSD string (excluding decimal point)."""
15
+ return sum(1 for c in csd_str if c in "+-")
16
+
17
+
18
+ n_values = list(range(256))
19
+ nnz_counts = []
20
+ for n in n_values:
21
+ csd = to_csd(float(n), 0)
22
+ nnz = count_nonzero(csd.rstrip("0").rstrip("."))
23
+ nnz_counts.append(nnz)
24
+
25
+ plt.figure(figsize=(8, 5))
26
+ plt.bar(n_values, nnz_counts, width=1.0, color="steelblue", alpha=0.7)
27
+ plt.xlabel("Integer Value")
28
+ plt.ylabel("Non-zero CSD Digits")
29
+ plt.title("Distribution of Non-zero Digits in CSD Representation")
30
+ plt.grid(True, alpha=0.3, axis="y")
@@ -0,0 +1,25 @@
1
+ # Figures Demo
2
+
3
+ Auto-generated figures demonstrating csdigit functionality.
4
+
5
+ ## CSD Non-zero Digit Distribution
6
+
7
+ ```{plot} examples/plot_csd_distribution.py
8
+ ```
9
+
10
+ ## CSD Conversion Examples
11
+
12
+ ```{plot} examples/plot_csd_conversion.py
13
+ ```
14
+
15
+ ### Inline Plot Example
16
+
17
+ ```{plot}
18
+ import matplotlib.pyplot as plt
19
+ import numpy as np
20
+
21
+ x = np.linspace(0, 2 * np.pi, 100)
22
+ plt.plot(x, np.sin(x))
23
+ plt.title("Simple Sine Wave")
24
+ plt.grid(True, alpha=0.3)
25
+ ```
@@ -22,6 +22,7 @@ Contributions & Help <contributing>
22
22
  License <license>
23
23
  Authors <authors>
24
24
  Changelog <changelog>
25
+ Figures Demo <figures_demo>
25
26
  Module Reference <api/modules>
26
27
  ```
27
28
 
@@ -5,17 +5,12 @@ warn_unused_configs = True
5
5
  [mypy-setuptools.*]
6
6
  ignore_missing_imports = True
7
7
 
8
- [mypy-networkx.*]
9
8
  ignore_missing_imports = True
10
9
 
11
- [mypy-numpy.*]
12
10
  ignore_missing_imports = True
13
11
 
14
- [mypy-scipy.*]
15
12
  ignore_missing_imports = True
16
13
 
17
- [mypy-Cython.*]
18
14
  ignore_missing_imports = True
19
15
 
20
- [mypy-json.*]
21
16
  ignore_missing_imports = True
@@ -22,7 +22,6 @@ include_package_data = True
22
22
  package_dir =
23
23
  =src
24
24
  install_requires =
25
- importlib-metadata; python_version<"3.9"
26
25
 
27
26
  [options.packages.find]
28
27
  where = src
@@ -37,8 +36,6 @@ testing =
37
36
  pytest-benchmark
38
37
  hypothesis
39
38
 
40
- [options.entry_points]
41
-
42
39
  [tool:pytest]
43
40
  norecursedirs =
44
41
  dist
@@ -0,0 +1,10 @@
1
+ from importlib.metadata import PackageNotFoundError, version
2
+
3
+ try:
4
+ # Change here if project is renamed and does not equal the package name
5
+ dist_name = __name__
6
+ __version__ = version(dist_name)
7
+ except PackageNotFoundError: # pragma: no cover
8
+ __version__ = "unknown"
9
+ finally:
10
+ del version, PackageNotFoundError
@@ -5,6 +5,14 @@ Provides functions to convert between decimal numbers and Canonical Signed Digit
5
5
  (CSD) representation — a signed-digit representation using only ``+``, ``-``,
6
6
  and ``0`` symbols with no consecutive non-zero digits.
7
7
 
8
+ .. svgbob::
9
+ :align: center
10
+
11
+ Decimal ──► Binary ──► CSD
12
+ │ │
13
+ │ │
14
+ ◄──────────────────────┘
15
+
8
16
  Functions:
9
17
  to_csd: Convert a decimal float to CSD string with specified precision.
10
18
  to_csd_i: Convert an integer to CSD string.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csdigit
3
- Version: 0.3
3
+ Version: 0.4
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: Wai-Shing Luk
@@ -12,7 +12,6 @@ Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Programming Language :: Python
13
13
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
14
  License-File: LICENSE.txt
15
- Requires-Dist: importlib-metadata; python_version < "3.9"
16
15
  Provides-Extra: testing
17
16
  Requires-Dist: setuptools; extra == "testing"
18
17
  Requires-Dist: pytest; extra == "testing"
@@ -7,7 +7,6 @@ AUTHORS.md
7
7
  CHANGELOG.md
8
8
  CONTRIBUTING.md
9
9
  GEMINI.md
10
- IFLOW.md
11
10
  LICENSE.txt
12
11
  README.md
13
12
  _config.yml
@@ -26,17 +25,22 @@ tox.ini
26
25
  .github/workflows/python-package.yml
27
26
  .github/workflows/python-publish.yml
28
27
  .vscode/settings.json
28
+ benches/bench_csd.py
29
29
  benches/test_bench.py
30
+ benches/verify_output.py
30
31
  docs/Makefile
31
32
  docs/authors.md
32
33
  docs/changelog.md
33
34
  docs/conf.py
34
35
  docs/contributing.md
36
+ docs/figures_demo.md
35
37
  docs/index.md
36
38
  docs/license.md
37
39
  docs/readme.md
38
40
  docs/requirements.txt
39
41
  docs/_static/.gitignore
42
+ docs/examples/plot_csd_conversion.py
43
+ docs/examples/plot_csd_distribution.py
40
44
  experiments/notes.md
41
45
  experiments/random_gen.py
42
46
  requirements/README.md
@@ -55,6 +59,8 @@ src/csdigit.egg-info/SOURCES.txt
55
59
  src/csdigit.egg-info/dependency_links.txt
56
60
  src/csdigit.egg-info/not-zip-safe
57
61
  src/csdigit.egg-info/requires.txt
62
+ src/csdigit.egg-info/scm_file_list.json
63
+ src/csdigit.egg-info/scm_version.json
58
64
  src/csdigit.egg-info/top_level.txt
59
65
  src/pycsd/README
60
66
  src/pycsd/__init__.py
@@ -1,7 +1,4 @@
1
1
 
2
- [:python_version < "3.9"]
3
- importlib-metadata
4
-
5
2
  [testing]
6
3
  setuptools
7
4
  pytest
@@ -0,0 +1,79 @@
1
+ {
2
+ "files": [
3
+ ".gitignore",
4
+ "environment.yml",
5
+ "README.md",
6
+ "CHANGELOG.md",
7
+ "CONTRIBUTING.md",
8
+ "requirements.txt",
9
+ "GEMINI.md",
10
+ ".readthedocs.yml",
11
+ "AUTHORS.md",
12
+ "_config.yml",
13
+ "LICENSE.txt",
14
+ ".isort.cfg",
15
+ "tox.ini",
16
+ "mypy.ini",
17
+ "pyproject.toml",
18
+ ".coveragerc",
19
+ "setup.py",
20
+ ".pre-commit-config.yaml",
21
+ "setup.cfg",
22
+ "src/pycsd/from_csd",
23
+ "src/pycsd/run_tests.py",
24
+ "src/pycsd/README",
25
+ "src/pycsd/to_csd",
26
+ "src/pycsd/csd_orig.py",
27
+ "src/pycsd/__init__.py",
28
+ "src/pycsd/test/test_csd_decimals.py",
29
+ "src/pycsd/test/test_to_and_fro_10bits.py",
30
+ "src/pycsd/test/decimal_tests.py",
31
+ "src/pycsd/test/test_csd_integers.py",
32
+ "src/pycsd/test/__init__.py",
33
+ "src/pycsd/dev/csd_numbers.py",
34
+ "src/pycsd/csd/csd.py",
35
+ "src/pycsd/csd/__init__.py",
36
+ "src/csdigit/lcsre.py",
37
+ "src/csdigit/csd.py",
38
+ "src/csdigit/csd_multiplier.py",
39
+ "src/csdigit/cli.py",
40
+ "src/csdigit/py.typed",
41
+ "src/csdigit/__init__.py",
42
+ "benches/bench_csd.py",
43
+ "benches/verify_output.py",
44
+ "benches/test_bench.py",
45
+ ".github/workflows/python-app.yml",
46
+ ".github/workflows/jekyll-gh-pages.yml",
47
+ ".github/workflows/python-publish.yml",
48
+ ".github/workflows/python-package.yml",
49
+ ".github/workflows/codecov.yml",
50
+ ".github/workflows/ci.yml",
51
+ ".github/workflows/multi-platforms.yml",
52
+ ".vscode/settings.json",
53
+ "experiments/notes.md",
54
+ "experiments/random_gen.py",
55
+ "tests/conftest.py",
56
+ "tests/test_lcsre.py",
57
+ "tests/test_csd_multiplier.py",
58
+ "tests/test_csd.py",
59
+ "tests/test_cli.py",
60
+ "requirements/default.txt",
61
+ "requirements/README.md",
62
+ "requirements/extras.txt",
63
+ "requirements/doc.txt",
64
+ "requirements/test.txt",
65
+ "docs/conf.py",
66
+ "docs/Makefile",
67
+ "docs/contributing.md",
68
+ "docs/authors.md",
69
+ "docs/requirements.txt",
70
+ "docs/figures_demo.md",
71
+ "docs/readme.md",
72
+ "docs/changelog.md",
73
+ "docs/index.md",
74
+ "docs/license.md",
75
+ "docs/_static/.gitignore",
76
+ "docs/examples/plot_csd_conversion.py",
77
+ "docs/examples/plot_csd_distribution.py"
78
+ ]
79
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.4",
3
+ "distance": 0,
4
+ "node": "gae225223c413eca809051c920f8f82bb2be11055",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-07-16"
8
+ }
csdigit-0.3/CHANGELOG.md DELETED
@@ -1,7 +0,0 @@
1
- # Changelog
2
-
3
- ## Version 0.1 (development)
4
-
5
- - Feature A added
6
- - FIX: nasty bug #1729 fixed
7
- - add your changes here!
csdigit-0.3/IFLOW.md DELETED
@@ -1,75 +0,0 @@
1
- # CSDigit iFlow Context
2
-
3
- ## 项目概述
4
-
5
- CSDigit 是一个 Python 库,用于在十进制数和规范符号数字 (Canonical Signed Digit, CSD) 表示之间进行转换。CSD 是一种特殊的符号数字表示法,其中每个数字被限制为 -1、0 或 1,且不允许连续的非零数字。这种表示法在数字信号处理应用中特别有用,例如滤波器设计,因为它能通过使用简单的加法器和减法器来实现高效算术运算。
6
-
7
- ## 主要功能
8
-
9
- - `to_csd`: 将十进制数转换为 CSD 字符串
10
- - `to_csd_i`: 将整数转换为 CSD 字符串
11
- - `to_decimal`: 将 CSD 字符串转换为十进制数
12
- - `to_csdnnz`: 具有最大非零位数限制的 CSD 转换
13
- - `to_csdnnz_i`: 整数版本的 CSD 转换,带非零位数限制
14
- - `longest_repeated_substring`: 查找 CSD 字符串中的最长重复子串
15
- - `generate_csd_multiplier`: 生成 CSD 乘法器的 Verilog 代码
16
-
17
- ## 项目结构
18
-
19
- - `src/csdigit/`: 源代码目录
20
- - `csd.py`: 核心 CSD 转换函数
21
- - `cli.py`: 命令行接口
22
- - `csd_multiplier.py`: CSD 乘法器 Verilog 代码生成
23
- - `lcsre.py`: 最长重复子串查找算法
24
- - `tests/`: 测试代码
25
- - `docs/`: 文档
26
- - `requirements/`: 依赖配置
27
-
28
- ## 构建和运行
29
-
30
- ### 安装依赖
31
- ```bash
32
- pip install -r requirements.txt
33
- ```
34
-
35
- ### 开发安装
36
- ```bash
37
- pip install -e .
38
- ```
39
-
40
- ### 运行测试
41
- ```bash
42
- pytest tests/
43
- ```
44
-
45
- ### 使用命令行工具
46
- ```bash
47
- # 转换十进制到 CSD
48
- python -m csdigit.cli -c 28.5 -p 2
49
-
50
- # 转换 CSD 到十进制
51
- python -m csdigit.cli -d "+00-00.+"
52
-
53
- # 使用非零位数限制
54
- python -m csdigit.cli -f 28.5 -z 4
55
- ```
56
-
57
- ## 开发约定
58
-
59
- - 遵循 Python PEP 8 代码风格
60
- - 使用 pytest 进行测试
61
- - 使用 doctest 进行函数示例测试
62
- - 使用 type hints 提供类型信息
63
- - 遵循语义化版本控制
64
-
65
- ## 测试
66
-
67
- 项目包含全面的单元测试,使用 pytest 和 hypothesis 进行属性测试。主要测试包括:
68
- - CSD 转换的正确性
69
- - 反向转换验证 (decimal -> CSD -> decimal)
70
- - 特殊情况处理 (零值、负数)
71
- - 边界条件测试
72
-
73
- ## 许可证
74
-
75
- MIT 许可证
@@ -1,16 +0,0 @@
1
- import sys
2
-
3
- if sys.version_info[:2] >= (3, 8):
4
- # TODO: Import directly (no need for conditional) when `python_requires = >= 3.9`
5
- from importlib.metadata import PackageNotFoundError, version # pragma: no cover
6
- else:
7
- from importlib_metadata import PackageNotFoundError, version # pragma: no cover
8
-
9
- try:
10
- # Change here if project is renamed and does not equal the package name
11
- dist_name = __name__
12
- __version__ = version(dist_name)
13
- except PackageNotFoundError: # pragma: no cover
14
- __version__ = "unknown"
15
- finally:
16
- del version, PackageNotFoundError
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes