Skip to content

Commit

Permalink
Change a few more sparse matrices to dense to get docs working (#802)
Browse files Browse the repository at this point in the history
- Docs are still failing due to taking exponentials of sparse matrices.
    - Change them to dense to get docs working.
  • Loading branch information
dstrain115 committed Sep 23, 2022
1 parent 8b1c2b4 commit 62fcd84
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/fqe/tutorials/fermi_hubbard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
"source": [
"from fqe.algorithm.low_rank import evolve_fqe_givens\n",
"\n",
"umat = expm(-1j * e_time * hopping_matrix)\n",
"umat = expm(-1j * e_time * hopping_matrix.todense())\n",
"evolved_wfn = evolve_fqe_givens(init_wfn, umat)"
]
},
Expand Down Expand Up @@ -429,7 +429,7 @@
"sparse_charge_charge_matrix = of.get_sparse_operator(sum(two_body_terms))\n",
"\n",
"# Exponentiate the matrix.\n",
"unitary = expm(-1j * e_time * sparse_charge_charge_matrix)\n",
"unitary = expm(-1j * e_time * sparse_charge_charge_matrix.todense())\n",
"\n",
"# Time-evolve the initial state.\n",
"evolved_cirq_wfn = unitary @ init_cirq_wfn"
Expand Down Expand Up @@ -530,7 +530,7 @@
"trotter_steps = 10\n",
"\n",
"# Evolution under the hopping Hamiltonian for a single Trotter step.\n",
"umat = expm(-1j * hopping_matrix * (e_time / trotter_steps))\n",
"umat = expm(-1j * hopping_matrix.todense() * (e_time / trotter_steps))\n",
"\n",
"# Simulate each Trotter step.\n",
"current_wfn = copy.deepcopy(init_wfn)\n",
Expand Down

0 comments on commit 62fcd84

Please sign in to comment.