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

embed(::NotCompositeBasis, 1, operator) #159

Open
Krastanov opened this issue Apr 12, 2024 · 2 comments
Open

embed(::NotCompositeBasis, 1, operator) #159

Krastanov opened this issue Apr 12, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Krastanov
Copy link
Collaborator

I have some generic code looking like this:

embed(SpinBasis(1//2)^n, i, gate)

that occasionally at runtime ends up being embed(SpinBasis(1//2), i, gate) which fails.

embed expects a composite basis and basis^1 autosimplifies to basis, so the generic code above fails.

We need a small stub distpatch for these "do not operation" edge cases.

@Krastanov Krastanov added enhancement New feature or request good first issue Good for newcomers labels Apr 12, 2024
@a-eghrari
Copy link

My first impression is a simple dispatch like embed(b::Basis, indices, ops) = ops is enough. Am I right?

@Krastanov
Copy link
Collaborator Author

Yes, but I am worried something as simple would cause surprises down the line. Having indices == 1 || indices == (1,) || indices == [1] with a clear error message would be safer.

Also, ops should probably be typed, to avoid type piracy against QuantumInterface.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants