learn-physics-0.6.3: Haskell code for learning physics

Copyright(c) Scott N. Walck 2016-2018
LicenseBSD3 (see LICENSE)
MaintainerScott N. Walck <walck@lvc.edu>
Stabilityexperimental
Safe HaskellTrustworthy
LanguageHaskell98

Physics.Learn.QuantumMat

Contents

Description

This module contains state vectors and matrices for quantum mechanics.

Synopsis

Complex numbers

type C = Complex Double #

State Vectors

xp :: Vector C Source #

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.

xm :: Vector C Source #

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.

yp :: Vector C Source #

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.

ym :: Vector C Source #

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.

zp :: Vector C Source #

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.

zm :: Vector C Source #

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.

dim :: Vector C -> Int Source #

Dimension of a vector.

scaleV :: C -> Vector C -> Vector C Source #

Scale a complex vector by a complex number.

inner :: Vector C -> Vector C -> C Source #

Complex inner product. First vector gets conjugated.

norm :: Vector C -> Double Source #

Length of a complex vector.

normalize :: Vector C -> Vector C Source #

Return a normalized version of a given state vector.

probVector Source #

Arguments

:: Vector C

state vector

-> Vector Double

vector of probabilities

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.

conjV :: Vector C -> Vector C Source #

Conjugate the entries of a vector.

fromList :: [C] -> Vector C Source #

Construct a vector from a list of complex numbers.

toList :: Vector C -> [C] Source #

Produce a list of complex numbers from a vector.

Matrices (operators)

sx :: Matrix C Source #

The Pauli X matrix.

sy :: Matrix C Source #

The Pauli Y matrix.

sz :: Matrix C Source #

The Pauli Z matrix.

scaleM :: C -> Matrix C -> Matrix C Source #

Scale a complex matrix by a complex number.

(<>) :: Matrix C -> Matrix C -> Matrix C Source #

Matrix product.

(#>) :: Matrix C -> Vector C -> Vector C Source #

Matrix-vector product.

(<#) :: Vector C -> Matrix C -> Vector C Source #

Vector-matrix product

conjugateTranspose :: Matrix C -> Matrix C Source #

Conjugate transpose of a matrix.

fromLists :: [[C]] -> Matrix C Source #

Construct a matrix from a list of lists of complex numbers.

toLists :: Matrix C -> [[C]] Source #

Produce a list of lists of complex numbers from a matrix.

size :: Matrix C -> (Int, Int) Source #

Size of a matrix.

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

couter :: Vector C -> Vector C -> Matrix C Source #

Complex outer product

dm :: Vector C -> Matrix C Source #

Build a pure-state density matrix from a state vector.

trace :: Matrix C -> C Source #

Trace of a matrix.

normalizeDM :: Matrix C -> Matrix C Source #

Normalize a density matrix so that it has trace one.

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

class Kronecker a where Source #

Minimal complete definition

kron

Methods

kron :: a -> a -> a Source #

Instances
Product t => Kronecker (Matrix t) Source # 
Instance details

Defined in Physics.Learn.QuantumMat

Methods

kron :: Matrix t -> Matrix t -> Matrix t Source #

Product t => Kronecker (Vector t) Source # 
Instance details

Defined in Physics.Learn.QuantumMat

Methods

kron :: Vector t -> Vector t -> Vector t Source #

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

data Vector a #

Storable-based vectors

Instances
LSDiv Vector 
Instance details

Defined in Internal.Container

Methods

linSolve :: Field t => Matrix t -> Vector t -> Vector t

Normed Vector Double 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Vector Double -> RealOf Double

Normed Vector Float 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Vector Float -> RealOf Float

Container Vector Double 
Instance details

Defined in Internal.Numeric

Methods

conj' :: Vector Double -> Vector Double

size' :: Vector Double -> IndexOf Vector

scalar' :: Double -> Vector Double

scale' :: Double -> Vector Double -> Vector Double

addConstant :: Double -> Vector Double -> Vector Double

add' :: Vector Double -> Vector Double -> Vector Double

sub :: Vector Double -> Vector Double -> Vector Double

mul :: Vector Double -> Vector Double -> Vector Double

equal :: Vector Double -> Vector Double -> Bool

cmap' :: Element b => (Double -> b) -> Vector Double -> Vector b

konst' :: Double -> IndexOf Vector -> Vector Double

build' :: IndexOf Vector -> ArgOf Vector Double -> Vector Double

atIndex' :: Vector Double -> IndexOf Vector -> Double

minIndex' :: Vector Double -> IndexOf Vector

maxIndex' :: Vector Double -> IndexOf Vector

minElement' :: Vector Double -> Double

maxElement' :: Vector Double -> Double

sumElements' :: Vector Double -> Double

prodElements' :: Vector Double -> Double

step' :: Vector Double -> Vector Double

ccompare' :: Vector Double -> Vector Double -> Vector I

cselect' :: Vector I -> Vector Double -> Vector Double -> Vector Double -> Vector Double

find' :: (Double -> Bool) -> Vector Double -> [IndexOf Vector]

assoc' :: IndexOf Vector -> Double -> [(IndexOf Vector, Double)] -> Vector Double

accum' :: Vector Double -> (Double -> Double -> Double) -> [(IndexOf Vector, Double)] -> Vector Double

scaleRecip :: Double -> Vector Double -> Vector Double

divide :: Vector Double -> Vector Double -> Vector Double

arctan2' :: Vector Double -> Vector Double -> Vector Double

cmod' :: Double -> Vector Double -> Vector Double

fromInt' :: Vector I -> Vector Double

toInt' :: Vector Double -> Vector I

fromZ' :: Vector Z -> Vector Double

toZ' :: Vector Double -> Vector Z

Container Vector Float 
Instance details

Defined in Internal.Numeric

Methods

conj' :: Vector Float -> Vector Float

size' :: Vector Float -> IndexOf Vector

scalar' :: Float -> Vector Float

scale' :: Float -> Vector Float -> Vector Float

addConstant :: Float -> Vector Float -> Vector Float

add' :: Vector Float -> Vector Float -> Vector Float

sub :: Vector Float -> Vector Float -> Vector Float

mul :: Vector Float -> Vector Float -> Vector Float

equal :: Vector Float -> Vector Float -> Bool

cmap' :: Element b => (Float -> b) -> Vector Float -> Vector b

konst' :: Float -> IndexOf Vector -> Vector Float

build' :: IndexOf Vector -> ArgOf Vector Float -> Vector Float

atIndex' :: Vector Float -> IndexOf Vector -> Float

minIndex' :: Vector Float -> IndexOf Vector

maxIndex' :: Vector Float -> IndexOf Vector

minElement' :: Vector Float -> Float

maxElement' :: Vector Float -> Float

sumElements' :: Vector Float -> Float

prodElements' :: Vector Float -> Float

step' :: Vector Float -> Vector Float

ccompare' :: Vector Float -> Vector Float -> Vector I

cselect' :: Vector I -> Vector Float -> Vector Float -> Vector Float -> Vector Float

find' :: (Float -> Bool) -> Vector Float -> [IndexOf Vector]

assoc' :: IndexOf Vector -> Float -> [(IndexOf Vector, Float)] -> Vector Float

accum' :: Vector Float -> (Float -> Float -> Float) -> [(IndexOf Vector, Float)] -> Vector Float

scaleRecip :: Float -> Vector Float -> Vector Float

divide :: Vector Float -> Vector Float -> Vector Float

arctan2' :: Vector Float -> Vector Float -> Vector Float

cmod' :: Float -> Vector Float -> Vector Float

fromInt' :: Vector I -> Vector Float

toInt' :: Vector Float -> Vector I

fromZ' :: Vector Z -> Vector Float

toZ' :: Vector Float -> Vector Z

Container Vector I 
Instance details

Defined in Internal.Numeric

Container Vector Z 
Instance details

Defined in Internal.Numeric

Container Vector t => Linear t Vector 
Instance details

Defined in Internal.Numeric

Methods

scale :: t -> Vector t -> Vector t #

Storable a => Vector Vector a 
Instance details

Defined in Data.Vector.Storable

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) a -> m (Vector a) #

basicUnsafeThaw :: PrimMonad m => Vector a -> m (Mutable Vector (PrimState m) a) #

basicLength :: Vector a -> Int #

basicUnsafeSlice :: Int -> Int -> Vector a -> Vector a #

basicUnsafeIndexM :: Monad m => Vector a -> Int -> m a #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) a -> Vector a -> m () #

elemseq :: Vector a -> a -> b -> b #

Mul Matrix Vector Vector 
Instance details

Defined in Internal.Container

Methods

(<>) :: Product t => Matrix t -> Vector t -> Vector t

Mul Vector Matrix Vector 
Instance details

Defined in Internal.Container

Methods

(<>) :: Product t => Vector t -> Matrix t -> Vector t

Container Vector e => Konst e Int Vector 
Instance details

Defined in Internal.Numeric

Methods

konst :: e -> Int -> Vector e #

Normed Vector (Complex Double) 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Vector (Complex Double) -> RealOf (Complex Double)

Normed Vector (Complex Float) 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Vector (Complex Float) -> RealOf (Complex Float)

Container Vector (Complex Double) 
Instance details

Defined in Internal.Numeric

Methods

conj' :: Vector (Complex Double) -> Vector (Complex Double)

size' :: Vector (Complex Double) -> IndexOf Vector

scalar' :: Complex Double -> Vector (Complex Double)

scale' :: Complex Double -> Vector (Complex Double) -> Vector (Complex Double)

addConstant :: Complex Double -> Vector (Complex Double) -> Vector (Complex Double)

add' :: Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double)

sub :: Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double)

mul :: Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double)

equal :: Vector (Complex Double) -> Vector (Complex Double) -> Bool

cmap' :: Element b => (Complex Double -> b) -> Vector (Complex Double) -> Vector b

konst' :: Complex Double -> IndexOf Vector -> Vector (Complex Double)

build' :: IndexOf Vector -> ArgOf Vector (Complex Double) -> Vector (Complex Double)

atIndex' :: Vector (Complex Double) -> IndexOf Vector -> Complex Double

minIndex' :: Vector (Complex Double) -> IndexOf Vector

maxIndex' :: Vector (Complex Double) -> IndexOf Vector

minElement' :: Vector (Complex Double) -> Complex Double

maxElement' :: Vector (Complex Double) -> Complex Double

sumElements' :: Vector (Complex Double) -> Complex Double

prodElements' :: Vector (Complex Double) -> Complex Double

step' :: Vector (Complex Double) -> Vector (Complex Double)

ccompare' :: Vector (Complex Double) -> Vector (Complex Double) -> Vector I

cselect' :: Vector I -> Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double)

find' :: (Complex Double -> Bool) -> Vector (Complex Double) -> [IndexOf Vector]

assoc' :: IndexOf Vector -> Complex Double -> [(IndexOf Vector, Complex Double)] -> Vector (Complex Double)

accum' :: Vector (Complex Double) -> (Complex Double -> Complex Double -> Complex Double) -> [(IndexOf Vector, Complex Double)] -> Vector (Complex Double)

scaleRecip :: Complex Double -> Vector (Complex Double) -> Vector (Complex Double)

divide :: Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double)

arctan2' :: Vector (Complex Double) -> Vector (Complex Double) -> Vector (Complex Double)

cmod' :: Complex Double -> Vector (Complex Double) -> Vector (Complex Double)

fromInt' :: Vector I -> Vector (Complex Double)

toInt' :: Vector (Complex Double) -> Vector I

fromZ' :: Vector Z -> Vector (Complex Double)

toZ' :: Vector (Complex Double) -> Vector Z

Container Vector (Complex Float) 
Instance details

Defined in Internal.Numeric

Methods

conj' :: Vector (Complex Float) -> Vector (Complex Float)

size' :: Vector (Complex Float) -> IndexOf Vector

scalar' :: Complex Float -> Vector (Complex Float)

scale' :: Complex Float -> Vector (Complex Float) -> Vector (Complex Float)

addConstant :: Complex Float -> Vector (Complex Float) -> Vector (Complex Float)

add' :: Vector (Complex Float) -> Vector (Complex Float) -> Vector (Complex Float)

sub :: Vector (Complex Float) -> Vector (Complex Float) -> Vector (Complex Float)

mul :: Vector (Complex Float) -> Vector (Complex Float) -> Vector (Complex Float)

equal :: Vector (Complex Float) -> Vector (Complex Float) -> Bool

cmap' :: Element b => (Complex Float -> b) -> Vector (Complex Float) -> Vector b

konst' :: Complex Float -> IndexOf Vector -> Vector (Complex Float)

build' :: IndexOf Vector -> ArgOf Vector (Complex Float) -> Vector (Complex Float)

atIndex' :: Vector (Complex Float) -> IndexOf Vector -> Complex Float

minIndex' :: Vector (Complex Float) -> IndexOf Vector

maxIndex' :: Vector (Complex Float) -> IndexOf Vector

minElement' :: Vector (Complex Float) -> Complex Float

maxElement' :: Vector (Complex Float) -> Complex Float

sumElements' :: Vector (Complex Float) -> Complex Float

prodElements' :: Vector (Complex Float) -> Complex Float

step' :: Vector (Complex Float) -> Vector (Complex Float)

ccompare' :: Vector (Complex Float) -> Vector (Complex Float) -> Vector I

cselect' :: Vector I -> Vector (Complex Float) -> Vector (Complex Float) -> Vector (Complex Float) -> Vector (Complex Float)

find' :: (Complex Float -> Bool) -> Vector (Complex Float) -> [IndexOf Vector]

assoc' :: IndexOf Vector -> Complex Float -> [(IndexOf Vector, Complex Float)] -> Vector (Complex Float)

accum' :: Vector (Complex Float) -> (Complex Float -> Complex Float -> Complex Float) -> [(IndexOf Vector, Complex Float)] -> Vector (Complex Float)

scaleRecip :: Complex Float -> Vector (Complex Float) -> Vector (Complex Float)

divide :: Vector (Complex Float) -> Vector (Complex Float) -> Vector (Complex Float)

arctan2' :: Vector (Complex Float) -> Vector (Complex Float) -> Vector (Complex Float)

cmod' :: Complex Float -> Vector (Complex Float) -> Vector (Complex Float)

fromInt' :: Vector I -> Vector (Complex Float)

toInt' :: Vector (Complex Float) -> Vector I

fromZ' :: Vector Z -> Vector (Complex Float)

toZ' :: Vector (Complex Float) -> Vector Z

Representable Bra (Vector C) Source # 
Instance details

Defined in Physics.Learn.Ket

Representable Ket (Vector C) Source # 
Instance details

Defined in Physics.Learn.Ket

KnownNat m => Container Vector (Mod m I) 
Instance details

Defined in Internal.Modular

Methods

conj' :: Vector (Mod m I) -> Vector (Mod m I)

size' :: Vector (Mod m I) -> IndexOf Vector

scalar' :: Mod m I -> Vector (Mod m I)

scale' :: Mod m I -> Vector (Mod m I) -> Vector (Mod m I)

addConstant :: Mod m I -> Vector (Mod m I) -> Vector (Mod m I)

add' :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I)

sub :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I)

mul :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I)

equal :: Vector (Mod m I) -> Vector (Mod m I) -> Bool

cmap' :: Element b => (Mod m I -> b) -> Vector (Mod m I) -> Vector b

konst' :: Mod m I -> IndexOf Vector -> Vector (Mod m I)

build' :: IndexOf Vector -> ArgOf Vector (Mod m I) -> Vector (Mod m I)

atIndex' :: Vector (Mod m I) -> IndexOf Vector -> Mod m I

minIndex' :: Vector (Mod m I) -> IndexOf Vector

maxIndex' :: Vector (Mod m I) -> IndexOf Vector

minElement' :: Vector (Mod m I) -> Mod m I

maxElement' :: Vector (Mod m I) -> Mod m I

sumElements' :: Vector (Mod m I) -> Mod m I

prodElements' :: Vector (Mod m I) -> Mod m I

step' :: Vector (Mod m I) -> Vector (Mod m I)

ccompare' :: Vector (Mod m I) -> Vector (Mod m I) -> Vector I

cselect' :: Vector I -> Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I)

find' :: (Mod m I -> Bool) -> Vector (Mod m I) -> [IndexOf Vector]

assoc' :: IndexOf Vector -> Mod m I -> [(IndexOf Vector, Mod m I)] -> Vector (Mod m I)

accum' :: Vector (Mod m I) -> (Mod m I -> Mod m I -> Mod m I) -> [(IndexOf Vector, Mod m I)] -> Vector (Mod m I)

scaleRecip :: Mod m I -> Vector (Mod m I) -> Vector (Mod m I)

divide :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I)

arctan2' :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I)

cmod' :: Mod m I -> Vector (Mod m I) -> Vector (Mod m I)

fromInt' :: Vector I -> Vector (Mod m I)

toInt' :: Vector (Mod m I) -> Vector I

fromZ' :: Vector Z -> Vector (Mod m I)

toZ' :: Vector (Mod m I) -> Vector Z

KnownNat m => Container Vector (Mod m Z) 
Instance details

Defined in Internal.Modular

Methods

conj' :: Vector (Mod m Z) -> Vector (Mod m Z)

size' :: Vector (Mod m Z) -> IndexOf Vector

scalar' :: Mod m Z -> Vector (Mod m Z)

scale' :: Mod m Z -> Vector (Mod m Z) -> Vector (Mod m Z)

addConstant :: Mod m Z -> Vector (Mod m Z) -> Vector (Mod m Z)

add' :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z)

sub :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z)

mul :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z)

equal :: Vector (Mod m Z) -> Vector (Mod m Z) -> Bool

cmap' :: Element b => (Mod m Z -> b) -> Vector (Mod m Z) -> Vector b

konst' :: Mod m Z -> IndexOf Vector -> Vector (Mod m Z)

build' :: IndexOf Vector -> ArgOf Vector (Mod m Z) -> Vector (Mod m Z)

atIndex' :: Vector (Mod m Z) -> IndexOf Vector -> Mod m Z

minIndex' :: Vector (Mod m Z) -> IndexOf Vector

maxIndex' :: Vector (Mod m Z) -> IndexOf Vector

minElement' :: Vector (Mod m Z) -> Mod m Z

maxElement' :: Vector (Mod m Z) -> Mod m Z

sumElements' :: Vector (Mod m Z) -> Mod m Z

prodElements' :: Vector (Mod m Z) -> Mod m Z

step' :: Vector (Mod m Z) -> Vector (Mod m Z)

ccompare' :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector I

cselect' :: Vector I -> Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z)

find' :: (Mod m Z -> Bool) -> Vector (Mod m Z) -> [IndexOf Vector]

assoc' :: IndexOf Vector -> Mod m Z -> [(IndexOf Vector, Mod m Z)] -> Vector (Mod m Z)

accum' :: Vector (Mod m Z) -> (Mod m Z -> Mod m Z -> Mod m Z) -> [(IndexOf Vector, Mod m Z)] -> Vector (Mod m Z)

scaleRecip :: Mod m Z -> Vector (Mod m Z) -> Vector (Mod m Z)

divide :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z)

arctan2' :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z)

cmod' :: Mod m Z -> Vector (Mod m Z) -> Vector (Mod m Z)

fromInt' :: Vector I -> Vector (Mod m Z)

toInt' :: Vector (Mod m Z) -> Vector I

fromZ' :: Vector Z -> Vector (Mod m Z)

toZ' :: Vector (Mod m Z) -> Vector Z

Container Vector e => Build Int (e -> e) Vector e 
Instance details

Defined in Internal.Container

Methods

build :: Int -> (e -> e) -> Vector e #

Storable a => IsList (Vector a) 
Instance details

Defined in Data.Vector.Storable

Associated Types

type Item (Vector a) :: * #

Methods

fromList :: [Item (Vector a)] -> Vector a #

fromListN :: Int -> [Item (Vector a)] -> Vector a #

toList :: Vector a -> [Item (Vector a)] #

(Storable a, Eq a) => Eq (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

(==) :: Vector a -> Vector a -> Bool #

(/=) :: Vector a -> Vector a -> Bool #

(Data a, Storable a) => Data (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Vector a -> c (Vector a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Vector a) #

toConstr :: Vector a -> Constr #

dataTypeOf :: Vector a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Vector a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Vector a)) #

gmapT :: (forall b. Data b => b -> b) -> Vector a -> Vector a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Vector a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Vector a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) #

KnownNat m => Num (Vector (Mod m I)) 
Instance details

Defined in Internal.Modular

Methods

(+) :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I) #

(-) :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I) #

(*) :: Vector (Mod m I) -> Vector (Mod m I) -> Vector (Mod m I) #

negate :: Vector (Mod m I) -> Vector (Mod m I) #

abs :: Vector (Mod m I) -> Vector (Mod m I) #

signum :: Vector (Mod m I) -> Vector (Mod m I) #

fromInteger :: Integer -> Vector (Mod m I) #

KnownNat m => Num (Vector (Mod m Z)) 
Instance details

Defined in Internal.Modular

Methods

(+) :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z) #

(-) :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z) #

(*) :: Vector (Mod m Z) -> Vector (Mod m Z) -> Vector (Mod m Z) #

negate :: Vector (Mod m Z) -> Vector (Mod m Z) #

abs :: Vector (Mod m Z) -> Vector (Mod m Z) #

signum :: Vector (Mod m Z) -> Vector (Mod m Z) #

fromInteger :: Integer -> Vector (Mod m Z) #

