Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

radix.py #246

Closed

Conversation

AbdullahKazi500
Copy link

Implementation in UnitaryMatrix Class
The updated UnitaryMatrix class constructor addresses this requirement by allowing the radixes parameter to be either a single integer or a sequence of integers. Here’s how the implementation handles this:

Single Integer Radix:

If radixes is provided as a single integer, the constructor automatically infers the number of qudits in the system based on the dimension of the input matrix.
The single integer radix is then broadcast to create a sequence where each element is the same radix. This sequence matches the inferred number of qudits.
Sequence of Radixes:

If radixes is provided as a sequence, the constructor directly uses this sequence, assuming it correctly specifies the radix for each qudit.
Default Behavior:

If radixes is not provided, the constructor attempts to infer it from the input matrix’s dimension. It checks if the dimension is a power of two or three and assigns corresponding radixes (e.g., [2, 2, ...] for a power of two).
Validation:

The constructor validates the provided or inferred radixes to ensure they are correct and match the dimension of the input matrix.

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.

None yet

2 participants