Skip to content

Commit

Permalink
add img for workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryoris committed Jan 12, 2021
1 parent 13605c7 commit b7c17dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions Opflow hands on.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Opflow constituents\n",
"\n",
"Put some kind of graph with Operators, ListOps, StateFn"
"# Hands on: Opflow "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"OpflowWorkflow.png\" width=\"700\"></img>"
]
},
{
Expand All @@ -27,10 +32,9 @@
"The two fundamental objects in Opflow are states, which are of type `StateFn`, and operators, which are of type `OperatorBase`.\n",
"\n",
"States...\n",
"* can be both bra and ket\n",
"* need not be normalized\n",
"* can be based on circuits, vectors or dictionaries (or Operators, see later)\n",
"* can be summed"
"* can be summed\n",
"* need not be normalized"
]
},
{
Expand Down Expand Up @@ -674,7 +678,7 @@
},
{
"cell_type": "code",
"execution_count": 132,
"execution_count": 134,
"metadata": {},
"outputs": [
{
Expand All @@ -686,7 +690,9 @@
"MultOp:\n",
" 0j\n",
"MaxOp:\n",
" 1.0\n"
" 1.0\n",
"QuadOp:\n",
" (2+0j)\n"
]
}
],
Expand All @@ -710,7 +716,9 @@
"def quadsum(x):\n",
" return sum(x_i ** 2 for x_i in x)\n",
"\n",
"quad_op = ListOp([I, X, Y, Z], combo_fn=quad)"
"quad_op = ListOp([I, X, Y, Z], combo_fn=quadsum)\n",
"expectations = ~StateFn(quad_op) @ Zero\n",
"print('QuadOp:\\n', expectations.eval())"
]
},
{
Expand Down
Binary file added OpflowWorkflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b7c17dc

Please sign in to comment.