GithubHelp home page GithubHelp logo

Implement a `GraphQubit` type about cirq HOT 9 CLOSED

quantumlib avatar quantumlib commented on August 28, 2024
Implement a `GraphQubit` type

from cirq.

Comments (9)

Strilanc avatar Strilanc commented on August 28, 2024

QubitId is the fundamental type that gates care about, so it is very easy for others to implement their own. We don't have to do it for them.

I do think that QubitLoc should be moved into the google folder, and possibly renamed to XmonQubit.

from cirq.

dabacon avatar dabacon commented on August 28, 2024

from cirq.

mrwojtek avatar mrwojtek commented on August 28, 2024

As a prerequisite to #470, some extension of interfaces discussed here is required. What is required for placement code is:

  • a method to retrieve all qubits,
  • a method to resolve qubits connectivity,
  • a method to provide qubits and connections costs,
  • a method to provide information which interactions exclude which qubits from participating in other interactions.
  • a method to lay out a List[LineQubit] on arbitrary device.

I started to think about creating GridQubit, as discussed with @Strilanc, but all the methods I could think about fit GraphQubit much better:

class GraphQubit(metaclass=abc.ABCMeta):

    @abc.abstractmethod
    def can_interact/is_adjacent(self, other: 'GraphQubit') -> bool:
        pass

    @abc.abstractmethod
    def quality(self) -> float:
        pass

    @abc.abstractmethod
    def interaction_quality(self, other: 'GraphQubit') -> float:
        pass

    @abc.abstractmethod
    def interaction_qubits(self, other: 'GraphQubit') -> Set['GraphQubit']:
        pass


class GraphDevice(metaclass=abc.ABCMeta):

    @abc.abstractmethod
    def qubits(self) -> Iterable['GraphQubit']:

    @abc.abstractmethod
    def neighbors_of(self, qubit: 'GraphQubit') -> Iterable['GraphQubit']:

    @abc.abstractmethod
    def map_to_line(self, qubits: List['GraphQubit']) -> Iterable['LineQubit']:
        pass

What do you think about this?

from cirq.

Strilanc avatar Strilanc commented on August 28, 2024

@dabacon Do we need a graph qubit for the next milestone? My impression is that we don't; it's more abstract than what we need. At most we would need a GridQubit for 2d points, which is currently played by Xmon.

from cirq.

dabacon avatar dabacon commented on August 28, 2024

We're going to need to deal with more arbitrary adjacency for ion trap devices, so I think we will need something like this. One thing to note however is that I don't think we want to have objects like quality on the qubits themselves. In my mind the QubitId is the generic object, and these sub-classed Qubits are about laying out a structure for thinking about moving from one qubit to another, BUT that might not even correspond to the allowed interactions. So it's more like the abstract layout of the qubit, and putting things like quailty (of which gate? what quality?) is something that will come from elsewhere (essentialy it should be at least close to the hardware spec)

from cirq.

bryano avatar bryano commented on August 28, 2024

It seems more natural for adjacency and gate information to be part of the device rather than the qubit. Why not just give GraphDevice a graph attribute whose vertices can be generic QubitIds?

from cirq.

vtomole avatar vtomole commented on August 28, 2024

@bryano Is this related to all of your not-yet-merged pull requests?

from cirq.

bryano avatar bryano commented on August 28, 2024

Yea, specifically #1181

from cirq.

bryano avatar bryano commented on August 28, 2024

Can this be closed?

from cirq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.