From 103281c07b3b6044178bc81f0cd77743848266bc Mon Sep 17 00:00:00 2001 From: Josh Combes Date: Tue, 11 Jun 2019 07:46:45 +1000 Subject: [PATCH] Release 0.5.0 (#125) We are about to make major changes to the API so pin to this version if you don't want change. * Bump version to v0.5.0 * remove deprecated modules * include PRs * kraus ops are valid * date change --- CHANGELOG.md | 15 ++++++ forest/benchmarking/__init__.py | 2 +- forest/benchmarking/bell_state.py | 42 --------------- forest/benchmarking/graph_state.py | 87 ------------------------------ 4 files changed, 16 insertions(+), 130 deletions(-) delete mode 100644 forest/benchmarking/bell_state.py delete mode 100644 forest/benchmarking/graph_state.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 62c5f299..ff2ffd0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,21 @@ Changelog ========= +v0.5 (June 10, 2018) +-------------------- +Improvements and Changes: + +- Moved bitstring prep/measure program creation helpers to utils (gh-118) +- Added functoinality to `plotting` module: two ways to visualize a quantum state in the Pauli basis, plotting of a Pauli Transfer Matrix, plotting a real matrix using a Hinton diagram, the addition of the computational basis as a predefined basis object (gh-119) +- Refactor iterative MLE to use ExperimentResults directly (gh-120) +- Combined `graph_state` and `bell_state` modules into `entangled_state` module, added deprecation warnings for the old modules (gh-122) +- Made Ipython Notebooks a part of testing (gh-123) +- Resolve test warnings and doc string formatting issues (gh-124) +- **Breaking change.** Bump version and delete `graph_state` and `bell_state` modules (gh-125) +- Added the ability to check if the Kraus operators are valid (PR 128) + + + v0.4 (May 6, 2018) ------------------ diff --git a/forest/benchmarking/__init__.py b/forest/benchmarking/__init__.py index 6a9beea8..3d187266 100644 --- a/forest/benchmarking/__init__.py +++ b/forest/benchmarking/__init__.py @@ -1 +1 @@ -__version__ = "0.4.0" +__version__ = "0.5.0" diff --git a/forest/benchmarking/bell_state.py b/forest/benchmarking/bell_state.py deleted file mode 100644 index 4726ebca..00000000 --- a/forest/benchmarking/bell_state.py +++ /dev/null @@ -1,42 +0,0 @@ -import networkx as nx -from forest.benchmarking.entangled_states import create_ghz_program -from forest.benchmarking.entangled_states import ghz_state_statistics - -import warnings -import functools - -def deprecated(func): - """This is a decorator which can be used to mark functions - as deprecated. It will result in a warning being emitted - when the function is used.""" - @functools.wraps(func) - def new_func(*args, **kwargs): - warnings.simplefilter('always', DeprecationWarning) # turn off filter - warnings.warn("Call to deprecated function {}. \r\n \r\n Use the GHZ functions in " - "forest.benchmarking.entangled_states instead.\r\n".format(func.__name__), - category=DeprecationWarning, - stacklevel=2) - warnings.simplefilter('default', DeprecationWarning) # reset filter - return func(*args, **kwargs) - return new_func - -@deprecated -def create_bell_program(tree: nx.DiGraph): - """ - Create a Bell/GHZ state with CNOTs described by tree. - - :param tree: A tree that describes the CNOTs to perform to create a bell/GHZ state. - :return: the program - """ - return create_ghz_program(tree) - -@deprecated -def bell_state_statistics(bitstrings): - """ - Compute statistics bitstrings sampled from a Bell/GHZ state - - :param bitstrings: An array of bitstrings - :return: A dictionary where bell = number of bitstrings consistent with a bell/GHZ state; - total = total number of bitstrings. - """ - return ghz_state_statistics(bitstrings) diff --git a/forest/benchmarking/graph_state.py b/forest/benchmarking/graph_state.py deleted file mode 100644 index a6700715..00000000 --- a/forest/benchmarking/graph_state.py +++ /dev/null @@ -1,87 +0,0 @@ -import networkx as nx -from pyquil.api import QPUCompiler - -from forest.benchmarking.entangled_states import create_graph_state as create_graph_state_good -from forest.benchmarking.entangled_states import measure_graph_state as measure_graph_state_good -from forest.benchmarking.entangled_states import compiled_parametric_graph_state as \ - compiled_parametric_graph_state_good - -import warnings -import functools - -def deprecated(func): - """This is a decorator which can be used to mark functions - as deprecated. It will result in a warning being emitted - when the function is used.""" - @functools.wraps(func) - def new_func(*args, **kwargs): - warnings.simplefilter('always', DeprecationWarning) # turn off filter - warnings.warn("Call to deprecated function {}. \r\n \r\n Use the graph state functions in " - "forest.benchmarking.entangled_states instead.\r\n".format(func.__name__), - category=DeprecationWarning, - stacklevel=2) - warnings.simplefilter('default', DeprecationWarning) # reset filter - return func(*args, **kwargs) - return new_func - -@deprecated -def create_graph_state(graph: nx.Graph, use_pragmas=True): - """Write a program to create a graph state according to the specified graph - - A graph state involves Hadamarding all your qubits and then applying a CZ for each - edge in the graph. A graph state and the ability to measure it however you want gives - you universal quantum computation. Some good references are - - [MBQC] A One-Way Quantum Computer - Raussendorf et al., - Phys. Rev. Lett. 86, 5188 (2001) - https://doi.org/10.1103/PhysRevLett.86.5188 - https://arxiv.org/abs/quant-ph/0010033 - - [MBCS] Measurement-based quantum computation with cluster states - Raussendorf et al., - Phys. Rev. A 68, 022312 (2003) - https://dx.doi.org/10.1103/PhysRevA.68.022312 - https://arxiv.org/abs/quant-ph/0301052 - - Similar to a Bell state / GHZ state, we can try to prepare a graph state and measure - how well we've done according to expected parities. - - :param graph: The graph. Nodes are used as arguments to gates, so they should be qubit-like. - :param use_pragmas: Use COMMUTING_BLOCKS pragmas to hint at the compiler - :return: A program that constructs a graph state. - """ - return create_graph_state_good(graph, use_pragmas) - -@deprecated -def measure_graph_state(graph: nx.Graph, focal_node: int): - """Given a graph state, measure a focal node and its neighbors with a particular measurement - angle. - - :param prep_program: Probably the result of :py:func:`create_graph_state`. - :param qs: List of qubits used in prep_program or anything that can be indexed by the nodes - in the graph ``graph``. - :param graph: The graph state graph. This is needed to figure out what the neighbors are - :param focal_node: The node in the graph to serve as the focus. The focal node is measured - at an angle and all its neighbors are measured in the Z basis - :return Program, list of classical offsets into the ``ro`` register. - """ - return measure_graph_state_good(graph, focal_node) - -@deprecated -def compiled_parametric_graph_state(graph, focal_node, compiler: QPUCompiler, n_shots=1000): - """ - Construct a program to create and measure a graph state, map it to qubits using ``addressing``, - and compile to an ISA. - - Hackily implement a parameterized program by compiling a program with a particular angle, - finding where that angle appears in the results, and replacing it with ``"{angle}"`` so - the resulting compiled program can be run many times by using python's str.format method. - - :param graph: A networkx graph defining the graph state - :param focal_node: The node of the graph to measure - :param compiler: The compiler to do the compiling. - :param n_shots: The number of shots to take when measuring the graph state. - :return: an executable that constructs and measures a graph state. - """ - return compiled_parametric_graph_state_good(graph, focal_node, compiler, n_shots)