# Quantum

**URL:** https://discourse.julialang.org/c/domain/quantum/52.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [About the Quantum category](https://discourse.julialang.org/t/about-the-quantum-category/44035)

<div class="topic-metadata">

**Author:** [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Replies:** 0

</div>

This subcategory is for discussion around quantum physics and related packages. Popular packages: Yao.jl QuantumOptics.jl ITensor.jl DFTK.jl Organizations: QuantumBFS JuliaMolSim JuliaPhysics JuliaAtoms There is a…

---

## [Setting \`abstol\` and \`reltol\` when solving the Schrödinger equation with OrdinaryDiffEq](https://discourse.julialang.org/t/setting-abstol-and-reltol-when-solving-the-schrodinger-equation-with-ordinarydiffeq/125534)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 27\
**Last updated:** [August 5, 2025, 9:10pm UTC](https://discourse.julialang.org/t/setting-abstol-and-reltol-when-solving-the-schrodinger-equation-with-ordinarydiffeq/125534 "2025-08-05T21:10:57Z")

</div>

Note: This topic was originally title “DiffEqOrdinaryDiffEq fails to preserve norm in simple Schrödinger equation”, which was solved by setting reltol. The more interesting part of the discussion is how to set abstol and…

---

## [2025 Summer School on Numerical Methods in Quantum Information Science](https://discourse.julialang.org/t/2025-summer-school-on-numerical-methods-in-quantum-information-science/127769)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 6\
**Last updated:** [April 23, 2025, 12:42pm UTC](https://discourse.julialang.org/t/2025-summer-school-on-numerical-methods-in-quantum-information-science/127769 "2025-04-23T12:42:38Z")

</div>

This July we are again running a summer school on numerical methods in quantum information science, mostly in Julia. It will be in Amherst, Massachusetts, on the campus of UMass Amherst, a whole week, for just 90$ thanks…

---

## [Enzyme AD with matrix exponential](https://discourse.julialang.org/t/enzyme-ad-with-matrix-exponential/123094)

<div class="topic-metadata">

**Author:** [@stone44](https://discourse.julialang.org/u/stone44)\
**Replies:** 22\
**Last updated:** [April 6, 2025, 10:43pm UTC](https://discourse.julialang.org/t/enzyme-ad-with-matrix-exponential/123094 "2025-04-06T22:43:00Z")

</div>

Hey, I am currently trying to use Enzyme’s gradient function to get the gradient of a quantum mechanical expectation value in respect to some parameters which go into the Hamiltonian. What causes a problem? AD with Enz…

---

## [\[ANN\] A database of quantum graph states equivalent under local operations](https://discourse.julialang.org/t/ann-a-database-of-quantum-graph-states-equivalent-under-local-operations/126013)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 0\
**Last updated:** [February 18, 2025, 3:10am UTC](https://discourse.julialang.org/t/ann-a-database-of-quantum-graph-states-equivalent-under-local-operations/126013 "2025-02-18T03:10:27Z")

</div>

Quantum graph states are a useful tool to study quantum entanglement and a resource in networking and computation. Knowing whether two graph states are equivalent under local operations is quite useful when studying how …

---

## [What is the collapsed state by measuring in arbitrary basis](https://discourse.julialang.org/t/what-is-the-collapsed-state-by-measuring-in-arbitrary-basis/125939)

<div class="topic-metadata">

**Author:** [@yao\_novice](https://discourse.julialang.org/u/yao_novice)\
**Replies:** 2\
**Last updated:** [February 17, 2025, 7:08am UTC](https://discourse.julialang.org/t/what-is-the-collapsed-state-by-measuring-in-arbitrary-basis/125939 "2025-02-17T07:08:52Z")

</div>

Goal: Measure a 2 qubit state \\quad\\displaystyle{ |\\psi\\rangle = \\frac{1}{5} \\begin{pmatrix} 4 \\\\ 2i\\\\ 1\\\\ -2\\\\ \\end{pmatrix} } in the basis of the eigenvectors of operator X \\otimes Y This basis is \\quad\\displaystyle{…

---

## [Tensor in QuantumOptics](https://discourse.julialang.org/t/tensor-in-quantumoptics/125618)

<div class="topic-metadata">

**Author:** [@gustave\_Robichon](https://discourse.julialang.org/u/gustave_Robichon)\
**Replies:** 2\
**Last updated:** [February 12, 2025, 4:21pm UTC](https://discourse.julialang.org/t/tensor-in-quantumoptics/125618 "2025-02-12T16:21:06Z")

</div>

Hello :slight\_smile: I have a program using QuantumOptics. It uses several bosonic modes. While writing the Hamiltonian, I wonder if I should explictly use the tensor product : I\[1\] tensor I\[2\] tensor a\[3\] for exemple, …

---

## [What does Yao.Measure do with argument operator?](https://discourse.julialang.org/t/what-does-yao-measure-do-with-argument-operator/125546)

<div class="topic-metadata">

**Author:** [@yao\_novice](https://discourse.julialang.org/u/yao_novice)\
**Replies:** 2\
**Last updated:** [February 5, 2025, 6:49am UTC](https://discourse.julialang.org/t/what-does-yao-measure-do-with-argument-operator/125546 "2025-02-05T06:49:46Z")

</div>

I experiment with Yao.jl and I am puzzled with the ‘Measure’-blocks ‘operator’ argument. I assumed that the input state would end up with an eigenstate of the operator-matrix - but this seems not to be true. Here is my …

---

## [Error running master equation in QuantumOptics.jl](https://discourse.julialang.org/t/error-running-master-equation-in-quantumoptics-jl/122300)

<div class="topic-metadata">

**Author:** [@DominicDams](https://discourse.julialang.org/u/DominicDams)\
**Replies:** 3\
**Last updated:** [November 5, 2024, 9:00pm UTC](https://discourse.julialang.org/t/error-running-master-equation-in-quantumoptics-jl/122300 "2024-11-05T21:00:28Z")

</div>

When running the following code: using QuantumOptics using Plots b = SpinBasis(1//2) γ = 1 Ω₀ = .2 δ = .2 σ₋ = sigmam(b)#DenseOperator(b,\[ 0 1; 0 0\]) σ₊ =sigmap(b)# DenseOperator(b, \[ 0 0; 1 0\]) σz = sigmaz(b)#DenseOper…

---

## [Measure in arbitrary bases - how to find quantum gates](https://discourse.julialang.org/t/measure-in-arbitrary-bases-how-to-find-quantum-gates/120923)

<div class="topic-metadata">

**Author:** [@yao\_novice](https://discourse.julialang.org/u/yao_novice)\
**Replies:** 4\
**Last updated:** [October 8, 2024, 2:19am UTC](https://discourse.julialang.org/t/measure-in-arbitrary-bases-how-to-find-quantum-gates/120923 "2024-10-08T02:19:50Z")

</div>

I have a qubit |ψ⟩ and I want it to measure in bell states. My procedure is now to calculate the transformation matrix U=Σ|i⟩⟨b\_i| where |i⟩ is the computation basis and ⟨b\_i| are the bell states. It works so far. The …

---

## [Measure a certain computational base like |0\> or |1\>?](https://discourse.julialang.org/t/measure-a-certain-computational-base-like-0-or-1/119650)

<div class="topic-metadata">

**Author:** [@yao\_novice](https://discourse.julialang.org/u/yao_novice)\
**Replies:** 2\
**Last updated:** [September 20, 2024, 7:31pm UTC](https://discourse.julialang.org/t/measure-a-certain-computational-base-like-0-or-1/119650 "2024-09-20T19:31:56Z")

</div>

Simple qubit state: 1/5\*\[3, 4i\] measurement against |0\> should result in 0.36 against |1\> → 0.64 import Yao reg = Yao.ArrayReg(\[3.0, 4.0im\]) # a unnormalized state Yao.normalize!(reg) shots = 10000 m=Yao.measure(Ya…

---

## ["Compiling" HIR produced by \`ZXCalculus.jl\`](https://discourse.julialang.org/t/compiling-hir-produced-by-zxcalculus-jl/119221)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 5\
**Last updated:** [September 10, 2024, 5:12pm UTC](https://discourse.julialang.org/t/compiling-hir-produced-by-zxcalculus-jl/119221 "2024-09-10T17:12:13Z")

</div>

I would like to explore the affects of ZX calculus on the synthesis of certain quantum circuits. Thankfully, I saw that Yao has a native Julia implementation in ZXCalculus.jl! However, it seems to me its documentation mi…

---

## [NaN Values for j \> 1700 in Quantum Fisher Information Calculation using QuantumOptics](https://discourse.julialang.org/t/nan-values-for-j-1700-in-quantum-fisher-information-calculation-using-quantumoptics/118923)

<div class="topic-metadata">

**Author:** [@Dawn](https://discourse.julialang.org/u/Dawn)\
**Replies:** 9\
**Last updated:** [September 3, 2024, 2:38pm UTC](https://discourse.julialang.org/t/nan-values-for-j-1700-in-quantum-fisher-information-calculation-using-quantumoptics/118923 "2024-09-03T14:38:00Z")

</div>

I’m calculating the Quantum Fisher Information (QFI) for the kicked top system using the QuantumOptics package in Julia. The code works fine for initial states with j up to 1700, but when I increase j to 1800 or higher, …

---

## [Simulating quantum Hamiltonian evolution with Yao](https://discourse.julialang.org/t/simulating-quantum-hamiltonian-evolution-with-yao/117287)

<div class="topic-metadata">

**Author:** [@jzzhuang](https://discourse.julialang.org/u/jzzhuang)\
**Replies:** 8\
**Last updated:** [August 13, 2024, 12:37pm UTC](https://discourse.julialang.org/t/simulating-quantum-hamiltonian-evolution-with-yao/117287 "2024-08-13T12:37:58Z")

</div>

Hi everyone, I’ve been using Yao.jl to simulate quantum evolution and encountered an issue with the time evolution function being unexpectedly slow. Notably, it performs much slower than in Mathematica. Here’s a snippet…

---

## [\[crosspost\] Bounties and mini grants for work on network simulation, Clifford circuits, quantum symbolics, and more](https://discourse.julialang.org/t/crosspost-bounties-and-mini-grants-for-work-on-network-simulation-clifford-circuits-quantum-symbolics-and-more/117715)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 0\
**Last updated:** [August 1, 2024, 4:16am UTC](https://discourse.julialang.org/t/crosspost-bounties-and-mini-grants-for-work-on-network-simulation-clifford-circuits-quantum-symbolics-and-more/117715 "2024-08-01T04:16:22Z")

</div>

Just now I posted in another subforum the newly funded (by NSF) bounties and mini grants for software development in quantum information science. Give the possible interface in this specific domain, I am cross-posting h…

---

## [GRAPE code for Khaneja et al. "Optimal Control of Coupled Spin Dynamics: Design of NMR Pulse Sequences by Gradient Ascent Algorithms"](https://discourse.julialang.org/t/grape-code-for-khaneja-et-al-optimal-control-of-coupled-spin-dynamics-design-of-nmr-pulse-sequences-by-gradient-ascent-algorithms/117085)

<div class="topic-metadata">

**Author:** [@fqguo](https://discourse.julialang.org/u/fqguo)\
**Replies:** 6\
**Last updated:** [July 16, 2024, 1:13pm UTC](https://discourse.julialang.org/t/grape-code-for-khaneja-et-al-optimal-control-of-coupled-spin-dynamics-design-of-nmr-pulse-sequences-by-gradient-ascent-algorithms/117085 "2024-07-16T13:13:55Z")

</div>

I want to write gradient ascent pulse engineering (GRAPE) and I try the simple Hamiltonian H=\\Omega\*|0\\rangle\\langle 1| + \\Omega\*|1\\rangle\\langle 0|. The initial state is |0\\rangle\\langle 0| and the final state is |1\\ran…

---

## [Weird behaviour of steadystate.eigenvector function returns any while it should return the type operator](https://discourse.julialang.org/t/weird-behaviour-of-steadystate-eigenvector-function-returns-any-while-it-should-return-the-type-operator/117002)

<div class="topic-metadata">

**Author:** [@Arpan\_Chatterjee1](https://discourse.julialang.org/u/Arpan_Chatterjee1)\
**Replies:** 0\
**Last updated:** [July 13, 2024, 3:36pm UTC](https://discourse.julialang.org/t/weird-behaviour-of-steadystate-eigenvector-function-returns-any-while-it-should-return-the-type-operator/117002 "2024-07-13T15:36:40Z")

</div>

I was doing a simulation of calculating the population of a 3-state system interacting with a cavity mode. Part of the code is given as follows function pop(g, Ω23, Ω12, Δ23\_list, Δ12\_list, Δ, Γ31, Γ32, κ, a,…

---

## [How to obtain first 10 eigenvalues of a ITensorMPO.MPS Hamiltonian](https://discourse.julialang.org/t/how-to-obtain-first-10-eigenvalues-of-a-itensormpo-mps-hamiltonian/116430)

<div class="topic-metadata">

**Author:** [@Ayush](https://discourse.julialang.org/u/Ayush)\
**Replies:** 1\
**Last updated:** [July 1, 2024, 1:36am UTC](https://discourse.julialang.org/t/how-to-obtain-first-10-eigenvalues-of-a-itensormpo-mps-hamiltonian/116430 "2024-07-01T01:36:34Z")

</div>

I have a code for an Ising model defined by a Hamiltonian. I want to obtain the first 10 eigenvalues of that hamiltonian. I tried 2 different approaches: a) First convert it into a sparse matrix and then use arpack’s eig…

---

## [\`timeevolution.master\_dynamic\` cannot run correctly](https://discourse.julialang.org/t/timeevolution-master-dynamic-cannot-run-correctly/115915)

<div class="topic-metadata">

**Author:** [@fqguo](https://discourse.julialang.org/u/fqguo)\
**Replies:** 6\
**Last updated:** [June 21, 2024, 12:35pm UTC](https://discourse.julialang.org/t/timeevolution-master-dynamic-cannot-run-correctly/115915 "2024-06-21T12:35:11Z")

</div>

I have another question on timeevolution.master\_dynamic and timeevolution.schroedinger\_dynamic. I run the same code on time-evolution system by timeevolution.master\_dynamic with density operator and timeevolution.schroed…

---

## [Automatic differentiation with density matrix in yao](https://discourse.julialang.org/t/automatic-differentiation-with-density-matrix-in-yao/115467)

<div class="topic-metadata">

**Author:** [@stone44](https://discourse.julialang.org/u/stone44)\
**Replies:** 9\
**Last updated:** [June 21, 2024, 12:21pm UTC](https://discourse.julialang.org/t/automatic-differentiation-with-density-matrix-in-yao/115467 "2024-06-21T12:21:47Z")

</div>

Hey there, i am currently implementing a quantum variational algorithm, where my goal is to minimize a cost function, where i use a gradient based optimzer. Since i have no analytically closed form of my gradient, i am …

---

## [Computing fidelity of quantum state](https://discourse.julialang.org/t/computing-fidelity-of-quantum-state/115264)

<div class="topic-metadata">

**Author:** [@fqguo](https://discourse.julialang.org/u/fqguo)\
**Replies:** 6\
**Last updated:** [June 6, 2024, 2:24pm UTC](https://discourse.julialang.org/t/computing-fidelity-of-quantum-state/115264 "2024-06-06T14:24:15Z")

</div>

I write my program, however, i cannot plot the correct figure. When i use the ket psi\_0 as initial state, i can plot the correct figure same Matlab. However, when i use the density psi\_0⊗dagger(psi\_0), i cannot plot the…

---

## [Liouvillian superoperator way cannot run by \`timeevolution.master\_dynamic\` of QuantumOptics.jl](https://discourse.julialang.org/t/liouvillian-superoperator-way-cannot-run-by-timeevolution-master-dynamic-of-quantumoptics-jl/113650)

<div class="topic-metadata">

**Author:** [@fqguo](https://discourse.julialang.org/u/fqguo)\
**Replies:** 12\
**Last updated:** [May 6, 2024, 3:02am UTC](https://discourse.julialang.org/t/liouvillian-superoperator-way-cannot-run-by-timeevolution-master-dynamic-of-quantumoptics-jl/113650 "2024-05-06T03:02:22Z")

</div>

When i use the package QuantumOptics.jl to simulate the evolution of Liouvillian superoperator, i find it cannot run by the command timeevolution.master\_dynamic. Because after obtaining the superoperator, i ready to solv…

---

## [Spectrum of open hamiltonian in Quantica](https://discourse.julialang.org/t/spectrum-of-open-hamiltonian-in-quantica/113731)

<div class="topic-metadata">

**Author:** [@Milt](https://discourse.julialang.org/u/Milt)\
**Replies:** 1\
**Last updated:** [May 2, 2024, 3:51pm UTC](https://discourse.julialang.org/t/spectrum-of-open-hamiltonian-in-quantica/113731 "2024-05-02T15:51:42Z")

</div>

Hi @pablosanjose , I am trying to evaluate the spectrum for a graphene ribbon of varying widths. I am trying to do this by attaching leads to graphene resulting in an open hamiltonian but this is not compatible with the…

---

## [Lambda Systems](https://discourse.julialang.org/t/lambda-systems/113572)

<div class="topic-metadata">

**Author:** [@avishipoddar](https://discourse.julialang.org/u/avishipoddar)\
**Replies:** 6\
**Last updated:** [April 27, 2024, 7:41pm UTC](https://discourse.julialang.org/t/lambda-systems/113572 "2024-04-27T19:41:02Z")

</div>

I am trying to simulate a 3-level lambda system. I have defined the operators such as sigma\_ee, sigma\_es, sigma\_eg, etc. as 3-level matrices. To build the Hamiltonian as an MPO, do I use spin-1?

---

## [\[crosspost\] Summer School on Numerica Methods in QIS](https://discourse.julialang.org/t/crosspost-summer-school-on-numerica-methods-in-qis/113445)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 0\
**Last updated:** [April 24, 2024, 12:58pm UTC](https://discourse.julialang.org/t/crosspost-summer-school-on-numerica-methods-in-qis/113445 "2024-04-24T12:58:24Z")

</div>

Hi, QIS folks! A cross-post from the general board (look there for more details) The NSF Center for Quantum Networks and the Unitary Fund will be running a summer school on classical numerical methods for quantum infor…

---

## [Attaching leads to honeycomb lattice](https://discourse.julialang.org/t/attaching-leads-to-honeycomb-lattice/111304)

<div class="topic-metadata">

**Author:** [@alex123](https://discourse.julialang.org/u/alex123)\
**Replies:** 6\
**Last updated:** [April 12, 2024, 9:30am UTC](https://discourse.julialang.org/t/attaching-leads-to-honeycomb-lattice/111304 "2024-04-12T09:30:41Z")

</div>

Hi, I am trying to attach leads with a honeycomb basis to a honeycomb lattice, and can’t seem to understand why my code doesn’t work, I don’t really understand the logic of attaching the lead (and how the r variable is …

---

## [Extracting numerical results from hamiltonian using Quantica](https://discourse.julialang.org/t/extracting-numerical-results-from-hamiltonian-using-quantica/107809)

<div class="topic-metadata">

**Author:** [@alex123](https://discourse.julialang.org/u/alex123)\
**Replies:** 7\
**Last updated:** [February 13, 2024, 7:10pm UTC](https://discourse.julialang.org/t/extracting-numerical-results-from-hamiltonian-using-quantica/107809 "2024-02-13T19:10:29Z")

</div>

Hi, I am using Quantica for finding the band structure of twisted bilayer graphene. Here is the part of my code that finds the hamiltonian: b = hamiltonian(tbg, model) |\> bands(subdiv((0, 2, 3, 4), 20); mapping=(0, 2,…

---

## [DOS and LDOS using Quantica](https://discourse.julialang.org/t/dos-and-ldos-using-quantica/109822)

<div class="topic-metadata">

**Author:** [@alex123](https://discourse.julialang.org/u/alex123)\
**Replies:** 1\
**Last updated:** [February 7, 2024, 7:37am UTC](https://discourse.julialang.org/t/dos-and-ldos-using-quantica/109822 "2024-02-07T07:37:32Z")

</div>

Hello @pablosanjose , looking through the Quantica documentation, I could only see how to find the LDOS at a fixed energy at all sites in the lattice. Is there a way to get the LDOS at a fixed position for a range of en…

---

## [How to compute the bipartite entanglement entropy with the first site as the subsystem us orthogonalize？？](https://discourse.julialang.org/t/how-to-compute-the-bipartite-entanglement-entropy-with-the-first-site-as-the-subsystem-us-orthogonalize/107509)

<div class="topic-metadata">

**Author:** [@zipeilee](https://discourse.julialang.org/u/zipeilee)\
**Replies:** 3\
**Last updated:** [December 13, 2023, 3:17am UTC](https://discourse.julialang.org/t/how-to-compute-the-bipartite-entanglement-entropy-with-the-first-site-as-the-subsystem-us-orthogonalize/107509 "2023-12-13T03:17:54Z")

</div>

I’m new to tensor networks. I understand that for an MPS state in the form of orthogonalization, the bipartite entanglement entropy of a subsystem is center site’s singular spectrum. I’ve found useful code on ITensors.jl…

---

## [How to define a TT-cross implementation using ITensors without usage of for loops](https://discourse.julialang.org/t/how-to-define-a-tt-cross-implementation-using-itensors-without-usage-of-for-loops/105472)

<div class="topic-metadata">

**Author:** [@matinator](https://discourse.julialang.org/u/matinator)\
**Replies:** 0\
**Last updated:** [October 27, 2023, 8:58am UTC](https://discourse.julialang.org/t/how-to-define-a-tt-cross-implementation-using-itensors-without-usage-of-for-loops/105472 "2023-10-27T08:58:03Z")

</div>

Hello everyone I was trying to define the following ket state from a paper which has the following equation: where \\varphi is a complex valued function, the only way I was able to produce this is by the usage of the …

[Next page](https://discourse.julialang.org/c/domain/quantum/52.md?page=1)
