• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cirq_ts/H03-May-2022-13,96812,809

cirq_web/H26-Oct-2021-900533

.gitignoreH A D26-Oct-2021130 138

LICENSEH A D26-Oct-202111.1 KiB202169

README.rstH A D26-Oct-20212.2 KiB6040

bloch_sphere_example.ipynbH A D26-Oct-2021629.2 KiB135134

circuit_example.ipynbH A D26-Oct-20213.9 KiB143142

setup.cfgH A D26-Oct-202134 32

setup.pyH A D26-Oct-20212.5 KiB7337

README.rst

1.. image:: https://raw.githubusercontent.com/quantumlib/Cirq/master/docs/images/Cirq_logo_color.png
2  :target: https://github.com/quantumlib/cirq
3  :alt: Cirq
4  :width: 500px
5
6`Cirq <https://quantumai.google/cirq>`__ is a Python library for writing, manipulating, and optimizing quantum
7circuits and running them against quantum computers and simulators.
8
9This module is **cirq-web**, which allows users to take advantage of browser based 3D visualization tools
10and features in Cirq. cirq-web also provides a development environment for contributors to create and add
11their own visualizations to the module.
12
13Documentation
14-------------
15Documentation for cirq-web can be found in the README files located in this module's subdirectories.
16
17Below is a quick example of how to generate a portable 3D rendering of the Bloch sphere using cirq-web:
18
19.. code-block:: python
20
21    from cirq_web import BlochSphere
22
23    # Prepare a state
24    zero_state = [1+0j, 0+0j]
25    state_vector = cirq.to_valid_state_vector(zero_state)
26
27    # Create and display the Bloch sphere
28    sphere = BlochSphere(state_vector=state_vector)
29    sphere.generate_html_file()
30
31This will create the file in the current working directory. There are additional options to specify the
32output directory or to open the visualization in a browser for example.
33
34You can also view and interact with a Bloch sphere in a Colab or Jupyter notebook setting
35with the following:
36
37.. code-block:: python
38
39    from cirq_web import BlochSphere
40
41    # Prepare a state
42    zero_state = [1+0j, 0+0j]
43    state_vector = cirq.to_valid_state_vector(zero_state)
44
45    # Create and display the Bloch sphere
46    sphere = BlochSphere(state_vector=state_vector)
47    display(sphere)
48
49See the example Jupyter notebook in this directory for more examples on how to use cirq-web.
50
51Installation
52------------
53
54Cirq-web is currently in development, and therefore is only available via pre-release.
55
56To install the pre-release version of only **cirq-web**, use `pip install cirq-web --pre`.
57
58Note, that this will install both cirq-web and cirq-core.
59
60To get all the optional modules installed as well, you'll have to use `pip install cirq` or `pip install cirq --pre` for the pre-release version.