summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Numeric/MatrixBoot.hs41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/Numeric/MatrixBoot.hs b/lib/Numeric/MatrixBoot.hs
new file mode 100644
index 0000000..13560b1
--- /dev/null
+++ b/lib/Numeric/MatrixBoot.hs
@@ -0,0 +1,41 @@
1{-# LANGUAGE FlexibleContexts #-}
2-----------------------------------------------------------------------------
3-- |
4-- Module : Numeric.MatrixBoot
5-- Copyright : (c) Alberto Ruiz 2010
6-- License : GPL-style
7--
8-- Maintainer : Alberto Ruiz <aruiz@um.es>
9-- Stability : provisional
10-- Portability : portable
11--
12-- Module to avoid cyclic dependency
13--
14-----------------------------------------------------------------------------
15
16module Numeric.MatrixBoot (
17 ctrans, diag, ident,
18 ) where
19
20import Data.Packed.Vector
21import Data.Packed.Matrix
22import Data.Packed.Internal.Matrix
23import Numeric.Container
24
25-------------------------------------------------------------------
26
27-- | conjugate transpose
28ctrans :: (Container Vector e, Element e) => Matrix e -> Matrix e
29ctrans = liftMatrix conj . trans
30
31-- | Creates a square matrix with a given diagonal.
32diag :: (Num a, Element a) => Vector a -> Matrix a
33diag v = diagRect 0 v n n where n = dim v
34
35-- | creates the identity matrix of given dimension
36ident :: (Num a, Element a) => Int -> Matrix a
37ident n = diag (constantD 1 n)
38
39----------------------------------------------------
40
41