Cirq | python framework

 by   quantumlib Python Version: v1.1.0 License: Apache-2.0

kandi X-RAY | Cirq Summary

kandi X-RAY | Cirq Summary

Cirq is a Python library typically used in Quantum Computing applications. Cirq has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub.

A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Cirq has a medium active ecosystem.
              It has 3790 star(s) with 864 fork(s). There are 178 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 288 open issues and 1805 have been closed. On average issues are closed in 65 days. There are 45 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Cirq is v1.1.0

            kandi-Quality Quality

              Cirq has 0 bugs and 0 code smells.

            kandi-Security Security

              Cirq has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Cirq code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Cirq is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Cirq releases are available to install and integrate.
              Build file is available. You can build the component from source.
              Cirq saves you 97134 person hours of effort in developing the same functionality from scratch.
              It has 144322 lines of code, 11023 functions and 1009 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed Cirq and discovered the below as its top functions. This is intended to give you an instant insight into Cirq implemented functionality, and help decide if they suit your requirements.
            • Perform a t2decay calculation .
            • Calculates the gate product for the given base gate .
            • Deserialize a Gow gate operation .
            • Returns the reachable from the start_frontier to the vertex .
            • Translates a circuit to an optimized circuit .
            • This method is used for testing only
            • add a custom quantizer service
            • Decompose cphase gate into two scales .
            • Performs a cross - entropy benchmark .
            • Attempts to find a direct fidelity interval for the given circuit .
            Get all kandi verified functions for this library.

            Cirq Key Features

            No Key Features are available at this moment for Cirq.

            Cirq Examples and Code Snippets

            QubitRBM,The QAOA class
            Pythondot img1Lines of Code : 9dot img1License : Permissive (Apache-2.0)
            copy iconCopy
            from qubitrbm.qaoa import QAOA
            
            G = nx.random_regular_graph(3, 16, seed=123)
            qaoa = QAOA(G, p=1)
            
            gamma, beta = np.random.rand(2)
            
            psi = qaoa.simulate(gamma, beta).final_state_vector
            samples = qaoa.sample(gamma, beta, n_samples=100)
            
            angles, costs =   
            QUANTIFY
            Pythondot img2Lines of Code : 7dot img2no licencesLicense : No License
            copy iconCopy
            @INPROCEEDINGS{quantify2020,
              author={O. {Oumarou} and A. {Paler} and R. {Basmadjian}},
              booktitle={2020 IEEE Computer Society Annual Symposium on VLSI (ISVLSI)}, 
              title={QUANTIFY: A Framework for Resource Analysis and Design Verification of Quan  
            OpenSurgery - lattice surgery compiler
            Pythondot img3Lines of Code : 6dot img3no licencesLicense : No License
            copy iconCopy
            @article{paler2019opensurgery,
              title={OpenSurgery for Topological Assemblies},
              author={Paler, Alexandru and Fowler, Austin G},
              journal={arXiv preprint arXiv:1906.07994},
              year={2019}
            }
              

            Community Discussions

            QUESTION

            How to find out what `*` operator do on two objects from some library (cirq)?
            Asked 2021-Apr-05 at 16:28

            I just started using python cirq library and I came across the following line of code in the tutorial:

            ...

            ANSWER

            Answered 2021-Apr-05 at 16:28

            First, you need to find what the type of cirq.X(q0) is:

            Source https://stackoverflow.com/questions/66956098

            QUESTION

            Multiclass classification using TensorFlow Quantum
            Asked 2020-Aug-24 at 08:18

            I am running some examples and tests on TensorFlow Quantum (TFQ) and I am struggling to perform a multi-class classification. I will used the MNIST classification example as base (https://www.tensorflow.org/quantum/tutorials/mnist), since this is where I am starting from too.

            For binary classification I played with the different examples of classes and different gates combination, and the classification result is obtained by measuring a single readout qubit (qR)result, thus if qR=0 we classify with class 0 and if qR=1 then we have class 1.

            I extended it to a multi-class problems, so we have a 4 classes (0,1,2,3). To do this I change the labels of the classes with tf.keras.utils.to_categorical(y_train), such that the labels get converted from single values to vectors (0 -> (1,0,0,0); 1-> (0,1,0,0); etc..), use tf.keras.losses.CategoricalHinge() as loss of the model and create 4 readouts qubits, one for each class (M(qR0, qR1, qR2, qR3) = (0,0,1,0) -> class 2), and this works.

            However, this method increases massively the size of the circuit. So what I want to do is to pass to TFQ only 2 readout qubits and use the combined measurement for the 4 classes classification (|00> = 0, |10> = 1, |01> = 2, |11> = 3). Ideally this would allow a 2^n multi-class classification, where n is the number of qubits. In Cirq I can achieved this output by performing a cirq.measure(qR0, qR1, key='measure') on the two readout qubits. However I am struggling in passing such command to TFQ, since from what I understand it measures only the qubits that end with a single qubit Pauli gate.

            So, is there something that I am missing in the functionalities of TFQ that allows such kind of measurements in the training process?

            ...

            ANSWER

            Answered 2020-Aug-24 at 08:18

            Starting with this snippet:

            Source https://stackoverflow.com/questions/63549444

            QUESTION

            How do I implement a controlled Rx in Cirq/Tensorflow Quantum?
            Asked 2020-May-21 at 01:59

            I am trying to implement a controlled rotation gate in Cirq/Tensorflow Quantum.

            The readthedocs.io at https://cirq.readthedocs.io/en/stable/gates.html states:

            "Gates can be converted to a controlled version by using Gate.controlled(). In general, this returns an instance of a ControlledGate. However, for certain special cases where the controlled version of the gate is also a known gate, this returns the instance of that gate. For instance, cirq.X.controlled() returns a cirq.CNOT gate. Operations have similar functionality Operation.controlled_by(), such as cirq.X(q0).controlled_by(q1)."

            I have implemented

            ...

            ANSWER

            Answered 2020-May-21 at 01:59

            What you have is a completely correct implementation of a controlled X rotation in Cirq. It can be used in simulation and other things like cirq.unitary without any issues.

            TFQ only supports a subset of gates in Cirq. For example a cirq.ControlledGate can have an arbitrary number of control qubits, which in some cases can make it harder to decompose down to primitive gates that are compatible with NiSQ hardware platforms (This is why cirq.decompose doesn't do anything to ControlledOperations). TFQ only supports these primitive style gates , for a full list of the supported gates, you can do:

            Source https://stackoverflow.com/questions/61852590

            QUESTION

            Decompose a Quantum Circuit in Cirq
            Asked 2020-May-17 at 21:47

            I am working on Cirq and need to perform certain unitary operations on qubits. For that, I am using the MatrixGate() function in Cirq. Unlike Qiskit, I could not find any function like decompose or transpile to simplify the Unitary operation into basic U3 and CNOT gates.

            For instance, if I want to act the following Unitary Operator,

            Unitary Operator

            To do this I use this code in Qiskit. Looking for something equivalent in Cirq.

            ...

            ANSWER

            Answered 2020-May-17 at 20:53

            An example of such a method is cirq.two_qubit_matrix_to_operations. It uses the kak decomposition (cartan decomposition) to determine how to translate a unitary matrix into a series of operations with minimal number of CZ gates.

            Source https://stackoverflow.com/questions/61835652

            QUESTION

            cannot save tensorrflow keras quantum model using save/pickle
            Asked 2020-Mar-15 at 13:55

            how to save tensorflow quantum model? I am getting the following when i am trying to save keras model with quantum circuits. I didnt find any support for the same. tensorflow:Layer add_circuit_2 was passed non-serializable keyword arguments tensorflow:Layer add_circuit_2 was passed non-serializable keyword arguments tensorflow:Layer add_circuit_2 was passed non-serializable keyword arguments

            ...

            ANSWER

            Answered 2020-Mar-15 at 13:55

            TensorFlow Quantum does not yet implement get_config and load_config. We had some difficulty with saving certain Cirq objects, we are working on it.

            For now if you want to save models that contain quantum layers you can use the

            Source https://stackoverflow.com/questions/60682091

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Cirq

            You can download it from GitHub.
            You can use Cirq like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Python Libraries

            public-apis

            by public-apis

            system-design-primer

            by donnemartin

            Python

            by TheAlgorithms

            Python-100-Days

            by jackfrued

            youtube-dl

            by ytdl-org

            Try Top Libraries by quantumlib

            OpenFermion

            by quantumlibPython

            qsim

            by quantumlibC++

            OpenFermion-Cirq

            by quantumlibPython

            ReCirq

            by quantumlibPython

            Stim

            by quantumlibC++