minor improvements to examples, documentation, internally used variable names

This commit is contained in:
mattia-robbiano
2025-11-13 10:45:32 +02:00
parent 7ea8dc861b
commit d4ab3eba52
2 changed files with 59 additions and 33 deletions

View File

@@ -28,7 +28,7 @@
},
{
"cell_type": "markdown",
"id": "a009a5e0-cfd4-4a49-9f7c-e82f252c6147",
"id": "0c5a8939",
"metadata": {},
"source": [
"#### Some hyper parameters"
@@ -36,24 +36,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"id": "b0a1da82",
"metadata": {},
"outputs": [],
"source": [
"import cotengra as ctg\n",
"ctg_opt = ctg.ReusableHyperOptimizer(\n",
" max_time=10,\n",
" minimize='combo',\n",
" slicing_opts=None,\n",
" parallel=True,\n",
" progbar=True\n",
")\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "64162116-1555-4a68-811c-01593739d622",
"metadata": {},
"outputs": [],
@@ -67,7 +50,39 @@
"# set numpy random seed\n",
"np.random.seed(42)\n",
"\n",
"quimb_backend.setup_backend_specifics(quimb_backend=\"jax\")"
"quimb_backend.setup_backend_specifics(quimb_backend=\"jax\", contractions_optimizer='auto-hq')"
]
},
{
"cell_type": "markdown",
"id": "926cfea5",
"metadata": {},
"source": [
"Quimb accepts different methods for optimizing the way it does contractions, that we pass through \"contractions_optimizer\". \n",
"We could also define our own cotengra contraction optimizer! \n",
"\n",
"cotengra is a Python library designed for **optimising contraction trees** and performing efficient contractions of large tensornetworks.\n",
"You can find it here: [https://github.com/jcmgray/cotengra](https://github.com/jcmgray/cotengra)\n",
"\n",
"For the sake of this tutorial however the default \"auto-hq\" will be fine :) "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b0a1da82",
"metadata": {},
"outputs": [],
"source": [
"import cotengra as ctg\n",
"ctg_opt = ctg.ReusableHyperOptimizer(\n",
" max_time=10,\n",
" minimize='combo',\n",
" slicing_opts=None,\n",
" parallel=True,\n",
" progbar=True\n",
")\n",
"# quimb_backend.setup_backend_specifics(quimb_backend=\"jax\", contractions_optimizer='ctg_opt')"
]
},
{