Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

Representing Quantum States using NumPy

P. K. Majumdar

Published Aug 1, 2026• 0 citations
Publisher

Abstract

This example demonstrates 1. Complex vectors 2. Scalar multiplication 3. Vector addition 4. Linear combinations 5. Vector space closure 6. Vector norms 7. State normalisation 8. Inner products 9. Orthogonality
DOI
10.5281/zenodo.21729808

Related papers

Vector spaces

Helmut Bez, Tony Croft

Vector spaces are the mathematical structures in which the state vectors of quantum computation live. When endowed with an inner product, a vector space becomes an inner product space. Of particular relevance are complex inner product spaces. An objective of this chapter is to provide a formal definition of a vector space and give several examples. You will see that, in this context, a ‘vector’ is a much more general object than vectors such as those in https://www.w3.org/1998/Math/MathML" display="inline"> ℝ 2 https://www.w3.org/1999/xlink" xlink:href=" https://s3-euw1-ap-pe-df-pch-content-public-p.s3.eu-west-1.amazonaws.com/9781003264569/7139ce19-0d58-4a0c-820f-b76fb033e438/content/math6_1.tif "/> and https://www.w3.org/1998/Math/MathML" display="inline"> ℝ 3 https://www.w3.org/1999/xlink" xlink:href=" https://s3-euw1-ap-pe-df-pch-content-public-p.s3.eu-west-1.amazonaws.com/9781003264569/7139ce19-0d58-4a0c-820f-b76fb033e438/content/math6_2.tif "/> . However, the already familiar operations of vector addition and scalar multiplication are essential ingredients of all vector spaces. We demonstrate how vectors in a vector space can be constructed using a set of vectors called a basis and see how vectors can be written in terms of different bases. Of particular importance are orthonormal bases in which the basis vectors are mutually orthogonal and normalised. Finally, we introduce cosets and explain how a quotient space is constructed.

Chapman & Hall/CRC eBooks•Jan 6, 2023•0 citations

States as Vectors

Tilak Sinha

From here, we take up the task of reformulating quantum mechanics in the language of inner product space. We start by introducing vector space through the familiar example of a set of finite dimensional, complex, column matrices under addition and multiplication by scalars. The inner product is then introduced as a dot product generalized to complex vectors leading to the idea of an inner product space . This is adequate to show how the concept of a quantum state can be described by a normalized vector in an inner product space so that the state space can be identified with the inner product space. Amplitudes are associated with inner products , and observables with orthonormal bases in this space. Hence the laws of quantum mechanics are reformulated. We then point out that the now reformulated laws are independent of the space of description and the reader is urged to contemplate an universality which would reflect the independence with respect to the representation space . This creates the stage for the introduction of the abstract inner product space and the formulation of quantum mechanics in this setting. The chapter concludes with this description. The transformed laws are now called postulatesof quantum mechanics .

Chapman & Hall/CRC eBooks•Jun 18, 2021•0 citations

Orthogonality Check

P. K. Majumdar

This Jupyter Notebook provides a reproducible implementation for determining whether two complex quantum state vectors are orthogonal The notebook accompanies Chapter 2 of Quantum Computing Preliminaries and demonstrates how orthogonality is tested using the absolute value of the complex inner product The Python function accepts normalised or unnormalised state vectors and normalises them automatically before calculating their overlap The implementation validates that both inputs are finite nonempty one dimensional and equal in size It also rejects the zero vector because the zero vector cannot be normalised The calculation uses the NumPy vdot function to apply complex conjugation to the first vector correctly A numerical tolerance is used to determine whether the absolute overlap is sufficiently close to zero The function returns True when the states are orthogonal and False otherwise The notebook includes examples involving the computational zero state the computational one state the plus state and two unnormalised complex vectors The examples confirm that the computational zero and one states are orthogonal while the computational zero and plus states are not orthogonal The unnormalised complex example also demonstrates a pair of states that are not orthogonal Numerical assertions verify all calculated results The notebook requires Python 3 Jupyter Notebook or JupyterLab and NumPy No external datasets internet connection quantum computing framework or physical quantum hardware are required

•Aug 11, 2026•0 citations

Simulating Quantum Superposition

P. K. Majumdar

