Created
January 3, 2020 19:05
-
-
Save cgranade/b9c8c1cf4a9c3c6501e849b45b38b220 to your computer and use it in GitHub Desktop.
fail-estfreqa.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/json": "[\"Fail\"]", | |
"text/html": [ | |
"<ul><li>Fail</li></ul>" | |
], | |
"text/plain": [ | |
"Fail" | |
] | |
}, | |
"execution_count": 1, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"operation Fail(target : Qubit[]) : Unit is Adj {\n", | |
" X(target[0]);\n", | |
" fail \"oops\";\n", | |
"}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/json": "[\"EstimateFrequencyWithFailure\"]", | |
"text/html": [ | |
"<ul><li>EstimateFrequencyWithFailure</li></ul>" | |
], | |
"text/plain": [ | |
"EstimateFrequencyWithFailure" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"operation EstimateFrequencyWithFailure() : Unit {\n", | |
" let prep = Fail;\n", | |
" let meas = Measure([PauliZ], _);\n", | |
" let count = Microsoft.Quantum.Characterization.EstimateFrequencyA(prep, meas, 1, 100);\n", | |
" Message($\"{count}\");\n", | |
"}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Unhandled exception. Microsoft.Quantum.Simulation.Simulators.Exceptions.ReleasedQubitsAreNotInZeroState: Released qubits are not in zero state.\n" | |
] | |
}, | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"Value cannot be null. (Parameter 'key')\n" | |
] | |
} | |
], | |
"source": [ | |
"%simulate EstimateFrequencyWithFailure" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Q#", | |
"language": "qsharp", | |
"name": "iqsharp" | |
}, | |
"language_info": { | |
"file_extension": ".qs", | |
"mimetype": "text/x-qsharp", | |
"name": "qsharp", | |
"version": "0.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment