diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Data.hs | 78 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Data/Devel.hs | 63 |
2 files changed, 141 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/Data.hs b/lib/Numeric/LinearAlgebra/Data.hs index 10ad650..6e5dcef 100644 --- a/lib/Numeric/LinearAlgebra/Data.hs +++ b/lib/Numeric/LinearAlgebra/Data.hs | |||
@@ -11,6 +11,84 @@ Stability : provisional | |||
11 | -------------------------------------------------------------------------------- | 11 | -------------------------------------------------------------------------------- |
12 | 12 | ||
13 | module Numeric.LinearAlgebra.Data( | 13 | module Numeric.LinearAlgebra.Data( |
14 | -- * Vector | ||
15 | Vector, (|>), dim, (@>), | ||
14 | 16 | ||
17 | -- * Matrix | ||
18 | Matrix, (><), size, (@@>), trans, ctrans, | ||
19 | |||
20 | -- * Construction functions | ||
21 | |||
22 | scalar, konst, build, assoc, accum, linspace, -- ones, zeros, | ||
23 | |||
24 | -- * Data manipulation | ||
25 | |||
26 | fromList, toList, subVector, takesV, vjoin, | ||
27 | |||
28 | flatten, reshape, asRow, asColumn, row, col, | ||
29 | |||
30 | fromRows, toRows, fromColumns, toColumns, fromLists, toLists, | ||
31 | |||
32 | takeRows, dropRows, takeColumns, dropColumns, subMatrix, (?), (¿), fliprl, flipud, | ||
33 | |||
34 | -- * Diagonal matrices | ||
35 | |||
36 | ident, diag, diagl, diagRect, takeDiag, | ||
37 | |||
38 | -- * Block matrices | ||
39 | |||
40 | fromBlocks, (¦), (——), diagBlock, repmat, toBlocks, toBlocksEvery, | ||
41 | |||
42 | -- * Mapping functions | ||
43 | |||
44 | conj, cmap, step, cond, | ||
45 | |||
46 | -- * Find elements | ||
47 | |||
48 | find, maxIndex, minIndex, maxElement, minElement, atIndex, | ||
49 | |||
50 | -- * Products | ||
51 | |||
52 | (<>), (·), scale, outer, kronecker, cross, | ||
53 | sumElements, prodElements, absSum, | ||
54 | optimiseMult, | ||
55 | |||
56 | corr, conv, corrMin, corr2, conv2, | ||
57 | |||
58 | LSDiv(..), | ||
59 | |||
60 | -- * Random arrays | ||
61 | |||
62 | rand, randn, RandDist(..), randomVector, gaussianSample, uniformSample, | ||
63 | |||
64 | -- * IO | ||
65 | |||
66 | disp, dispf, disps, dispcf, vecdisp, latexFormat, format, | ||
67 | loadMatrix, saveMatrix, fromFile, fileDimensions, | ||
68 | readMatrix, | ||
69 | fscanfVector, fprintfVector, freadVector, fwriteVector, | ||
70 | |||
71 | -- * Element conversion | ||
72 | Convert(..), | ||
73 | Complexable(), | ||
74 | RealElement(), | ||
75 | |||
76 | RealOf, ComplexOf, SingleOf, DoubleOf, | ||
77 | |||
78 | IndexOf, | ||
79 | |||
80 | module Data.Complex, | ||
81 | |||
82 | -- * Misc | ||
83 | meanCov, arctan2, | ||
84 | separable, | ||
85 | fromArray2D | ||
86 | |||
15 | ) where | 87 | ) where |
16 | 88 | ||
89 | import Data.Packed.Vector | ||
90 | import Data.Packed.Matrix | ||
91 | import Numeric.Container | ||
92 | import Numeric.LinearAlgebra.Util | ||
93 | import Data.Complex | ||
94 | |||
diff --git a/lib/Numeric/LinearAlgebra/Data/Devel.hs b/lib/Numeric/LinearAlgebra/Data/Devel.hs new file mode 100644 index 0000000..6358d1f --- /dev/null +++ b/lib/Numeric/LinearAlgebra/Data/Devel.hs | |||
@@ -0,0 +1,63 @@ | |||
1 | -------------------------------------------------------------------------------- | ||
2 | {- | | ||
3 | Module : Numeric.LinearAlgebra.Data.Devel | ||
4 | Copyright : (c) Alberto Ruiz 2014 | ||
5 | License : GPL | ||
6 | |||
7 | Maintainer : Alberto Ruiz | ||
8 | Stability : provisional | ||
9 | |||
10 | The library can be easily extended using the tools in this module. | ||
11 | |||
12 | -} | ||
13 | -------------------------------------------------------------------------------- | ||
14 | |||
15 | module Numeric.LinearAlgebra.Data.Devel( | ||
16 | -- * FFI helpers | ||
17 | -- | Sample usage, to upload a perspective matrix to a shader. | ||
18 | -- | ||
19 | -- @ glUniformMatrix4fv 0 1 (fromIntegral gl_TRUE) \`appMatrix\` perspective 0.01 100 (pi\/2) (4\/3) | ||
20 | -- @ | ||
21 | module Data.Packed.Foreign, | ||
22 | |||
23 | -- * FFI tools | ||
24 | -- | Illustrative usage examples can be found | ||
25 | -- in the @examples\/devel@ folder included in the package. | ||
26 | module Data.Packed.Development, | ||
27 | |||
28 | -- * ST | ||
29 | -- | In-place manipulation inside the ST monad. | ||
30 | -- See examples\/inplace.hs in the distribution. | ||
31 | |||
32 | -- ** Mutable Vectors | ||
33 | STVector, newVector, thawVector, freezeVector, runSTVector, | ||
34 | readVector, writeVector, modifyVector, liftSTVector, | ||
35 | -- ** Mutable Matrices | ||
36 | STMatrix, newMatrix, thawMatrix, freezeMatrix, runSTMatrix, | ||
37 | readMatrix, writeMatrix, modifyMatrix, liftSTMatrix, | ||
38 | -- ** Unsafe functions | ||
39 | newUndefinedVector, | ||
40 | unsafeReadVector, unsafeWriteVector, | ||
41 | unsafeThawVector, unsafeFreezeVector, | ||
42 | newUndefinedMatrix, | ||
43 | unsafeReadMatrix, unsafeWriteMatrix, | ||
44 | unsafeThawMatrix, unsafeFreezeMatrix, | ||
45 | |||
46 | -- * Special maps and zips | ||
47 | mapVectorWithIndex, zipVector, zipVectorWith, unzipVector, unzipVectorWith, | ||
48 | mapVectorM, mapVectorM_, mapVectorWithIndexM, mapVectorWithIndexM_, | ||
49 | foldLoop, foldVector, foldVectorG, foldVectorWithIndex, | ||
50 | mapMatrixWithIndex, mapMatrixWithIndexM, mapMatrixWithIndexM_, | ||
51 | liftMatrix, liftMatrix2, liftMatrix2Auto, | ||
52 | |||
53 | -- * Misc | ||
54 | Element, Container | ||
55 | ) where | ||
56 | |||
57 | import Data.Packed.Foreign | ||
58 | import Data.Packed.Development | ||
59 | import Data.Packed.ST | ||
60 | import Numeric.Container(Container) | ||
61 | import Data.Packed | ||
62 | |||
63 | |||