(Storable a, Ord a) => Ord (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

compare :: Vector a -> Vector a -> Ordering #

(<) :: Vector a -> Vector a -> Bool #

(<=) :: Vector a -> Vector a -> Bool #

(>) :: Vector a -> Vector a -> Bool #

(>=) :: Vector a -> Vector a -> Bool #

max :: Vector a -> Vector a -> Vector a #

min :: Vector a -> Vector a -> Vector a #

(Read a, Storable a) => Read (Vector a) 
Instance details

Defined in Data.Vector.Storable

(Show a, Storable a) => Show (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

showsPrec :: Int -> Vector a -> ShowS #

show :: Vector a -> String #

showList :: [Vector a] -> ShowS #

Storable a => Semigroup (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

(<>) :: Vector a -> Vector a -> Vector a #

sconcat :: NonEmpty (Vector a) -> Vector a #

stimes :: Integral b => b -> Vector a -> Vector a #

Storable a => Monoid (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

mempty :: Vector a #

mappend :: Vector a -> Vector a -> Vector a #

mconcat :: [Vector a] -> Vector a #

NFData (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

rnf :: Vector a -> () #

Normed (Vector Float) 
Instance details

Defined in Internal.Util

Normed (Vector (Complex Float)) 
Instance details

Defined in Internal.Util

KnownNat m => Normed (Vector (Mod m I)) 
Instance details

Defined in Internal.Modular

Methods

norm_0 :: Vector (Mod m I) -> R #

norm_1 :: Vector (Mod m I) -> R #

norm_2 :: Vector (Mod m I) -> R #

norm_Inf :: Vector (Mod m I) -> R #

KnownNat m => Normed (Vector (Mod m Z)) 
Instance details

Defined in Internal.Modular

Methods

norm_0 :: Vector (Mod m Z) -> R #

norm_1 :: Vector (Mod m Z) -> R #

norm_2 :: Vector (Mod m Z) -> R #

norm_Inf :: Vector (Mod m Z) -> R #

Normed (Vector I) 
Instance details

Defined in Internal.Util

Methods

norm_0 :: Vector I -> R #

norm_1 :: Vector I -> R #

norm_2 :: Vector I -> R #

norm_Inf :: Vector I -> R #

Normed (Vector Z) 
Instance details

Defined in Internal.Util

Methods

norm_0 :: Vector Z -> R #

norm_1 :: Vector Z -> R #

norm_2 :: Vector Z -> R #

norm_Inf :: Vector Z -> R #

Normed (Vector R) 
Instance details

Defined in Internal.Util

Methods

norm_0 :: Vector R -> R #

norm_1 :: Vector R -> R #

norm_2 :: Vector R -> R #

norm_Inf :: Vector R -> R #

Normed (Vector C) 
Instance details

Defined in Internal.Util

Methods

norm_0 :: Vector C -> R #

norm_1 :: Vector C -> R #

norm_2 :: Vector C -> R #

norm_Inf :: Vector C -> R #

Container Vector t => Additive (Vector t) 
Instance details

Defined in Internal.Numeric

Methods

add :: Vector t -> Vector t -> Vector t #

Storable t => TransArray (Vector t) 
Instance details

Defined in Internal.Devel

Associated Types

type Trans (Vector t) b :: * #

type TransRaw (Vector t) b :: * #

Methods

apply :: Vector t -> (b -> IO r) -> Trans (Vector t) b -> IO r #

applyRaw :: Vector t -> (b -> IO r) -> TransRaw (Vector t) b -> IO r #

Storable a => Ixed (Vector a) 
Instance details

Defined in Control.Lens.At

Methods

ix :: Index (Vector a) -> Traversal' (Vector a) (IxValue (Vector a)) #

Storable a => Wrapped (Vector a) 
Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped (Vector a) :: * #

Methods

_Wrapped' :: Iso' (Vector a) (Unwrapped (Vector a)) #

Product t => Kronecker (Vector t) Source # 
Instance details

Defined in Physics.Learn.QuantumMat

Methods

kron :: Vector t -> Vector t -> Vector t Source #

Indexable (Vector Double) Double 
Instance details

Defined in Internal.Util

Methods

(!) :: Vector Double -> Int -> Double #

Indexable (Vector Float) Float 
Instance details

Defined in Internal.Util

Methods

(!) :: Vector Float -> Int -> Float #

Indexable (Vector I) I 
Instance details

Defined in Internal.Util

Methods

(!) :: Vector I -> Int -> I #

Indexable (Vector Z) Z 
Instance details

Defined in Internal.Util

Methods

(!) :: Vector Z -> Int -> Z #

(Storable a, t ~ Vector a') => Rewrapped (Vector a) t 
Instance details

Defined in Control.Lens.Wrapped

Element t => Indexable (Matrix t) (Vector t) 
Instance details

Defined in Internal.Util

Methods

(!) :: Matrix t -> Int -> Vector t #

Indexable (Vector (Complex Double)) (Complex Double) 
Instance details

Defined in Internal.Util

Indexable (Vector (Complex Float)) (Complex Float) 
Instance details

Defined in Internal.Util

Methods

(!) :: Vector (Complex Float) -> Int -> Complex Float #

(Storable t, Indexable (Vector t) t) => Indexable (Vector (Mod m t)) (Mod m t) 
Instance details

Defined in Internal.Modular

Methods

(!) :: Vector (Mod m t) -> Int -> Mod m t #

type IndexOf Vector 
Instance details

Defined in Internal.Numeric

type Mutable Vector 
Instance details

Defined in Data.Vector.Storable

type ArgOf Vector a 
Instance details

Defined in Internal.Numeric

type ArgOf Vector a = a -> a
type Item (Vector a) 
Instance details

Defined in Data.Vector.Storable

type Item (Vector a) = a
type ElementOf (Vector a) 
Instance details

Defined in Internal.Numeric

type ElementOf (Vector a) = a
type Index (Vector a) 
Instance details

Defined in Control.Lens.At

type Index (Vector a) = Int
type IxValue (Vector a) 
Instance details

Defined in Control.Lens.At

type IxValue (Vector a) = a
type Unwrapped (Vector a) 
Instance details

Defined in Control.Lens.Wrapped

type Unwrapped (Vector a) = [a]
type TransRaw (Vector t) b 
Instance details

Defined in Internal.Devel

type TransRaw (Vector t) b = CInt -> Ptr t -> b
type Trans (Vector t) b 
Instance details

Defined in Internal.Devel

type Trans (Vector t) b = CInt -> Ptr t -> b

data Matrix t #

Matrix representation suitable for BLAS/LAPACK computations.

Instances
LSDiv Matrix 
Instance details

Defined in Internal.Container

Methods

linSolve :: Field t => Matrix t -> Matrix t -> Matrix t

Normed Matrix Double 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Matrix Double -> RealOf Double

Normed Matrix Float 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Matrix Float -> RealOf Float

(Num a, Element a, Container Vector a) => Container Matrix a 
Instance details

Defined in Internal.Numeric

Methods

conj' :: Matrix a -> Matrix a

size' :: Matrix a -> IndexOf Matrix

scalar' :: a -> Matrix a

scale' :: a -> Matrix a -> Matrix a

addConstant :: a -> Matrix a -> Matrix a

add' :: Matrix a -> Matrix a -> Matrix a

sub :: Matrix a -> Matrix a -> Matrix a

mul :: Matrix a -> Matrix a -> Matrix a

equal :: Matrix a -> Matrix a -> Bool

cmap' :: Element b => (a -> b) -> Matrix a -> Matrix b

konst' :: a -> IndexOf Matrix -> Matrix a

build' :: IndexOf Matrix -> ArgOf Matrix a -> Matrix a

atIndex' :: Matrix a -> IndexOf Matrix -> a

minIndex' :: Matrix a -> IndexOf Matrix

maxIndex' :: Matrix a -> IndexOf Matrix

minElement' :: Matrix a -> a

maxElement' :: Matrix a -> a

sumElements' :: Matrix a -> a

prodElements' :: Matrix a -> a

step' :: Matrix a -> Matrix a

ccompare' :: Matrix a -> Matrix a -> Matrix I

cselect' :: Matrix I -> Matrix a -> Matrix a -> Matrix a -> Matrix a

find' :: (a -> Bool) -> Matrix a -> [IndexOf Matrix]

assoc' :: IndexOf Matrix -> a -> [(IndexOf Matrix, a)] -> Matrix a

accum' :: Matrix a -> (a -> a -> a) -> [(IndexOf Matrix, a)] -> Matrix a

scaleRecip :: a -> Matrix a -> Matrix a

divide :: Matrix a -> Matrix a -> Matrix a

arctan2' :: Matrix a -> Matrix a -> Matrix a

cmod' :: a -> Matrix a -> Matrix a

fromInt' :: Matrix I -> Matrix a

toInt' :: Matrix a -> Matrix I

fromZ' :: Matrix Z -> Matrix a

toZ' :: Matrix a -> Matrix Z

Container Matrix t => Linear t Matrix 
Instance details

Defined in Internal.Numeric

Methods

scale :: t -> Matrix t -> Matrix t #

Mul Matrix Matrix Matrix 
Instance details

Defined in Internal.Container

Methods

(<>) :: Product t => Matrix t -> Matrix t -> Matrix t

Mul Matrix Vector Vector 
Instance details

Defined in Internal.Container

Methods

(<>) :: Product t => Matrix t -> Vector t -> Vector t

Mul Vector Matrix Vector 
Instance details

Defined in Internal.Container

Methods

(<>) :: Product t => Vector t -> Matrix t -> Vector t

Normed Matrix (Complex Double) 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Matrix (Complex Double) -> RealOf (Complex Double)

Normed Matrix (Complex Float) 
Instance details

Defined in Internal.Algorithms

Methods

pnorm :: NormType -> Matrix (Complex Float) -> RealOf (Complex Float)

Representable Operator (Matrix C) Source # 
Instance details

Defined in Physics.Learn.Ket

(Num e, Container Vector e) => Konst e (Int, Int) Matrix 
Instance details

Defined in Internal.Numeric

Methods

konst :: e -> (Int, Int) -> Matrix e #

(Storable t, NFData t) => NFData (Matrix t) 
Instance details

Defined in Internal.Matrix

Methods

rnf :: Matrix t -> () #

Normed (Matrix R) 
Instance details

Defined in Internal.Util

Methods

norm_0 :: Matrix R -> R #

norm_1 :: Matrix R -> R #

norm_2 :: Matrix R -> R #

norm_Inf :: Matrix R -> R #

Normed (Matrix C) 
Instance details

Defined in Internal.Util

Methods

norm_0 :: Matrix C -> R #

norm_1 :: Matrix C -> R #

norm_2 :: Matrix C -> R #

norm_Inf :: Matrix C -> R #

Container Matrix t => Additive (Matrix t) 
Instance details

Defined in Internal.Numeric

Methods

add :: Matrix t -> Matrix t -> Matrix t #

KnownNat m => Testable (Matrix (Mod m I)) 
Instance details

Defined in Internal.Modular

Methods

checkT :: Matrix (Mod m I) -> (Bool, IO ()) #

ioCheckT :: Matrix (Mod m I) -> IO (Bool, IO ()) #

Storable t => TransArray (Matrix t) 
Instance details

Defined in Internal.Matrix

Associated Types

type Trans (Matrix t) b :: * #

type TransRaw (Matrix t) b :: * #

Methods

apply :: Matrix t -> (b -> IO r) -> Trans (Matrix t) b -> IO r #

applyRaw :: Matrix t -> (b -> IO r) -> TransRaw (Matrix t) b -> IO r #

Product t => Kronecker (Matrix t) Source # 
Instance details

Defined in Physics.Learn.QuantumMat

Methods

kron :: Matrix t -> Matrix t -> Matrix t Source #

Element t => Indexable (Matrix t) (Vector t) 
Instance details

Defined in Internal.Util

Methods

(!) :: Matrix t -> Int -> Vector t #

(CTrans t, Container Vector t) => Transposable (Matrix t) (Matrix t) 
Instance details

Defined in Internal.Numeric

Methods

tr :: Matrix t -> Matrix t #

tr' :: Matrix t -> Matrix t #

Container Matrix e => Build (Int, Int) (e -> e -> e) Matrix e 
Instance details

Defined in Internal.Container

Methods

build :: (Int, Int) -> (e -> e -> e) -> Matrix e #

type IndexOf Matrix 
Instance details

Defined in Internal.Numeric

type IndexOf Matrix = (Int, Int)
type ArgOf Matrix a 
Instance details

Defined in Internal.Numeric

type ArgOf Matrix a = a -> a -> a
type ElementOf (Matrix a) 
Instance details

Defined in Internal.Numeric

type ElementOf (Matrix a) = a
type TransRaw (Matrix t) b 
Instance details

Defined in Internal.Matrix

type TransRaw (Matrix t) b = CInt -> CInt -> Ptr t -> b
type Trans (Matrix t) b 
Instance details

Defined in Internal.Matrix

type Trans (Matrix t) b = CInt -> CInt -> CInt -> CInt -> Ptr t -> b