This program constructs a linear combination of two normalised quantum state vectors and verifies closure with respect to array shape, dimensionality, size, and complex data type.

•Aug 4, 2026•0 citations

Constructing and Validating Quantum Projection Operators with NumPy

P. K. Majumdar

This program constructs a projection operator from a normalised complex state vector and verifies its Hermiticity, idempotence, trace and eigenvalues. It also generates the complementary projector, confirms that the two outcome projectors resolve the identity, and calculates measurement probabilities for an example input state. Numerical tolerances are used to accommodate floating-point arithmetic.

•Aug 25, 2026•0 citations

4. Euclidean spaces

Arnold Neumaier

There is a notational discrepancy in how mathematicians and physicists treat Hilbert spaces. In physics, one often works with finite-dimensional Hilbert spaces treated as ℂ n , and hence wants to write the Hermitian inner product as (x, y) = x ∗ y. This definition dictates the use of a Hermitian inner product that is antilinear in the first argument, the convention followed, for example, in Reed & Simon [246]. This is also the choice adopted in Dirac’s bracket notation, whose usage in quantum mechanics is very widespread. Our notation is chosen to extend-as closely as possible-the traditional notation of standard finite-dimensional matrix algebra to arbitrary complex inner product spaces and associated linear operators. In matrix algebra, column vectors and the corresponding matrices with one column are identical objects, row vectors are the linear functionals, and the adjoint is the conjugate transpose. For example, ℍ = ℍ × = ℂ n is the space of column vectors of size n, the dual space ℍ ∗ is the space of row vectors of size n, and the operator product ϕ ∗ ψ of a row vector ϕ ∗ and a column vector ψ is the standard Hermitian inner product of the column vectors ϕ and ψ. We use Greek lower case letters to write vectors, thus emphasizing their intended use as quantum state vectors in quantum mechanics. On the other hand, mathematicians working on reproducing kernel Hilbert spaces use an inner product (x, y) antilinear in the second argument, related to the physicist’s inner product (x, y) by (x, y) =( ). This is the convention followed, for example, in Rudin [252]. Although the two ways of defining the inner product lead to fully equivalent theories, all details look a bit different, a fact that has to be taken into account when reading the literature on the subject. For example, in the description based on the physical tradition, it is preferable to work with the antidual space in place of the dual space used in the mathematical tradition. In functional analysis, linear operators in Hilbert spaces are usually considered each with their own domain. But many computations in quantum mechanics require the consideration of algebras of operators with a common domain. The latter is a Euclidean space, a dense subspace of a Hilbert space. This space and its antidual play in many respects a more basic role in quantum physics than the Hilbert space itself. Therefore, and to avoid possible confusion caused by the different traditions, we give in the present chapter a self-contained introduction to Euclidean spaces and their associated spaces. All proofs are carried out in detail.

