summaryrefslogtreecommitdiff
path: root/lib/Numeric/Container.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-09-20 17:08:34 +0000
committerAlberto Ruiz <aruiz@um.es>2010-09-20 17:08:34 +0000
commit05908719a7323110ba1955038d8341a8b7483351 (patch)
treef1f1fe28a8db64675dacc7eb4ec79d36e8174588 /lib/Numeric/Container.hs
parent482b533c3fbfcd75d6c5c1d3ce32585bf9fc2ad7 (diff)
generalized diagRect
Diffstat (limited to 'lib/Numeric/Container.hs')
-rw-r--r--lib/Numeric/Container.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Numeric/Container.hs b/lib/Numeric/Container.hs
index 83bf44e..1afc5a1 100644
--- a/lib/Numeric/Container.hs
+++ b/lib/Numeric/Container.hs
@@ -22,6 +22,7 @@
22module Numeric.Container ( 22module Numeric.Container (
23 -- * Generic operations 23 -- * Generic operations
24 Container(..), 24 Container(..),
25 ctrans, diag, ident,
25 -- * Matrix product and related functions 26 -- * Matrix product and related functions
26 Product(..), 27 Product(..),
27 mXm,mXv,vXm, 28 mXm,mXv,vXm,
@@ -221,6 +222,20 @@ instance (Container Vector a) => Container Matrix a where
221 222
222---------------------------------------------------- 223----------------------------------------------------
223 224
225-- | conjugate transpose
226ctrans :: Element e => Matrix e -> Matrix e
227ctrans = liftMatrix conjugateD . trans
228
229-- | Creates a square matrix with a given diagonal.
230diag :: (Num a, Element a) => Vector a -> Matrix a
231diag v = diagRect 0 v n n where n = dim v
232
233-- | creates the identity matrix of given dimension
234ident :: (Num a, Element a) => Int -> Matrix a
235ident n = diag (constantD 1 n)
236
237----------------------------------------------------
238
224 239
225-- | Matrix product and related functions 240-- | Matrix product and related functions
226class Element e => Product e where 241class Element e => Product e where