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.
Coefficients and operator actions
Section titled “Coefficients and operator actions”In an ordered orthonormal basis , store the coefficients as a complex vector. Define matrix entries by . The second index is the input and the first is the output, so
A transpose alone does not implement a bra. For , the bilinear expression vanishes, whereas . 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 is a rank-one density matrix. The inner product is a scalar. Array broadcasting may produce either shape without an error, so check the output dimensions. For a two-level system, take before and verify
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.
Grid samples and weighted normalization
Section titled “Grid samples and weighted normalization”Samples are generally not coefficients in an orthonormal basis. A quadrature rule with positive weights approximates the continuum inner product by
For a uniform interior grid with rectangle weights, . A normalized Euclidean vector therefore corresponds to samples , not . Confusing the two causes densities to change amplitude under grid refinement even when the state is correct.
If acts on samples, physical self-adjointness is represented by . The Euclidean representation
is Hermitian when this identity holds. For example, with and , the transformed matrix is . The unequal off-diagonal entries in compensate for unequal sample weights; they are not a defect to remove. Symmetrizing 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 , , the identity gives exactly. This is a useful normalization benchmark independent of a solver.
Tensor ordering and matrix-free operators
Section titled “Tensor ordering and matrix-free operators”For factors of dimensions , one possible flattened index is . The index then changes fastest. State this explicitly before reshaping a vector into , applying , 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 entries. A callable map 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 with for independently chosen complex vectors. Random checks can reveal mistakes, but cannot prove Hermiticity.
Checks before a calculation
Section titled “Checks before a calculation”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 with a declared nonzero scale 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.
Exercises
Section titled “Exercises”For , compute and verify its trace and purity.
Solution
has trace one and satisfies , hence . The sign of the off-diagonal element follows from conjugating the second factor.
Suppose and . Find its Euclidean representative and explain why is not its physical norm.
Solution
, so . The unweighted expression gives because the second sample carries four times the weight of the first.
References
Section titled “References”- 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.