Copyright | (c) Scott N. Walck 2016-2018 |
---|---|
License | BSD3 (see LICENSE) |
Maintainer | Scott N. Walck <walck@lvc.edu> |
Stability | experimental |
Safe Haskell | Trustworthy |
Language | Haskell98 |
This module contains state vectors and matrices for quantum mechanics.
Synopsis
- type C = Complex Double
- xp :: Vector C
- xm :: Vector C
- yp :: Vector C
- ym :: Vector C
- zp :: Vector C
- zm :: Vector C
- np :: Double -> Double -> Vector C
- nm :: Double -> Double -> Vector C
- dim :: Vector C -> Int
- scaleV :: C -> Vector C -> Vector C
- inner :: Vector C -> Vector C -> C
- norm :: Vector C -> Double
- normalize :: Vector C -> Vector C
- probVector :: Vector C -> Vector Double
- gramSchmidt :: [Vector C] -> [Vector C]
- conjV :: Vector C -> Vector C
- fromList :: [C] -> Vector C
- toList :: Vector C -> [C]
- sx :: Matrix C
- sy :: Matrix C
- sz :: Matrix C
- scaleM :: C -> Matrix C -> Matrix C
- (<>) :: Matrix C -> Matrix C -> Matrix C
- (#>) :: Matrix C -> Vector C -> Vector C
- (<#) :: Vector C -> Matrix C -> Vector C
- conjugateTranspose :: Matrix C -> Matrix C
- fromLists :: [[C]] -> Matrix C
- toLists :: Matrix C -> [[C]]
- size :: Matrix C -> (Int, Int)
- matrixFunction :: (C -> C) -> Matrix C -> Matrix C
- couter :: Vector C -> Vector C -> Matrix C
- dm :: Vector C -> Matrix C
- trace :: Matrix C -> C
- normalizeDM :: Matrix C -> Matrix C
- oneQubitMixed :: Matrix C
- timeEvMat :: Double -> Matrix C -> Matrix C
- timeEv :: Double -> Matrix C -> Vector C -> Vector C
- timeEvMatSpec :: Matrix C -> Double -> Matrix C
- class Kronecker a where
- possibleOutcomes :: Matrix C -> [Double]
- outcomesProjectors :: Matrix C -> [(Double, Matrix C)]
- outcomesProbabilities :: Matrix C -> Vector C -> [(Double, Double)]
- data Vector a
- data Matrix t
Complex numbers
State Vectors
The state resulting from a measurement of spin angular momentum in the x direction on a spin-1/2 particle when the result of the measurement is hbar/2.
The state resulting from a measurement of spin angular momentum in the x direction on a spin-1/2 particle when the result of the measurement is -hbar/2.
The state resulting from a measurement of spin angular momentum in the y direction on a spin-1/2 particle when the result of the measurement is hbar/2.
The state resulting from a measurement of spin angular momentum in the y direction on a spin-1/2 particle when the result of the measurement is -hbar/2.
The state resulting from a measurement of spin angular momentum in the z direction on a spin-1/2 particle when the result of the measurement is hbar/2.
The state resulting from a measurement of spin angular momentum in the z direction on a spin-1/2 particle when the result of the measurement is -hbar/2.
np :: Double -> Double -> Vector C Source #
The state resulting from a measurement of spin angular momentum in the direction specified by spherical angles theta (polar angle) and phi (azimuthal angle) on a spin-1/2 particle when the result of the measurement is hbar/2.
nm :: Double -> Double -> Vector C Source #
The state resulting from a measurement of spin angular momentum in the direction specified by spherical angles theta (polar angle) and phi (azimuthal angle) on a spin-1/2 particle when the result of the measurement is -hbar/2.
Return a vector of probabilities for a given state vector.
gramSchmidt :: [Vector C] -> [Vector C] Source #
Form an orthonormal list of complex vectors from a linearly independent list of complex vectors.
Matrices (operators)
matrixFunction :: (C -> C) -> Matrix C -> Matrix C Source #
Apply a function to a matrix. Assumes the matrix is a normal matrix (a matrix with an orthonormal basis of eigenvectors).
Density matrices
oneQubitMixed :: Matrix C Source #
The one-qubit totally mixed state.
Quantum Dynamics
timeEvMat :: Double -> Matrix C -> Matrix C Source #
Given a time step and a Hamiltonian matrix,
produce a unitary time evolution matrix.
Unless you really need the time evolution matrix,
it is better to use timeEv
, which gives the
same numerical results without doing an explicit
matrix inversion. The function assumes hbar = 1.
timeEv :: Double -> Matrix C -> Vector C -> Vector C Source #
Given a time step and a Hamiltonian matrix,
advance the state vector using the Schrodinger equation.
This method should be faster than using timeEvMat
since it solves a linear system rather than calculating
an inverse matrix. The function assumes hbar = 1.
timeEvMatSpec :: Matrix C -> Double -> Matrix C Source #
Given a Hamiltonian matrix, return a function from time to evolution matrix. Uses spectral decomposition. Assumes hbar = 1.
Composition
Measurement
possibleOutcomes :: Matrix C -> [Double] Source #
The possible outcomes of a measurement of an observable. These are the eigenvalues of the matrix of the observable.
outcomesProjectors :: Matrix C -> [(Double, Matrix C)] Source #
Given an obervable, return a list of pairs of possible outcomes and projectors for each outcome.
outcomesProbabilities :: Matrix C -> Vector C -> [(Double, Double)] Source #
Given an observable and a state vector, return a list of pairs of possible outcomes and probabilites for each outcome.
Vector and Matrix
Storable
-based vectors
Instances
Matrix representation suitable for BLAS/LAPACK computations.