Copyright | (c) Alberto Ruiz 2014 |
---|---|
License | BSD3 |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
Experimental interface with statically checked dimensions.
See code examples at http://dis.um.es/~alberto/hmatrix/static.html.
- type ℝ = Double
- data R n
- vec2 :: ℝ -> ℝ -> R 2
- vec3 :: ℝ -> ℝ -> ℝ -> R 3
- vec4 :: ℝ -> ℝ -> ℝ -> ℝ -> R 4
- (&) :: forall n. (KnownNat n, 1 <= n) => R n -> ℝ -> R (n + 1)
- (#) :: forall n m. (KnownNat n, KnownNat m) => R n -> R m -> R (n + m)
- split :: forall p n. (KnownNat p, KnownNat n, p <= n) => R n -> (R p, R (n - p))
- headTail :: (KnownNat n, 1 <= n) => R n -> (ℝ, R (n - 1))
- vector :: KnownNat n => [ℝ] -> R n
- linspace :: forall n. KnownNat n => (ℝ, ℝ) -> R n
- range :: forall n. KnownNat n => R n
- dim :: forall n. KnownNat n => R n
- data L m n
- type Sq n = L n n
- build :: forall m n. (KnownNat n, KnownNat m) => (ℝ -> ℝ -> ℝ) -> L m n
- row :: R n -> L 1 n
- col :: KnownNat n => R n -> L n 1
- (|||) :: (KnownNat r1, KnownNat c, KnownNat r2, KnownNat ((+) r1 r2)) => L c r1 -> L c r2 -> L c ((+) r1 r2)
- (===) :: (KnownNat r1, KnownNat r2, KnownNat c) => L r1 c -> L r2 c -> L (r1 + r2) c
- splitRows :: forall p m n. (KnownNat p, KnownNat m, KnownNat n, p <= m) => L m n -> (L p n, L (m - p) n)
- 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))
- unrow :: L 1 n -> R n
- uncol :: KnownNat n => L n 1 -> R n
- tr :: Transposable m mt => m -> mt
- eye :: KnownNat n => Sq n
- diag :: KnownNat n => R n -> Sq n
- blockAt :: forall m n. (KnownNat m, KnownNat n) => ℝ -> Int -> Int -> Matrix Double -> L m n
- matrix :: (KnownNat m, KnownNat n) => [ℝ] -> L m n
- data C n
- data M m n
- data Her n
- her :: KnownNat n => M n n -> Her n
- 𝑖 :: Sized ℂ s c => s
- (<>) :: forall m k n. (KnownNat m, KnownNat k, KnownNat n) => L m k -> L k n -> L m n
- (#>) :: (KnownNat m, KnownNat n) => L m n -> R n -> R m
- (<.>) :: R n -> R n -> ℝ
- linSolve :: (KnownNat m, KnownNat n) => L m m -> L m n -> Maybe (L m n)
- (<\>) :: (KnownNat m, KnownNat n, KnownNat r) => L m n -> L m r -> L n r
- svd :: (KnownNat m, KnownNat n) => L m n -> (L m m, R n, L n n)
- 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
- svdTall :: (KnownNat m, KnownNat n, n <= m) => L m n -> (L m n, R n, L n n)
- svdFlat :: (KnownNat m, KnownNat n, m <= n) => L m n -> (L m m, R m, L n m)
- class Eigen m l v | m -> l, m -> v where
- eigensystem :: m -> (l, v)
- eigenvalues :: m -> l
- withNullspace :: forall m n z. (KnownNat m, KnownNat n) => L m n -> (forall k. KnownNat k => L n k -> z) -> z
- qr :: (KnownNat m, KnownNat n) => L m n -> (L m m, L m n)
- chol :: KnownNat n => Sym n -> Sq n
- mean :: (KnownNat n, 1 <= n) => R n -> ℝ
- class Disp t where
- class Domain field vec mat | mat -> vec field, vec -> mat field, field -> mat vec where
- mul :: forall m k n. (KnownNat m, KnownNat k, KnownNat n) => mat m k -> mat k n -> mat m n
- app :: forall m n. (KnownNat m, KnownNat n) => mat m n -> vec n -> vec m
- dot :: forall n. KnownNat n => vec n -> vec n -> field
- cross :: vec 3 -> vec 3 -> vec 3
- diagR :: forall m n k. (KnownNat m, KnownNat n, KnownNat k) => field -> vec k -> mat m n
- withVector :: forall z. Vector ℝ -> (forall n. KnownNat n => R n -> z) -> z
- withMatrix :: forall z. Matrix ℝ -> (forall m n. (KnownNat m, KnownNat n) => L m n -> z) -> z
- toRows :: forall m n. (KnownNat m, KnownNat n) => L m n -> [R n]
- toColumns :: forall m n. (KnownNat m, KnownNat n) => L m n -> [R m]
- class Num t => Sized t s d | s -> t, s -> d where
- class Diag m d | m -> d where
- takeDiag :: m -> d
- data Sym n
- sym :: KnownNat n => Sq n -> Sym n
- mTm :: (KnownNat m, KnownNat n) => L m n -> Sym n
- unSym :: Sym n -> Sq n
- <·> :: R n -> R n -> ℝ
Vector
Domain ℝ R L Source | |
KnownNat n => Sized ℝ (R n) Vector Source | |
Floating (R n) Source | |
Fractional (R n) Source | |
Num (R n) Source | |
KnownNat n => Show (R n) Source | |
KnownNat n => Disp (R n) Source | |
KnownNat n => Eigen (Sym n) (R n) (L n n) Source | |
(KnownNat m, KnownNat n, (<=) n ((+) m 1)) => Diag (L m n) (R n) Source | |
(KnownNat m, KnownNat n, (<=) m ((+) n 1)) => Diag (L m n) (R m) Source | |
KnownNat n => Diag (L n n) (R n) Source |
Matrix
Domain ℝ R L Source | |
(KnownNat m, KnownNat n) => Sized ℝ (L m n) Matrix Source | |
KnownNat n => Eigen (Sym n) (R n) (L n n) Source | |
KnownNat n => Eigen (Sq n) (C n) (M n n) Source | |
(KnownNat n, KnownNat m) => Floating (L n m) Source | |
(KnownNat n, KnownNat m) => Fractional (L n m) Source | |
(KnownNat n, KnownNat m) => Num (L n m) Source | |
(KnownNat m, KnownNat n) => Show (L m n) Source | |
(KnownNat m, KnownNat n) => Disp (L m n) Source | |
(KnownNat m, KnownNat n, (<=) n ((+) m 1)) => Diag (L m n) (R n) Source | |
(KnownNat m, KnownNat n, (<=) m ((+) n 1)) => Diag (L m n) (R m) Source | |
KnownNat n => Diag (L n n) (R n) Source | |
(KnownNat n, KnownNat m) => Transposable (L m n) (L n m) Source |
(|||) :: (KnownNat r1, KnownNat c, KnownNat r2, KnownNat ((+) r1 r2)) => 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
tr :: Transposable m mt => m -> mt Source
conjugate transpose
Complex
KnownNat n => Eigen (Sq n) (C n) (M n n) Source | |
(KnownNat n, KnownNat m) => Floating (M n m) Source | |
(KnownNat n, KnownNat m) => Fractional (M n m) Source | |
(KnownNat n, KnownNat m) => Num (M n m) Source | |
(KnownNat m, KnownNat n) => Show (M m n) Source | |
(KnownNat m, KnownNat n) => Disp (M m n) Source | |
(KnownNat n, KnownNat m) => Transposable (M m n) (M n m) Source |
Products
(<>) :: forall m k n. (KnownNat m, KnownNat k, KnownNat n) => L m k -> L k n -> L m n infixr 8 Source
Linear Systems
Factorizations
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
class Eigen m l v | m -> l, m -> v where Source
eigensystem :: m -> (l, v) Source
eigenvalues :: m -> l Source
withNullspace :: forall m n z. (KnownNat m, KnownNat n) => L m n -> (forall k. KnownNat k => L n k -> z) -> z Source
Misc
class Domain field vec mat | mat -> vec field, vec -> mat field, field -> mat vec where Source
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
withMatrix :: forall z. Matrix ℝ -> (forall m n. (KnownNat m, KnownNat n) => L m n -> z) -> z Source