| Copyright | (c) Scott N. Walck 2016 |
|---|---|
| License | BSD3 (see LICENSE) |
| Maintainer | Scott N. Walck <walck@lvc.edu> |
| Stability | experimental |
| Safe Haskell | Trustworthy |
| Language | Haskell98 |
Physics.Learn.QuantumMat
Contents
Description
This module contains state vectors and matrices for quantum mechanics.
- 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)
- couter :: Vector C -> Vector C -> Matrix C
- dm :: Vector C -> Matrix C
- trace :: Matrix C -> C
- normalizeDM :: Matrix C -> Matrix C
- oneQubitMixed :: Matrix C
- timeEv :: Double -> Matrix C -> Vector C -> Vector C
- timeEvMat :: Double -> Matrix C -> Matrix C
- possibleOutcomes :: Matrix C -> [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)
Density matrices
oneQubitMixed :: Matrix C Source
The one-qubit totally mixed state.
Quantum Dynamics
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.
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 with doing an explicit
matrix inversion. The function assumes hbar = 1.
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.
Vector and Matrix
data Vector a :: * -> *
Storable-based vectors
Instances
data Matrix t :: * -> *
Matrix representation suitable for BLAS/LAPACK computations.
Instances
| LSDiv Matrix | |
| Normed Matrix Double | |
| Normed Matrix Float | |
| (Num a, Element a, Container Vector a) => Container Matrix a | |
| Container Matrix t => Linear t Matrix | |
| Mul Matrix Matrix Matrix | |
| Mul Matrix Vector Vector | |
| Mul Vector Matrix Vector | |
| Normed Matrix (Complex Double) | |
| Normed Matrix (Complex Float) | |
| Representable Operator (Matrix C) Source | |
| (Num e, Container Vector e) => Konst e (Int, Int) Matrix | |
| (Storable t, NFData t) => NFData (Matrix t) | |
| Normed (Matrix R) | |
| Normed (Matrix C) | |
| Container Matrix t => Additive (Matrix t) | |
| KnownNat m => Testable (Matrix (Mod m I)) | |
| Storable t => TransArray (Matrix t) | |
| Element t => Indexable (Matrix t) (Vector t) | |
| (CTrans t, Container Vector t) => Transposable (Matrix t) (Matrix t) | |
| Container Matrix e => Build (Int, Int) (e -> e -> e) Matrix e | |
| type IndexOf Matrix = (Int, Int) | |
| type ArgOf Matrix a = a -> a -> a | |
| type ElementOf (Matrix a) = a | |
| type TransRaw (Matrix t) b = CInt -> CInt -> Ptr t -> b | |
| type Trans (Matrix t) b = CInt -> CInt -> CInt -> CInt -> Ptr t -> b |