Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/functions/_toc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"parentUrl": "/docs/guides",
"parentLabel": "Guides",
"title": "Qiskit Functions",
"collapsed": true,
"children": [
{
"title": "Applications research tools",
"collapsible": false,
"children": [
{ "title": "Introduction to Qiskit Functions", "url": "/docs/guides/functions" },
{ "title": "Getting Started with Qiskit Functions", "url": "/docs/guides/functions/get-started" },
{
"title": "Custom Functions",
"children": [
{ "title": "Introduction to custom functions", "url": "/docs/guides/serverless" },
{ "title": "Write your first custom function", "url": "/docs/guides/serverless-first-program" },
{ "title": "Run your first custom function remotely", "url": "/docs/guides/serverless-run-first-workload" },
{ "title": "Manage custom function compute and data resources", "url": "/docs/guides/serverless-manage-resources" },
{ "title": "Port code to custom functions", "url": "/docs/guides/serverless-port-code" }
]
},
{
"title": "Qiskit Function templates",
"children": [
{ "title": "Introduction to Qiskit Function templates", "url": "/docs/functions/function-templates/qiskit-function-templates" },
{ "title": "Template for chemistry simulation", "url": "/docs/functions/function-templates/function-template-chemistry-workflow" },
{ "title": "Template for Hamiltonian simulation", "url": "/docs/functions/function-templates/function-template-hamiltonian-simulation" }
]
},
{
"title": "Sample-based quantum diagonalization (SQD)",
"children": [
{ "title": "SQD addon overview", "url": "/docs/guides/qiskit-addons-sqd" },
{ "title": "Get started with SQD", "url": "/docs/guides/qiskit-addons-sqd-get-started" }
]
}
]
}
]
}
50 changes: 50 additions & 0 deletions docs/functions/algorithmiq-tem/_toc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"parentUrl": "/docs/guides/functions",
"parentLabel": "Qiskit Functions",
"title": "Algorithmiq Tensor-network error mitigation (TEM)",
"collapsed": true,
"children": [
{
"title": "",
"collapsible": false,
"children": [
{
"title": "Overview",
"url": "/docs/functions/algorithmiq-tem"
},
{
"title": "Get started",
"url": "/docs/functions/algorithmiq-tem/get-started"
},
{
"title": "Advanced techniques with Algorithmiq TEM",
"url": "/docs/functions/algorithmiq-tem/performance-tuning"
},
{
"title": "Changelog",
"url": "/docs/functions/algorithmiq-tem/changelog"
}
]
},
{
"title": "Tutorials",
"collapsible": false,
"children": [
{
"title": "Simulate a kicked Ising model with the TEM function",
"url": "/docs/tutorials/simulate-kicked-ising-tem"
}
]
},
{
"title": "API reference",
"collapsible": false,
"children": [
{
"title": "Python API reference",
"url": "/docs/api/functions/algorithmiq-tem"
}
]
}
]
}
6 changes: 6 additions & 0 deletions docs/functions/algorithmiq-tem/changelog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Changelog
description: Changelog for the TEM Qiskit Function.
---

*This section is under development. Algorithmiq is encouraged to maintain a changelog here as new features and updates are released.*
168 changes: 168 additions & 0 deletions docs/functions/algorithmiq-tem/get-started.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "page-frontmatter",
"metadata": {},
"source": [
"---\ntitle: Get started with Algorithmiq TEM\ndescription: Get started with TEM — authenticate, load the function, and run an expectation value estimation example.\n---"
]
},
{
"cell_type": "markdown",
"id": "2995da29",
"metadata": {},
"source": [
"## Setup and load function\n\nAuthenticate using your [IBM Quantum Platform API key](http://quantum.cloud.ibm.com/), and select the TEM function as follows. (This snippet assumes you've already [saved your account](/docs/guides/functions#install-qiskit-functions-catalog-client) to your local environment.)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "cc0a8093",
"metadata": {},
"outputs": [],
"source": [
"from qiskit_ibm_catalog import QiskitFunctionsCatalog\n",
"\n",
"tem_function_name = \"algorithmiq/tem\"\n",
"catalog = QiskitFunctionsCatalog(channel=\"ibm_quantum_platform\")\n",
"\n",
"# Load your function\n",
"tem = catalog.load(tem_function_name)"
]
},
{
"cell_type": "markdown",
"id": "ae7adcc7",
"metadata": {},
"source": [
"## Run your first workload\n\n\nThe following snippet shows an example where TEM is used to compute the expectation values of an observable given a simple quantum circuit."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ab05b87f",
"metadata": {},
"outputs": [],
"source": [
"from qiskit import QuantumCircuit\n",
"from qiskit.quantum_info import SparsePauliOp\n",
"\n",
"# Create a quantum circuit\n",
"qc = QuantumCircuit(3)\n",
"qc.u(0.4, 0.9, -0.3, 0)\n",
"qc.u(-0.4, 0.2, 1.3, 1)\n",
"qc.u(-1.2, -1.2, 0.3, 2)\n",
"for _ in range(2):\n",
" qc.barrier()\n",
" qc.cx(0, 1)\n",
" qc.cx(2, 1)\n",
" qc.barrier()\n",
" qc.u(0.4, 0.9, -0.3, 0)\n",
" qc.u(-0.4, 0.2, 1.3, 1)\n",
" qc.u(-1.2, -1.2, 0.3, 2)\n",
"\n",
"# Define the observables\n",
"observable = SparsePauliOp(\"IYX\", 1.0)\n",
"\n",
"# Define the execution options\n",
"pub = (qc, [observable])\n",
"options = {\"default_precision\": 0.02}\n",
"\n",
"# Define backend to use. TEM will choose the least-busy device\n",
"# reported by IBM if not specified\n",
"backend_name = \"ibm_marrakesh\"\n",
"\n",
"# Run the TEM function (uses around three minutes of QPU time)\n",
"job = tem.run(pubs=[pub], backend_name=backend_name, options=options)"
]
},
{
"cell_type": "markdown",
"id": "6e2a97e2",
"metadata": {},
"source": [
"Use the Qiskit Serverless APIs to check your Qiskit Function workload's status:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "47b0db71",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"QUEUED\n"
]
}
],
"source": [
"print(job.status())"
]
},
{
"cell_type": "markdown",
"id": "fbaeace8",
"metadata": {},
"source": [
"You can return the results as:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ad5b9a53",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.02165380888171687\n"
]
}
],
"source": [
"result = job.result()\n",
"evs = result[0].data.evs\n",
"print(evs[0])"
]
},
{
"cell_type": "markdown",
"id": "e5e138d3",
"metadata": {},
"source": [
"<Admonition type=\"info\">\n",
" The expected value for the noiseless circuit for the given operator should be around `0.18409094298943401`.\n",
"</Admonition>"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading