Skip to content

Split up datatype definition modules#1835

Merged
mpharrigan merged 1 commit intoquantumlib:mainfrom
mpharrigan:2026-04/dtype
Apr 2, 2026
Merged

Split up datatype definition modules#1835
mpharrigan merged 1 commit intoquantumlib:mainfrom
mpharrigan:2026-04/dtype

Conversation

@mpharrigan
Copy link
Copy Markdown
Collaborator

Long overdue.

  • prior releases included the qualtran.dtype.XXX aliases for QCDTypes (the data type classes and objects used in your quantum programs)
  • This PR moves the source of truth to private submodules in this package and makes the qualtran._infra.dtype imports into aliases
  • Most people are probably using the qualtran.XXX re-exports anyways, which remain unchanged.

This is just moving code. The only "change" is moving the assert_to_bits test helper is now in the public API.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the quantum data type definitions by moving them from a monolithic file in qualtran/_infra/data_types.py to a new modular package structure under qualtran/dtype. The changes include splitting the types into specialized modules (e.g., _int.py, _fxp.py, _uint.py) and adding comprehensive unit tests for each. A potential issue was identified in the new testing.py utility where the reshape operation may fail when handling symbolic data types, as numpy cannot process symbolic dimensions.

Comment thread qualtran/dtype/testing.py
@mpharrigan mpharrigan merged commit 5ba42c1 into quantumlib:main Apr 2, 2026
9 checks passed
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.

1 participant