summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hmatrix.cabal4
-rw-r--r--lib/Numeric/LinearAlgebra/Real.hs (renamed from examples/Real.hs)29
2 files changed, 25 insertions, 8 deletions
diff --git a/hmatrix.cabal b/hmatrix.cabal
index 049d4d5..a772746 100644
--- a/hmatrix.cabal
+++ b/hmatrix.cabal
@@ -49,7 +49,6 @@ extra-source-files: examples/deriv.hs
49 examples/devel/ej1/functions.c 49 examples/devel/ej1/functions.c
50 examples/devel/ej2/wrappers.hs 50 examples/devel/ej2/wrappers.hs
51 examples/devel/ej2/functions.c 51 examples/devel/ej2/functions.c
52 examples/Real.hs
53 examples/vector.hs 52 examples/vector.hs
54 examples/monadic.hs 53 examples/monadic.hs
55 examples/bool.hs 54 examples/bool.hs
@@ -87,7 +86,7 @@ library
87 Build-Depends: base >= 4 && < 5, 86 Build-Depends: base >= 4 && < 5,
88 array, 87 array,
89 storable-complex, 88 storable-complex,
90 process, 89 process, random,
91 vector >= 0.8, 90 vector >= 0.8,
92 binary 91 binary
93 92
@@ -111,6 +110,7 @@ library
111 Numeric.LinearAlgebra, 110 Numeric.LinearAlgebra,
112 Numeric.LinearAlgebra.LAPACK, 111 Numeric.LinearAlgebra.LAPACK,
113 Numeric.LinearAlgebra.Algorithms, 112 Numeric.LinearAlgebra.Algorithms,
113 Numeric.LinearAlgebra.Real,
114 Graphics.Plot, 114 Graphics.Plot,
115 Data.Packed.ST, 115 Data.Packed.ST,
116 Data.Packed.Development 116 Data.Packed.Development
diff --git a/examples/Real.hs b/lib/Numeric/LinearAlgebra/Real.hs
index 9083b87..6cba045 100644
--- a/examples/Real.hs
+++ b/lib/Numeric/LinearAlgebra/Real.hs
@@ -1,10 +1,21 @@
1-----------------------------------------------------------------------------
2{- |
3Module : Numeric.LinearAlgebra.Real
4Copyright : (c) Alberto Ruiz 2012
5License : GPL
1 6
2-- Alternative interface and utilities for creation of real arrays, useful to work in interactive mode. 7Maintainer : Alberto Ruiz (aruiz at um dot es)
8Stability : provisional
3 9
4module Real( 10Additional functions for real arrays.
5 module Numeric.LinearAlgebra, 11
12-}
13-----------------------------------------------------------------------------
14
15module Numeric.LinearAlgebra.Real(
6 (<>), (*>), (<*), (<\>), (\>), 16 (<>), (*>), (<*), (<\>), (\>),
7 vector, 17 vector,
18 linspace,
8 eye, 19 eye,
9 zeros, ones, 20 zeros, ones,
10 diagl, 21 diagl,
@@ -14,9 +25,14 @@ module Real(
14 rand, randn 25 rand, randn
15) where 26) where
16 27
17import Numeric.LinearAlgebra hiding ((<>), (<\>)) 28import Numeric.LinearAlgebra hiding ((<>), (<\>), linspace)
29import qualified Numeric.LinearAlgebra as LA
18import System.Random(randomIO) 30import System.Random(randomIO)
19 31
32linspace :: Int -> (Double,Double) -> Vector Double
33linspace = LA.linspace
34
35
20infixl 7 <> 36infixl 7 <>
21-- | Matrix product ('multiply') 37-- | Matrix product ('multiply')
22(<>) :: Field t => Matrix t -> Matrix t -> Matrix t 38(<>) :: Field t => Matrix t -> Matrix t -> Matrix t
@@ -95,15 +111,16 @@ infixl 8 &
95a & b = fromBlocks [[a,b]] 111a & b = fromBlocks [[a,b]]
96 112
97-- | Vertical concatenation of real matrices. 113-- | Vertical concatenation of real matrices.
98infixl 7 //
99(//) :: Matrix Double -> Matrix Double -> Matrix Double 114(//) :: Matrix Double -> Matrix Double -> Matrix Double
115infixl 7 //
100a // b = fromBlocks [[a],[b]] 116a // b = fromBlocks [[a],[b]]
101 117
118
102-- | Real block matrix from a rectangular list of lists. 119-- | Real block matrix from a rectangular list of lists.
103blocks :: [[Matrix Double]] -> Matrix Double 120blocks :: [[Matrix Double]] -> Matrix Double
104blocks = fromBlocks 121blocks = fromBlocks
105 122
106-- | A real matrix with a single row, create from a list of elements. 123-- | A real matrix with a single row, created from a list of elements.
107row :: [Double] -> Matrix Double 124row :: [Double] -> Matrix Double
108row = asRow . vector 125row = asRow . vector
109 126