De Gruyter eBooks•Oct 24, 2019•0 citations
Vector spaces are the mathematical structures in which the state vectors of quantum computation live. When endowed with an inner product, a vector space becomes an inner product space. Of particular relevance are complex inner product spaces. An objective of this chapter is to provide a formal definition of a vector space and give several examples. You will see that, in this context, a ‘vector’ is a much more general object than vectors such as those in https://www.w3.org/1998/Math/MathML" display="inline"> ℝ 2 https://www.w3.org/1999/xlink" xlink:href=" https://s3-euw1-ap-pe-df-pch-content-public-p.s3.eu-west-1.amazonaws.com/9781003264569/7139ce19-0d58-4a0c-820f-b76fb033e438/content/math6_1.tif "/> and https://www.w3.org/1998/Math/MathML" display="inline"> ℝ 3 https://www.w3.org/1999/xlink" xlink:href=" https://s3-euw1-ap-pe-df-pch-content-public-p.s3.eu-west-1.amazonaws.com/9781003264569/7139ce19-0d58-4a0c-820f-b76fb033e438/content/math6_2.tif "/> . However, the already familiar operations of vector addition and scalar multiplication are essential ingredients of all vector spaces. We demonstrate how vectors in a vector space can be constructed using a set of vectors called a basis and see how vectors can be written in terms of different bases. Of particular importance are orthonormal bases in which the basis vectors are mutually orthogonal and normalised. Finally, we introduce cosets and explain how a quotient space is constructed.
From here, we take up the task of reformulating quantum mechanics in the language of inner product space. We start by introducing vector space through the familiar example of a set of finite dimensional, complex, column matrices under addition and multiplication by scalars. The inner product is then introduced as a dot product generalized to complex vectors leading to the idea of an inner product space . This is adequate to show how the concept of a quantum state can be described by a normalized vector in an inner product space so that the state space can be identified with the inner product space. Amplitudes are associated with inner products , and observables with orthonormal bases in this space. Hence the laws of quantum mechanics are reformulated. We then point out that the now reformulated laws are independent of the space of description and the reader is urged to contemplate an universality which would reflect the independence with respect to the representation space . This creates the stage for the introduction of the abstract inner product space and the formulation of quantum mechanics in this setting. The chapter concludes with this description. The transformed laws are now called postulatesof quantum mechanics .
This Jupyter Notebook provides a reproducible implementation for determining whether two complex quantum state vectors are orthogonal The notebook accompanies Chapter 2 of Quantum Computing Preliminaries and demonstrates how orthogonality is tested using the absolute value of the complex inner product The Python function accepts normalised or unnormalised state vectors and normalises them automatically before calculating their overlap The implementation validates that both inputs are finite nonempty one dimensional and equal in size It also rejects the zero vector because the zero vector cannot be normalised The calculation uses the NumPy vdot function to apply complex conjugation to the first vector correctly A numerical tolerance is used to determine whether the absolute overlap is sufficiently close to zero The function returns True when the states are orthogonal and False otherwise The notebook includes examples involving the computational zero state the computational one state the plus state and two unnormalised complex vectors The examples confirm that the computational zero and one states are orthogonal while the computational zero and plus states are not orthogonal The unnormalised complex example also demonstrates a pair of states that are not orthogonal Numerical assertions verify all calculated results The notebook requires Python 3 Jupyter Notebook or JupyterLab and NumPy No external datasets internet connection quantum computing framework or physical quantum hardware are required
There is a notational discrepancy in how mathematicians and physicists treat Hilbert spaces. In physics, one often works with finite-dimensional Hilbert spaces treated as ℂ n , and hence wants to write the Hermitian inner product as (x, y) = x ∗ y. This definition dictates the use of a Hermitian inner product that is antilinear in the first argument, the convention followed, for example, in Reed & Simon [246]. This is also the choice adopted in Dirac’s bracket notation, whose usage in quantum mechanics is very widespread. Our notation is chosen to extend-as closely as possible-the traditional notation of standard finite-dimensional matrix algebra to arbitrary complex inner product spaces and associated linear operators. In matrix algebra, column vectors and the corresponding matrices with one column are identical objects, row vectors are the linear functionals, and the adjoint is the conjugate transpose. For example, ℍ = ℍ × = ℂ n is the space of column vectors of size n, the dual space ℍ ∗ is the space of row vectors of size n, and the operator product ϕ ∗ ψ of a row vector ϕ ∗ and a column vector ψ is the standard Hermitian inner product of the column vectors ϕ and ψ. We use Greek lower case letters to write vectors, thus emphasizing their intended use as quantum state vectors in quantum mechanics. On the other hand, mathematicians working on reproducing kernel Hilbert spaces use an inner product (x, y) antilinear in the second argument, related to the physicist’s inner product (x, y) by (x, y) =( ). This is the convention followed, for example, in Rudin [252]. Although the two ways of defining the inner product lead to fully equivalent theories, all details look a bit different, a fact that has to be taken into account when reading the literature on the subject. For example, in the description based on the physical tradition, it is preferable to work with the antidual space in place of the dual space used in the mathematical tradition. In functional analysis, linear operators in Hilbert spaces are usually considered each with their own domain. But many computations in quantum mechanics require the consideration of algebras of operators with a common domain. The latter is a Euclidean space, a dense subspace of a Hilbert space. This space and its antidual play in many respects a more basic role in quantum physics than the Hilbert space itself. Therefore, and to avoid possible confusion caused by the different traditions, we give in the present chapter a self-contained introduction to Euclidean spaces and their associated spaces. All proofs are carried out in detail.