hmatrix-0.16.0.6: Numeric Linear Algebra

Copyright(c) Alberto Ruiz 2014
LicenseBSD3
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Numeric.LinearAlgebra.Static

Contents

Description

Experimental interface with statically checked dimensions.

This module is under active development and the interface is subject to changes.

Synopsis

Vector

data R n Source

Instances

Domain R L 
KnownNat n => Sized (R n) Vector 
Floating (R n) 
Fractional (R n) 
Num (R n) 
KnownNat n => Show (R n) 
KnownNat n => Disp (R n) 
KnownNat n => Eigen (Sym n) (R n) (L n n) 
(KnownNat m, KnownNat n, (<=) n ((+) m 1)) => Diag (L m n) (R n) 
(KnownNat m, KnownNat n, (<=) m ((+) n 1)) => Diag (L m n) (R m) 
KnownNat n => Diag (L n n) (R n) 

vec2 :: -> -> R 2 Source

vec3 :: -> -> -> R 3 Source

vec4 :: -> -> -> -> R 4 Source

(&) :: forall n. (KnownNat n, 1 <= n) => R n -> -> R (n + 1) infixl 4 Source

(#) :: forall n m. (KnownNat n, KnownNat m) => R n -> R m -> R (n + m) infixl 4 Source

split :: forall p n. (KnownNat p, KnownNat n, p <= n) => R n -> (R p, R (n - p)) Source

headTail :: (KnownNat n, 1 <= n) => R n -> (, R (n - 1)) Source

vector :: KnownNat n => [] -> R n Source

linspace :: forall n. KnownNat n => (, ) -> R n Source

range :: forall n. KnownNat n => R n Source

dim :: forall n. KnownNat n => R n Source

Matrix

data L m n Source

Instances

Domain R L 
(KnownNat m, KnownNat n) => Sized (L m n) Matrix 
KnownNat n => Eigen (Sym n) (R n) (L n n) 
KnownNat n => Eigen (Sq n) (C n) (M n n) 
(KnownNat n, KnownNat m) => Floating (L n m) 
(KnownNat n, KnownNat m) => Fractional (L n m) 
(KnownNat n, KnownNat m) => Num (L n m) 
(KnownNat m, KnownNat n) => Show (L m n) 
(KnownNat n', KnownNat m') => Testable (L n' m') 
(KnownNat m, KnownNat n) => Disp (L m n) 
(KnownNat m, KnownNat n, (<=) n ((+) m 1)) => Diag (L m n) (R n) 
(KnownNat m, KnownNat n, (<=) m ((+) n 1)) => Diag (L m n) (R m) 
KnownNat n => Diag (L n n) (R n) 
(KnownNat n, KnownNat m) => Transposable (L m n) (L n m) 

type Sq n = L n n Source

build :: forall m n. (KnownNat n, KnownNat m) => ( -> -> ) -> L m n Source

row :: R n -> L 1 n Source

col :: KnownNat n => R n -> L n 1 Source

(¦) :: (KnownNat ((+) r1 r2), KnownNat r2, KnownNat c, KnownNat r1) => L c r1 -> L c r2 -> L c ((+) r1 r2) infixl 3 Source

—— :: (KnownNat r1, KnownNat r2, KnownNat c) => L r1 c -> L r2 c -> L (r1 + r2) c infixl 2 Source

splitRows :: forall p m n. (KnownNat p, KnownNat m, KnownNat n, p <= m) => L m n -> (L p n, L (m - p) n) Source

splitCols :: forall p m n. (KnownNat p, KnownNat m, KnownNat n, KnownNat (n - p), p <= n) => L m n -> (L m p, L m (n - p)) Source

unrow :: L 1 n -> R n Source

uncol :: KnownNat n => L n 1 -> R n Source

tr :: Transposable m mt => m -> mt Source

(conjugate) transpose

eye :: KnownNat n => Sq n Source

diag :: KnownNat n => R n -> Sq n Source

blockAt :: forall m n. (KnownNat m, KnownNat n) => -> Int -> Int -> Matrix Double -> L m n Source

matrix :: (KnownNat m, KnownNat n) => [] -> L m n Source

Complex

data C n Source

Instances

Domain C M 
KnownNat n => Sized (C n) Vector 
Floating (C n) 
Fractional (C n) 
Num (C n) 
KnownNat n => Show (C n) 
KnownNat n => Disp (C n) 
KnownNat n => Eigen (Sq n) (C n) (M n n) 

data M m n Source

Instances

Domain C M 
(KnownNat m, KnownNat n) => Sized (M m n) Matrix 
KnownNat n => Eigen (Sq n) (C n) (M n n) 
(KnownNat n, KnownNat m) => Floating (M n m) 
(KnownNat n, KnownNat m) => Fractional (M n m) 
(KnownNat n, KnownNat m) => Num (M n m) 
(KnownNat m, KnownNat n) => Show (M m n) 
(KnownNat m, KnownNat n) => Disp (M m n) 
(KnownNat n, KnownNat m) => Transposable (M m n) (M n m) 

data Her n Source

her :: KnownNat n => M n n -> Her n Source

𝑖 :: Sized s c => s Source

Products

(<>) :: forall m k n. (KnownNat m, KnownNat k, KnownNat n) => L m k -> L k n -> L m n infixr 8 Source

(#>) :: (KnownNat m, KnownNat n) => L m n -> R n -> R m infixr 8 Source

<·> :: R n -> R n -> infixr 8 Source

Linear Systems

linSolve :: (KnownNat m, KnownNat n) => L m m -> L m n -> Maybe (L m n) Source

(<\>) :: (KnownNat m, KnownNat n, KnownNat r) => L m n -> L m r -> L n r Source

Factorizations

svd :: (KnownNat m, KnownNat n) => L m n -> (L m m, R n, L n n) Source

withCompactSVD :: forall m n z. (KnownNat m, KnownNat n) => L m n -> (forall k. KnownNat k => (L m k, R k, L n k) -> z) -> z Source

svdTall :: (KnownNat m, KnownNat n, n <= m) => L m n -> (L m n, R n, L n n) Source

svdFlat :: (KnownNat m, KnownNat n, m <= n) => L m n -> (L m m, R m, L n m) Source

class Eigen m l v | m -> l, m -> v where Source

Methods

eigensystem :: m -> (l, v) Source

eigenvalues :: m -> l Source

Instances

KnownNat n => Eigen (Sym n) (R n) (L n n) 
KnownNat n => Eigen (Sq n) (C n) (M n n) 

withNullspace :: forall m n z. (KnownNat m, KnownNat n) => L m n -> (forall k. KnownNat k => L n k -> z) -> z Source

qr :: (KnownNat m, KnownNat n) => L m n -> (L m m, L m n) Source

Misc

mean :: (KnownNat n, 1 <= n) => R n -> Source

class Disp t where Source

Methods

disp :: Int -> t -> IO () Source

Instances

KnownNat n => Disp (C n) 
KnownNat n => Disp (R n) 
(KnownNat m, KnownNat n) => Disp (M m n) 
(KnownNat m, KnownNat n) => Disp (L m n) 

class Domain field vec mat | mat -> vec field, vec -> mat field, field -> mat vec where Source

Methods

mul :: forall m k n. (KnownNat m, KnownNat k, KnownNat n) => mat m k -> mat k n -> mat m n Source

app :: forall m n. (KnownNat m, KnownNat n) => mat m n -> vec n -> vec m Source

dot :: forall n. KnownNat n => vec n -> vec n -> field Source

cross :: vec 3 -> vec 3 -> vec 3 Source

diagR :: forall m n k. (KnownNat m, KnownNat n, KnownNat k) => field -> vec k -> mat m n Source

Instances

withVector :: forall z. Vector -> (forall n. KnownNat n => R n -> z) -> z Source

withMatrix :: forall z. Matrix -> (forall m n. (KnownNat m, KnownNat n) => L m n -> z) -> z Source

toRows :: forall m n. (KnownNat m, KnownNat n) => L m n -> [R n] Source

toColumns :: forall m n. (KnownNat m, KnownNat n) => L m n -> [R m] Source

class Num t => Sized t s d | s -> t, s -> d where Source

Methods

konst :: t -> s Source

unwrap :: s -> d t Source

fromList :: [t] -> s Source

extract :: s -> d t Source

create :: d t -> Maybe s Source

size :: s -> IndexOf d Source

Instances

KnownNat n => Sized (C n) Vector 
KnownNat n => Sized (R n) Vector 
(KnownNat m, KnownNat n) => Sized (M m n) Matrix 
(KnownNat m, KnownNat n) => Sized (L m n) Matrix 

class Diag m d | m -> d where Source

Methods

takeDiag :: m -> d Source

Instances

(KnownNat m, KnownNat n, (<=) n ((+) m 1)) => Diag (L m n) (R n) 
(KnownNat m, KnownNat n, (<=) m ((+) n 1)) => Diag (L m n) (R m) 
KnownNat n => Diag (L n n) (R n) 

data Sym n Source

Instances

KnownNat n => Show (Sym n) 
KnownNat n => Eigen (Sym n) (R n) (L n n) 

sym :: KnownNat n => Sq n -> Sym n Source

mTm :: (KnownNat m, KnownNat n) => L m n -> Sym n Source

unSym :: Sym n -> Sq n Source