Commit 40548286 authored by Jakowski's avatar Jakowski
Browse files

added yml environment file and testing notebooks

parent b6e9c55a
Loading
Loading
Loading
Loading
+103 −0
Original line number Diff line number Diff line
%% Cell type:markdown id: tags:

##### Copyright 2022 The Cirq Developers

%% Cell type:code id: tags:

``` python
# @title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
```

%% Cell type:markdown id: tags:

# Hello Qubit

%% Cell type:markdown id: tags:

<table class="tfo-notebook-buttons" align="left">
  <td>
    <a target="_blank" href="https://quantumai.google/cirq/start/start"><img src="https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png" />View on QuantumAI</a>
  </td>
  <td>
    <a target="_blank" href="https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/start/start.ipynb"><img src="https://quantumai.google/site-assets/images/buttons/colab_logo_1x.png" />Run in Google Colab</a>
  </td>
  <td>
    <a target="_blank" href="https://github.com/quantumlib/Cirq/blob/master/docs/start/start.ipynb"><img src="https://quantumai.google/site-assets/images/buttons/github_logo_1x.png" />View source on GitHub</a>
  </td>
  <td>
    <a href="https://storage.googleapis.com/tensorflow_docs/Cirq/docs/start/start.ipynb"><img src="https://quantumai.google/site-assets/images/buttons/download_icon_1x.png" />Download notebook</a>
  </td>
</table>

%% Cell type:code id: tags:

``` python
#try:
import cirq
#except ImportError:
#    print("installing cirq...")
#    !pip install --quiet cirq
#    import cirq

#    print("installed cirq.")
```

%% Cell type:code id: tags:

``` python
# Pick a qubit.
qubit = cirq.GridQubit(0, 0)

# Create a circuit that applies a square root of NOT gate, then measures the qubit.
circuit = cirq.Circuit(cirq.X(qubit) ** 0.5, cirq.measure(qubit, key='m'))
print("Circuit:")
print(circuit)

# Simulate the circuit several times.
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=20)
print("Results:")
print(result)
```

%% Output

    Circuit:
    (0, 0): ───X^0.5───M('m')───
    Results:
    m=01011110011001110111

%% Cell type:markdown id: tags:

# Congratulations
You've just run your first Cirq program.

To learn about running a circuit on a virtual machine that mimics existing quantum hardware, see [Quantum Virtual Machine](../simulate/quantum_virtual_machine.ipynb).

If you would like to learn more about quantum computing, check out our [education page](/education). The Full API reference for Cirq can be found [here](/reference/python/cirq). If you are looking for vendor specific information that can be found on our vendor sub-pages:


  [Alpine Quantum Technologies](../hardware/aqt/getting_started.ipynb)

  [Pasqal](../hardware/pasqal/getting_started.ipynb)

  [IonQ](../hardware/ionq/getting_started.ipynb)

  [Azure](../hardware/azure-quantum/getting_started_honeywell.ipynb)

  [Rigetti](../hardware/rigetti/getting_started.ipynb)

%% Cell type:code id: tags:

``` python
```
+18 −0
Original line number Diff line number Diff line
%% Cell type:code id: tags:

``` 
import pennylane as qml
from pennylane import numpy as np

dev1 = qml.device('default.qubit', wires = 1)

@qml.qnode(dev1, interface="autograd")
def circuit(params):
    qml.RX(params[0], wires=0)
    qml.RY(params[1], wires=0)
    return qml.expval(qml.PauliZ(0))

print(circuit([0.54, 0.12]))

#print("Hello World!")
```
+110 −0

File added.

Preview size limit exceeded, changes collapsed.

qml_envfile.yml

0 → 100644
+0 −0

File added.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.