hmatrix-0.17.0.2: Numeric Linear Algebra

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

Numeric.LinearAlgebra.Static

Contents

Description

Experimental interface with statically checked dimensions.

See code examples at http://dis.um.es/~alberto/hmatrix/static.html.

Synopsis

Vector

data R n Source #

Instances

Domain R L Source # 

Methods

mul :: (KnownNat m, KnownNat k, KnownNat n) => L m k -> L k n -> L m n Source #

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

dot :: KnownNat n => R n -> R n -> Source #

cross :: R 3 -> R 3 -> R 3 Source #

diagR :: (KnownNat m, KnownNat n, KnownNat k) => -> R k -> L m n Source #

KnownNat n => Sized (R n) Vector Source # 
Floating (R n) Source # 

Methods

pi :: R n #

exp :: R n -> R n #

log :: R n -> R n #

sqrt :: R n -> R n #

(**) :: R n -> R n -> R n #

logBase :: R n -> R n -> R n #

sin :: R n -> R n #

cos :: R n -> R n #

tan :: R n -> R n #

asin :: R n -> R n #

acos :: R n -> R n #

atan :: R n -> R n #

sinh :: R n -> R n #

cosh :: R n -> R n #

tanh :: R n -> R n #

asinh :: R n -> R n #

acosh :: R n -> R n #

atanh :: R n -> R n #

log1p :: R n -> R n #

expm1 :: R n -> R n #

log1pexp :: R n -> R n #

log1mexp :: R n -> R n #

Fractional (R n) Source # 

Methods

(/) :: R n -> R n -> R n #

recip :: R n -> R n #

fromRational :: Rational -> R n #

Num (R n) Source # 

Methods

(+) :: R n -> R n -> R n #

(-) :: R n -> R n -> R n #

(*) :: R n -> R n -> R n #

negate :: R n -> R n #

abs :: R n -> R n #

signum :: R n -> R n #

fromInteger :: Integer -> R n #

KnownNat n => Show (R n) Source # 

Methods

showsPrec :: Int -> R n -> ShowS #

show :: R n -> String #

showList :: [R n] -> ShowS #

KnownNat n => Disp (R n) Source # 

Methods

disp :: Int -> R n -> IO () Source #

KnownNat n => Eigen (Sym n) (R n) (L n n) Source # 

Methods

eigensystem :: Sym n -> (R n, L n n) Source #

eigenvalues :: Sym n -> R n Source #

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

Methods

takeDiag :: L m n -> R n Source #

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

Methods

takeDiag :: L m n -> R m Source #

KnownNat n => Diag (L n n) (R n) Source # 

Methods

takeDiag :: L n n -> R n Source #

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 Source # 

Methods

mul :: (KnownNat m, KnownNat k, KnownNat n) => L m k -> L k n -> L m n Source #

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

dot :: KnownNat n => R n -> R n -> Source #

cross :: R 3 -> R 3 -> R 3 Source #

diagR :: (KnownNat m, KnownNat n, KnownNat k) => -> R k -> L m n Source #

(KnownNat m, KnownNat n) => Sized (L m n) Matrix Source # 

Methods

konst :: -> L m n Source #

unwrap :: L m n -> Matrix Source #

fromList :: [] -> L m n Source #

extract :: L m n -> Matrix Source #

create :: Matrix -> Maybe (L m n) Source #

size :: L m n -> IndexOf Matrix Source #

KnownNat n => Eigen (Sym n) (R n) (L n n) Source # 

Methods

eigensystem :: Sym n -> (R n, L n n) Source #

eigenvalues :: Sym n -> R n Source #

KnownNat n => Eigen (Sq n) (C n) (M n n) Source # 

Methods

eigensystem :: Sq n -> (C n, M n n) Source #

eigenvalues :: Sq n -> C n Source #

(KnownNat n, KnownNat m) => Floating (L n m) Source # 

Methods

pi :: L n m #

exp :: L n m -> L n m #

log :: L n m -> L n m #

sqrt :: L n m -> L n m #

(**) :: L n m -> L n m -> L n m #

logBase :: L n m -> L n m -> L n m #

sin :: L n m -> L n m #

cos :: L n m -> L n m #

tan :: L n m -> L n m #

asin :: L n m -> L n m #

acos :: L n m -> L n m #

atan :: L n m -> L n m #

sinh :: L n m -> L n m #

cosh :: L n m -> L n m #

tanh :: L n m -> L n m #

asinh :: L n m -> L n m #

acosh :: L n m -> L n m #

atanh :: L n m -> L n m #

log1p :: L n m -> L n m #

expm1 :: L n m -> L n m #

log1pexp :: L n m -> L n m #

log1mexp :: L n m -> L n m #

(KnownNat n, KnownNat m) => Fractional (L n m) Source # 

Methods

(/) :: L n m -> L n m -> L n m #

recip :: L n m -> L n m #

fromRational :: Rational -> L n m #

(KnownNat n, KnownNat m) => Num (L n m) Source # 

Methods

(+) :: L n m -> L n m -> L n m #

(-) :: L n m -> L n m -> L n m #

(*) :: L n m -> L n m -> L n m #

negate :: L n m -> L n m #

abs :: L n m -> L n m #

signum :: L n m -> L n m #

fromInteger :: Integer -> L n m #

(KnownNat m, KnownNat n) => Show (L m n) Source # 

Methods

showsPrec :: Int -> L m n -> ShowS #

show :: L m n -> String #

showList :: [L m n] -> ShowS #

(KnownNat m, KnownNat n) => Disp (L m n) Source # 

Methods

disp :: Int -> L m n -> IO () Source #

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

Methods

takeDiag :: L m n -> R n Source #

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

Methods

takeDiag :: L m n -> R m Source #

KnownNat n => Diag (L n n) (R n) Source # 

Methods

takeDiag :: L n n -> R n Source #

(KnownNat n, KnownNat m) => Transposable (L m n) (L n m) Source # 

Methods

tr :: L m n -> L n m Source #

tr' :: L m n -> L n m Source #

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 c, KnownNat r2, 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

Floating (C n) Source # 

Methods

pi :: C n #

exp :: C n -> C n #

log :: C n -> C n #

sqrt :: C n -> C n #

(**) :: C n -> C n -> C n #

logBase :: C n -> C n -> C n #

sin :: C n -> C n #

cos :: C n -> C n #

tan :: C n -> C n #

asin :: C n -> C n #

acos :: C n -> C n #

atan :: C n -> C n #

sinh :: C n -> C n #

cosh :: C n -> C n #

tanh :: C n -> C n #

asinh :: C n -> C n #

acosh :: C n -> C n #

atanh :: C n -> C n #

log1p :: C n -> C n #

expm1 :: C n -> C n #

log1pexp :: C n -> C n #

log1mexp :: C n -> C n #

Fractional (C n) Source # 

Methods

(/) :: C n -> C n -> C n #

recip :: C n -> C n #

fromRational :: Rational -> C n #

Num (C n) Source # 

Methods

(+) :: C n -> C n -> C n #

(-) :: C n -> C n -> C n #

(*) :: C n -> C n -> C n #

negate :: C n -> C n #

abs :: C n -> C n #

signum :: C n -> C n #

fromInteger :: Integer -> C n #

KnownNat n => Show (C n) Source # 

Methods

showsPrec :: Int -> C n -> ShowS #

show :: C n -> String #

showList :: [C n] -> ShowS #

KnownNat n => Disp (C n) Source # 

Methods

disp :: Int -> C n -> IO () Source #

KnownNat n => Eigen (Sq n) (C n) (M n n) Source # 

Methods

eigensystem :: Sq n -> (C n, M n n) Source #

eigenvalues :: Sq n -> C n Source #

data M m n Source #

Instances

KnownNat n => Eigen (Sq n) (C n) (M n n) Source # 

Methods

eigensystem :: Sq n -> (C n, M n n) Source #

eigenvalues :: Sq n -> C n Source #

(KnownNat n, KnownNat m) => Floating (M n m) Source # 

Methods

pi :: M n m #

exp :: M n m -> M n m #

log :: M n m -> M n m #

sqrt :: M n m -> M n m #

(**) :: M n m -> M n m -> M n m #

logBase :: M n m -> M n m -> M n m #

sin :: M n m -> M n m #

cos :: M n m -> M n m #

tan :: M n m -> M n m #

asin :: M n m -> M n m #

acos :: M n m -> M n m #

atan :: M n m -> M n m #

sinh :: M n m -> M n m #

cosh :: M n m -> M n m #

tanh :: M n m -> M n m #

asinh :: M n m -> M n m #

acosh :: M n m -> M n m #

atanh :: M n m -> M n m #

log1p :: M n m -> M n m #

