Skip to content

[open-systems] More classical data types#1717

Merged
mpharrigan merged 12 commits intoquantumlib:mainfrom
mpharrigan:2025-09/all-cdtypes
Nov 18, 2025
Merged

[open-systems] More classical data types#1717
mpharrigan merged 12 commits intoquantumlib:mainfrom
mpharrigan:2025-09/all-cdtypes

Conversation

@mpharrigan
Copy link
Copy Markdown
Collaborator

Some ideas on how to handle the fact that for a given encoding we usually want both a quantum data type and classical data type. For example, QInt and CInt both encode mathematical integers into bits or qubits in the same way but in a circuit we want to distinguish between a quantum integer and a classical integer.

  • Introduce BitEncoding abstract base class
  • Each data type "has a" BitEncoding
  • Shimming for backwards compatibility
  • Pretty easy to make data types based purely on composition

I think it's important to have distinct objects for common quantum and classical data types e.g. QBit CBit QInt CInt. Maybe it's annoying to always have to define two classes for each BitEncoding (the quantum and classical one). You could use something like the ClassicalVersion meta-data-type in this PR. I'm worried that: right now data type compatibility is dt1 == dt2 but if we have ClassicalVersion(QInt) representing the same thing as CInt it gets complicated. Generally, I'd prioritize making the end user (quantum programmer)'s life easier with top-level quantum and classical versions of everything at the expense of the "developer" (introducer of new quantum data types) having to do some boilerplate.

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Copy Markdown
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

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

Can you please add classical types for QGF and QGFPoly as well ? QGF is more pressing for my use case, so I'll appreciate if you can do that in this PR and merge it.

@mpharrigan mpharrigan changed the title [prototype] More classical data types [open-systems] More classical data types Nov 12, 2025
@mpharrigan mpharrigan marked this pull request as ready for review November 18, 2025 18:21
@mpharrigan
Copy link
Copy Markdown
Collaborator Author

This has a classical version of every type now

@mpharrigan mpharrigan merged commit 7f2b156 into quantumlib:main Nov 18, 2025
8 checks passed
@mpharrigan mpharrigan added this to the v0.7 milestone Nov 19, 2025
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