Skip to content

Representing States and Operators as Arrays

A quantum array acquires meaning from its ordered basis, number type, and inner product. The same list of numbers can represent different states under different conventions. Start by deciding what each entry means, how to normalize the vector, and how an operator acts on it; then choose an eigensolver or propagator.

Required background. Inner products supply conjugation and normalization; change of basis explains why coordinates can change while predictions remain invariant.

In an ordered orthonormal basis {∣ej⟩}j=0d−1\{\lvert e_j\rangle\}_{j=0}^{d-1}, store the coefficients cj=⟨ej∣ψ⟩c_j=\langle e_j\vert\psi\rangle as a complex vector. Define matrix entries by Aij=⟨ei∣A∣ej⟩A_{ij}=\langle e_i\vert A\vert e_j\rangle. The second index is the input and the first is the output, so

(Ac)i=∑jAijcj,⟨A⟩=c†Ac,∥c∥2=c†c.(Ac)_i=\sum_j A_{ij}c_j, \qquad \langle A\rangle=c^\dagger Ac, \qquad \|c\|^2=c^\dagger c.

A transpose alone does not implement a bra. For c=(1,i)T/2c=(1,i)^T/\sqrt2, the bilinear expression cTcc^Tc vanishes, whereas c†c=1c^\dagger c=1. This example catches a conjugation error that tests with real vectors cannot reveal. Use complex test states even when a Hamiltonian happens to be real.

For a normalized nonzero vector, the outer product cc†cc^\dagger is a rank-one density matrix. The inner product c†cc^\dagger c is a scalar. Array broadcasting may produce either shape without an error, so check the output dimensions. For a two-level system, take ∣0⟩\lvert0\rangle before ∣1⟩\lvert1\rangle and verify

σy12(1i)=12(1i),σy=(0−ii0).\sigma_y\frac{1}{\sqrt2}\binom{1}{i} =\frac{1}{\sqrt2}\binom{1}{i}, \qquad \sigma_y=\begin{pmatrix}0&-i\\i&0\end{pmatrix}.

This checks the basis order, complex dtype, and signs in a single operator action. A real array that discards imaginary parts changes the physical state.

Samples ψj=ψ(xj)\psi_j=\psi(x_j) are generally not coefficients in an orthonormal basis. A quadrature rule with positive weights wjw_j approximates the continuum inner product by

⟨ϕ∣ψ⟩≈ϕ†Wψ,W=diag⁡(wj).\langle\phi\vert\psi\rangle \approx \phi^\dagger W\psi, \qquad W=\operatorname{diag}(w_j).

For a uniform interior grid with rectangle weights, W=hIW=hI. A normalized Euclidean vector therefore corresponds to samples ψj=cj/h\psi_j=c_j/\sqrt h, not ψj=cj\psi_j=c_j. Confusing the two causes densities to change amplitude under grid refinement even when the state is correct.

If DD acts on samples, physical self-adjointness is represented by D†W=WDD^\dagger W=WD. The Euclidean representation

c=W1/2ψ,A=W1/2DW−1/2c=W^{1/2}\psi, \qquad A=W^{1/2}DW^{-1/2}

is Hermitian when this identity holds. For example, with W=diag⁡(1,4)W=\operatorname{diag}(1,4) and D=(021/20)D=\begin{pmatrix}0&2\\1/2&0\end{pmatrix}, the transformed matrix is A=(0110)A=\begin{pmatrix}0&1\\1&0\end{pmatrix}. The unequal off-diagonal entries in DD compensate for unequal sample weights; they are not a defect to remove. Symmetrizing DD with an ordinary transpose would change the discretization. For finite-element coefficients, the analogous weight is a full positive-definite overlap matrix; see basis choice.

For the square-well samples ψj=2/Lsin⁡(πj/(N+1))\psi_j=\sqrt{2/L}\sin(\pi j/(N+1)), h=L/(N+1)h=L/(N+1), the identity ∑j=1Nsin⁡2(πj/(N+1))=(N+1)/2\sum_{j=1}^N\sin^2(\pi j/(N+1))=(N+1)/2 gives h∑j∣ψj∣2=1h\sum_j|\psi_j|^2=1 exactly. This is a useful normalization benchmark independent of a solver.

For factors of dimensions dA,dBd_A,d_B, one possible flattened index is k=adB+bk=a d_B+b. The BB index then changes fastest. State this explicitly before reshaping a vector into CabC_{ab}, applying A⊗IA\otimes I, or tracing out a subsystem. A library’s memory storage order does not by itself declare the physical subsystem convention.

An operator need not be stored as all d2d^2 entries. A callable map c↦Acc\mapsto Ac can implement a stencil or sum of local interactions. Specify its dimension, number type, basis ordering, and an adjoint action when required. Verify linearity and, for Hermitian operators, compare u†Avu^\dagger Av with (Au)†v(Au)^\dagger v for independently chosen complex vectors. Random checks can reveal mistakes, but cannot prove Hermiticity.

Record the basis labels, ordering, physical units, and normalization convention with the arrays. Test one hand-computable action, then compare expectation values before and after a small unitary basis transformation. Check Hermiticity relative to an operator scale, for example ∥A−A†∥/max⁡(∥A∥,a0)\|A-A^\dagger\|/\max(\|A\|,a_0) with a declared nonzero scale a0a_0 carrying the same units. Absolute tolerances alone are inappropriate when changing energy units.

These checks detect representation mistakes. They do not establish that a finite basis or grid approximates the continuum accurately; that is the purpose of convergence studies.

For c=(1,i)T/2c=(1,i)^T/\sqrt2, compute ρ=cc†\rho=cc^\dagger and verify its trace and purity.

Solution

ρ=12(1−ii1)\rho=\tfrac12\begin{pmatrix}1&-i\\i&1\end{pmatrix} has trace one and satisfies ρ2=ρ\rho^2=\rho, hence Tr⁡ρ2=1\operatorname{Tr}\rho^2=1. The sign of the off-diagonal element follows from conjugating the second factor.

Suppose W=diag⁡(1,4)W=\operatorname{diag}(1,4) and ψ=(1,1)T/5\psi=(1,1)^T/\sqrt5. Find its Euclidean representative and explain why ψ†ψ\psi^\dagger\psi is not its physical norm.

Solution

c=W1/2ψ=(1,2)T/5c=W^{1/2}\psi=(1,2)^T/\sqrt5, so c†c=1=ψ†Wψc^\dagger c=1=\psi^\dagger W\psi. The unweighted expression gives 2/52/5 because the second sample carries four times the weight of the first.

  • Anderson, E., et al., LAPACK Users’ Guide, 3rd ed., SIAM, 1999, Accuracy and Stability — matrix problem structure and interpretation of numerical accuracy.
  • Golub, G. H., and C. F. Van Loan, Matrix Computations, 4th ed., Johns Hopkins University Press, 2013 — complex matrix algebra, inner products, and structured computations.