expm1 :: M n m -> M n m #

log1pexp :: M n m -> M n m #

log1mexp :: M n m -> M n m #

(KnownNat n, KnownNat m) => Fractional (M n m) Source # 

Methods

(/) :: M n m -> M n m -> M n m #

recip :: M n m -> M n m #

fromRational :: Rational -> M n m #

(KnownNat n, KnownNat m) => Num (M n m) Source # 

Methods

(+) :: M n m -> M n m -> M n m #

(-) :: M n m -> M n m -> M n m #

(*) :: M n m -> M n m -> M n m #

negate :: M n m -> M n m #

abs :: M n m -> M n m #

signum :: M n m -> M n m #

fromInteger :: Integer -> M n m #

(KnownNat m, KnownNat n) => Show (M m n) Source # 

Methods

showsPrec :: Int -> M m n -> ShowS #

show :: M m n -> String #

showList :: [M m n] -> ShowS #

(KnownNat m, KnownNat n) => Disp (M m n) Source # 

Methods

disp :: Int -> M m n -> IO () Source #

(KnownNat n, KnownNat m) => Transposable (M m n) (M n m) Source # 

Methods

tr :: M m n -> M n m Source #

tr' :: M m n -> M n m Source #

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 #

Minimal complete definition

eigensystem, eigenvalues

Methods

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

eigenvalues :: m -> l Source #

Instances

KnownNat n => Eigen (Sym n) (R n) (L n n) Source # 

Methods

eigensystem :: Sym n -> (R n, L n n) Source #

eigenvalues :: Sym n -> R n Source #

KnownNat n => Eigen (Sq n) (C n) (M n n) Source # 

Methods

eigensystem :: Sq n -> (C n, M n n) Source #

eigenvalues :: Sq n -> C n Source #

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 #

chol :: KnownNat n => Sym n -> Sq n Source #

Misc

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

class Disp t where Source #

Minimal complete definition

disp

Methods

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

Instances

KnownNat n => Disp (C n) Source # 

Methods

disp :: Int -> C n -> IO () Source #

KnownNat n => Disp (R n) Source # 

Methods

disp :: Int -> R n -> IO () Source #

(KnownNat m, KnownNat n) => Disp (M m n) Source # 

Methods

disp :: Int -> M m n -> IO () Source #

(KnownNat m, KnownNat n) => Disp (L m n) Source # 

Methods

disp :: Int -> L m n -> IO () Source #

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

Minimal complete definition

mul, app, dot, cross, diagR

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

Domain R L Source # 

Methods

mul :: (KnownNat m, KnownNat k, KnownNat n) => L m k -> L k n -> L m n Source #

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

dot :: KnownNat n => R n -> R n -> Source #

cross :: R 3 -> R 3 -> R 3 Source #

diagR :: (KnownNat m, KnownNat n, KnownNat k) => -> R k -> L m n Source #

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 #

Minimal complete definition

konst, unwrap, fromList, extract, create, size

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 (R n) Vector Source # 
(KnownNat m, KnownNat n) => Sized (L m n) Matrix Source # 

Methods

konst :: -> L m n Source #

unwrap :: L m n -> Matrix Source #

fromList :: [] -> L m n Source #

extract :: L m n -> Matrix Source #

create :: Matrix -> Maybe (L m n) Source #

size :: L m n -> IndexOf Matrix Source #

class Diag m d | m -> d where Source #

Minimal complete definition

takeDiag

Methods

takeDiag :: m -> d Source #

Instances

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

Methods

takeDiag :: L m n -> R n Source #

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

Methods

takeDiag :: L m n -> R m Source #

KnownNat n => Diag (L n n) (R n) Source # 

Methods

takeDiag :: L n n -> R n Source #

data Sym n Source #

Instances

KnownNat n => Show (Sym n) Source # 

Methods

showsPrec :: Int -> Sym n -> ShowS #

show :: Sym n -> String #

showList :: [Sym n] -> ShowS #

KnownNat n => Eigen (Sym n) (R n) (L n n) Source # 

Methods

eigensystem :: Sym n -> (R n, L n n) Source #

eigenvalues :: Sym n -> R n Source #

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 #

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

Orphan instances

(KnownNat n', KnownNat m') => Testable (L n' m') Source # 

Methods

checkT :: L n' m' -> (Bool, IO ()) Source #

ioCheckT :: L n' m' -> IO (Bool, IO ()) Source #