Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@Jim137
Copy link
Owner

@Jim137 Jim137 commented Nov 21, 2025

This pull request introduces several improvements and new features to the QKAN project, focusing on enhanced citation support, improved documentation, expanded optional dependencies, and major upgrades to the handling of data types in the core QKAN implementation. The most significant changes include support for specifying compute and parameter data types throughout the quantum simulation layers, new informational utilities, and updated citation and documentation to reflect the latest software release.

Dependency updates:

  • Added transformers and torchvision to the optional documentation dependencies in pyproject.toml and included transformers in requirements-dev.txt.

Core QKAN functionality and API improvements:

  • Introduced c_dtype (compute dtype) and p_dtype (parameter dtype) options to QKANLayer and QKAN, allowing explicit control over floating point and complex types for tensors and parameters. All relevant tensor initializations and operations now respect these dtypes for improved numerical control and compatibility.

New informational utilities:

  • Added src/qkan/info.py with utility functions (print0, print_banner, print_version, get_dist_info) for consistent logging, version display, and distributed training support. These are now imported and exposed in the main package.

Algorithmic and usability improvements:

  • Enhanced fit_from_qkan in KAN to support early stopping based on loss tolerance and configurable maximum iterations, making training more robust and flexible.

These changes collectively improve the usability, reproducibility, and configurability of the QKAN codebase, especially for research and publication purposes.

Jim137 and others added 16 commits October 25, 2025 03:45
* Initial plan

* Optimize performance: remove unnecessary clones, fix redundant zero_grad, and improve tensor operations

Co-authored-by: Jim137 <[email protected]>

* Additional optimizations: improve h_gate computation and reuse sum computations in regularization

Co-authored-by: Jim137 <[email protected]>

* Address code review feedback: fix dtype parameter and use named constant

Co-authored-by: Jim137 <[email protected]>

* Fix dtype consistency across all DQStateVector gate operations

Co-authored-by: Jim137 <[email protected]>

* Improve numerical precision and add dtype validation for tensor operations

Co-authored-by: Jim137 <[email protected]>

* fix requirements-dev

* fix group when preact trainable

* fix lint

* fix mypy check

---------

Co-authored-by: J.-C. Jiang <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Jim137 <[email protected]>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances the QKAN project with comprehensive dtype management, new utility functions, and expanded documentation. The core changes introduce explicit control over compute and parameter data types throughout the quantum simulation layers, enabling better numerical precision and hardware compatibility.

Key changes:

  • Added c_dtype (compute) and p_dtype (parameter) options to QKANLayer and QKAN for explicit dtype control across quantum operations
  • Introduced info.py module with distributed training utilities (print0, print_banner, print_version, get_dist_info)
  • Enhanced fit_from_qkan in KAN with configurable early stopping based on loss tolerance and maximum iterations

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/qkan/torch_qc.py Added dtype parameters to gate functions, optimized Hadamard gate constant computation, implemented Pauli X/Z gates, added fast_measure parameter to measurement functions
src/qkan/solver.py Refactored internal encoding functions with underscore prefix, threaded dtype parameter through all quantum state operations, updated documentation for shape parameters
src/qkan/qkan.py Introduced c_dtype/p_dtype parameters throughout layer initialization, optimized tensor operations (detach vs clone), integrated distributed training support via info module
src/qkan/kan.py Enhanced fit_from_qkan with early stopping mechanism using configurable max_iter and tolerance parameters
src/qkan/info.py New utility module providing distributed training helpers and version display functions (contains implementation issues)
src/qkan/init.py Updated version to 0.1.3, exported new info module functions
requirements-dev.txt Added transformers==4.57.1 dependency
pyproject.toml Added transformers and torchvision to optional doc dependencies
docs/index.rst Updated citation text and added software citation entry
README.md Added Zenodo DOI badge and software citation entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Jim137 Jim137 merged commit 9b2cdb8 into master Nov 21, 2025
3 checks passed
@Jim137 Jim137 deleted the dev branch November 21, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants