{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d30279ee", "metadata": { "execution": { "iopub.execute_input": "2024-04-26T18:21:23.923991Z", "iopub.status.busy": "2024-04-26T18:21:23.923710Z", "iopub.status.idle": "2024-04-26T18:21:23.927292Z", "shell.execute_reply": "2024-04-26T18:21:23.926868Z" }, "nbsphinx": "hidden" }, "outputs": [], "source": [ "# Copyright 2024 Keysight Technologies Inc." ] }, { "cell_type": "raw", "id": "563d4e5c", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Example: Introduction to the Simulator\n", "======================================\n", "\n", "|True-Q| offers a highly versatile :py:class:`~trueq.Simulator` that allows\n", "users to simulate arbitrary circuits with a wide variety of noise models and options\n", "for noise model customization. In particular, the simulator can be used to:\n", "\n", "#. Simulate the final quantum state of a circuit. This will be a pure state vector\n", " if the noise model is ideal or has only unitary noise, and will be a density\n", " matrix otherwise.\n", "#. Simulate the total effective operator of a circuit. This will be a unitary matrix\n", " if the noise model is ideal or has only unitary noise, and will be a superoperator\n", " otherwise.\n", "#. Sample a given number of bitstrings (or ditstrings if higher energy levels are\n", " defined) from the distribution defined by the final simulated quantum state of a\n", " circuit. These results can be returned, or can be automatically populated into\n", " the respective :py:attr:`~trueq.Circuit.results` attributes of the given circuits.\n", "\n", "In this example, we go through the basic features of the |True-Q| simulator.\n", "We begin by instantiating a circuit to play with:" ] }, { "cell_type": "code", "execution_count": 2, "id": "317991af", "metadata": { "execution": { "iopub.execute_input": "2024-04-26T18:21:23.929287Z", "iopub.status.busy": "2024-04-26T18:21:23.928908Z", "iopub.status.idle": "2024-04-26T18:21:26.234080Z", "shell.execute_reply": "2024-04-26T18:21:26.233619Z" } }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "DisplayWrapper(