summaryrefslogtreecommitdiff
path: root/lib/Numeric
diff options
context:
space:
mode:
authorVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-21 03:45:09 +0000
committerVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-21 03:45:09 +0000
commit3290b56b975ec151a389223f720c071b6404f6cc (patch)
tree9892c9ab0d903e4d698c60c1dcc01b47ea4dc07a /lib/Numeric
parent7b8680256893a8624fab8d1d256773919df70068 (diff)
add MatrixBoot.hs to darcs
Diffstat (limited to 'lib/Numeric')
-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