Adds Tutorial for advanced state and operator preparation - #1114
singhmankrit wants to merge 7 commits into
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
HGSilveri
left a comment
There was a problem hiding this comment.
I like the spirit of the tutorial! Here is a first batch of comments, let's address these first
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# Examples of Custom States and Operators" |
There was a problem hiding this comment.
How about this as a title?
| "# Examples of Custom States and Operators" | |
| "# Creating Size-Dependent States and Operators" |
There was a problem hiding this comment.
Unless the notebook takes a long time to run, we usually clear the output. That makes the docs run the notebook on every build
| "source": [ | ||
| "## Size-parametrized helper class for Pauli operators\n", | ||
| "\n", | ||
| "For a two-level system with `eigenstates = (\"r\", \"g\")`, the Pauli matrices are written as:" |
There was a problem hiding this comment.
This is dependent on the state vector convention, it would be wise to link to the Conventions page
| " \"\"\"A qubit chain of a given size, with helpers to build Pauli-string\n", | ||
| " operators and a few reference states.\"\"\"\n", | ||
| "\n", | ||
| " def __init__(self, L, config_class=QutipConfig):\n", |
There was a problem hiding this comment.
Instead of taking in config_class, I think it would make more sense to take state_class and operator_class. Potentially, it could even make sense to default them to StateRepr and OperatorRepr, since those are the ones we want to encourage.
You can still give the QutipConfig classes in your example further down, I think it is also instructive
| " self.state_class = config_class.state_type\n", | ||
| " self.operator_class = config_class.operator_type\n", | ||
| "\n", | ||
| " def corr_pauli(self, a, *idxs):\n", |
There was a problem hiding this comment.
Some type hints would be nice
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "class Chain:\n", |
There was a problem hiding this comment.
To be honest with you, I'm not convinced on the value of having this as a class vs. two independent functions.
What made you go for a class?
Addresses: #1113
advancedtutorial.