From 51f4cc7b4b301142b8df73568ffaa448f9e6dd50 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 16 May 2014 14:13:49 +0200 Subject: license changes, reexport modules --- .../base/src/Numeric/LinearAlgebra/Algorithms.hs | 9 +- packages/base/src/Numeric/LinearAlgebra/Base.hs | 139 +++++++++++++++++++++ packages/base/src/Numeric/LinearAlgebra/Data.hs | 68 ++++++++++ packages/base/src/Numeric/LinearAlgebra/Devel.hs | 68 ++++++++++ packages/base/src/Numeric/LinearAlgebra/LAPACK.hs | 1 - packages/base/src/Numeric/LinearAlgebra/Util.hs | 5 +- .../src/Numeric/LinearAlgebra/Util/Convolution.hs | 7 +- 7 files changed, 284 insertions(+), 13 deletions(-) create mode 100644 packages/base/src/Numeric/LinearAlgebra/Base.hs create mode 100644 packages/base/src/Numeric/LinearAlgebra/Data.hs create mode 100644 packages/base/src/Numeric/LinearAlgebra/Devel.hs (limited to 'packages/base/src/Numeric/LinearAlgebra') diff --git a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs index 6f40683..92761be 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Algorithms.hs @@ -7,12 +7,10 @@ ----------------------------------------------------------------------------- {- | Module : Numeric.LinearAlgebra.Algorithms -Copyright : (c) Alberto Ruiz 2006-9 -License : GPL-style - -Maintainer : Alberto Ruiz (aruiz at um dot es) +Copyright : (c) Alberto Ruiz 2006-14 +License : BSD3 +Maintainer : Alberto Ruiz Stability : provisional -Portability : uses ffi High level generic interface to common matrix computations. @@ -20,6 +18,7 @@ Specific functions for particular base types can also be explicitly imported from "Numeric.LinearAlgebra.LAPACK". -} +{-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- module Numeric.LinearAlgebra.Algorithms ( diff --git a/packages/base/src/Numeric/LinearAlgebra/Base.hs b/packages/base/src/Numeric/LinearAlgebra/Base.hs new file mode 100644 index 0000000..8aa7846 --- /dev/null +++ b/packages/base/src/Numeric/LinearAlgebra/Base.hs @@ -0,0 +1,139 @@ +----------------------------------------------------------------------------- +{- | +Module : Numeric.LinearAlgebra +Copyright : (c) Alberto Ruiz 2006-14 +License : BSD3 +Maintainer : Alberto Ruiz +Stability : provisional + +This module reexports the most common Linear Algebra functions. + +-} +----------------------------------------------------------------------------- +module Numeric.LinearAlgebra.Base ( + + -- * Basic types and data processing + module Numeric.LinearAlgebra.Data, + + -- | The standard numeric classes are defined elementwise: + -- + -- >>> fromList [1,2,3] * fromList [3,0,-2 :: Double] + -- fromList [3.0,0.0,-6.0] + -- + -- >>> (3><3) [1..9] * ident 3 :: Matrix Double + -- (3><3) + -- [ 1.0, 0.0, 0.0 + -- , 0.0, 5.0, 0.0 + -- , 0.0, 0.0, 9.0 ] + -- + -- In arithmetic operations single-element vectors and matrices + -- (created from numeric literals or using 'scalar') automatically + -- expand to match the dimensions of the other operand: + -- + -- >>> 5 + 2*ident 3 :: Matrix Double + -- (3><3) + -- [ 7.0, 5.0, 5.0 + -- , 5.0, 7.0, 5.0 + -- , 5.0, 5.0, 7.0 ] + -- + + -- * Products + (<.>), + + -- | The matrix product is also implemented in the "Data.Monoid" instance for Matrix, where + -- single-element matrices (created from numeric literals or using 'scalar') + -- are used for scaling. + -- + -- >>> let m = (2><3)[1..] :: Matrix Double + -- >>> m <> 2 <> diagl[0.5,1,0] + -- (2><3) + -- [ 1.0, 4.0, 0.0 + -- , 4.0, 10.0, 0.0 ] + -- + -- mconcat uses 'optimiseMult' to get the optimal association order. + + (◇), + outer, kronecker, cross, + scale, + sumElements, prodElements, absSum, + + -- * Linear Systems + (<\>), + linearSolve, + linearSolveLS, + linearSolveSVD, + luSolve, + cholSolve, + + -- * Inverse and pseudoinverse + inv, pinv, pinvTol, + + -- * Determinant and rank + rcond, rank, ranksv, + det, invlndet, + + -- * Singular value decomposition + svd, + fullSVD, + thinSVD, + compactSVD, + singularValues, + leftSV, rightSV, + + -- * Eigensystems + eig, eigSH, eigSH', + eigenvalues, eigenvaluesSH, eigenvaluesSH', + geigSH', + + -- * QR + qr, rq, qrRaw, qrgr, + + -- * Cholesky + chol, cholSH, mbCholSH, + + -- * Hessenberg + hess, + + -- * Schur + schur, + + -- * LU + lu, luPacked, + + -- * Matrix functions + expm, + sqrtm, + matFunc, + + -- * Nullspace + nullspacePrec, + nullVector, + nullspaceSVD, + null1, null1sym, + + orth, + + -- * Norms + norm1, norm2, normInf, pnorm, NormType(..), + + -- * Correlation and Convolution + corr, conv, corrMin, corr2, conv2, + + -- * Random arrays + + -- | rand, randn, RandDist(..), randomVector, gaussianSample, uniformSample + + -- * Misc + meanCov, peps, relativeError, haussholder, optimiseMult, udot +) where + +import Numeric.LinearAlgebra.Data + +import Numeric.Matrix() +import Numeric.Vector() +import Numeric.Container +import Numeric.LinearAlgebra.Algorithms +import Numeric.LinearAlgebra.Util + + + diff --git a/packages/base/src/Numeric/LinearAlgebra/Data.hs b/packages/base/src/Numeric/LinearAlgebra/Data.hs new file mode 100644 index 0000000..3bc88f9 --- /dev/null +++ b/packages/base/src/Numeric/LinearAlgebra/Data.hs @@ -0,0 +1,68 @@ +-------------------------------------------------------------------------------- +{- | +Module : Numeric.LinearAlgebra.Data +Copyright : (c) Alberto Ruiz 2014 +License : BSD3 +Maintainer : Alberto Ruiz +Stability : provisional + +Basic data processing. + +-} +-------------------------------------------------------------------------------- + +module Numeric.LinearAlgebra.Data( + + -- * Vector + -- | 1D arrays are storable vectors from the vector package. + + Vector, (|>), dim, (@>), + + -- * Matrix + Matrix, (><), size, (@@>), trans, ctrans, + + -- * Construction + scalar, konst, build, assoc, accum, linspace, -- ones, zeros, + + -- * Diagonal + ident, diag, diagl, diagRect, takeDiag, + + -- * Data manipulation + fromList, toList, subVector, takesV, vjoin, + flatten, reshape, asRow, asColumn, row, col, + fromRows, toRows, fromColumns, toColumns, fromLists, toLists, fromArray2D, + takeRows, dropRows, takeColumns, dropColumns, subMatrix, (?), (¿), fliprl, flipud, + + -- * Block matrix + fromBlocks, (¦), (——), diagBlock, repmat, toBlocks, toBlocksEvery, + + -- * Mapping functions + conj, cmap, step, cond, + + -- * Find elements + find, maxIndex, minIndex, maxElement, minElement, atIndex, + + -- * IO + disp, dispf, disps, dispcf, latexFormat, format, readMatrix, + + -- | loadMatrix, saveMatrix, fromFile, fileDimensions, fscanfVector, fprintfVector, freadVector, fwriteVector + +-- * Conversion + Convert(..), + + -- * Misc + arctan2, + rows, cols, + separable, + + module Data.Complex + +) where + +import Data.Packed.Vector +import Data.Packed.Matrix +import Numeric.Container +import Data.Packed.IO +import Numeric.LinearAlgebra.Util +import Data.Complex + diff --git a/packages/base/src/Numeric/LinearAlgebra/Devel.hs b/packages/base/src/Numeric/LinearAlgebra/Devel.hs new file mode 100644 index 0000000..c41db2d --- /dev/null +++ b/packages/base/src/Numeric/LinearAlgebra/Devel.hs @@ -0,0 +1,68 @@ +-------------------------------------------------------------------------------- +{- | +Module : Numeric.HMatrix.Devel +Copyright : (c) Alberto Ruiz 2014 +License : BSD3 +Maintainer : Alberto Ruiz +Stability : provisional + +The library can be easily extended using the tools in this module. + +-} +-------------------------------------------------------------------------------- + +module Numeric.LinearAlgebra.Devel( + -- * FFI helpers + -- | Sample usage, to upload a perspective matrix to a shader. + -- + -- @ glUniformMatrix4fv 0 1 (fromIntegral gl_TRUE) \`appMatrix\` perspective 0.01 100 (pi\/2) (4\/3) + -- @ + module Data.Packed.Foreign, + + -- * FFI tools + -- | Illustrative usage examples can be found + -- in the @examples\/devel@ folder included in the package. + module Data.Packed.Development, + + -- * ST + -- | In-place manipulation inside the ST monad. + -- See examples\/inplace.hs in the distribution. + + -- ** Mutable Vectors + STVector, newVector, thawVector, freezeVector, runSTVector, + readVector, writeVector, modifyVector, liftSTVector, + -- ** Mutable Matrices + STMatrix, newMatrix, thawMatrix, freezeMatrix, runSTMatrix, + readMatrix, writeMatrix, modifyMatrix, liftSTMatrix, + -- ** Unsafe functions + newUndefinedVector, + unsafeReadVector, unsafeWriteVector, + unsafeThawVector, unsafeFreezeVector, + newUndefinedMatrix, + unsafeReadMatrix, unsafeWriteMatrix, + unsafeThawMatrix, unsafeFreezeMatrix, + + -- * Special maps and zips + mapVectorWithIndex, zipVector, zipVectorWith, unzipVector, unzipVectorWith, + mapVectorM, mapVectorM_, mapVectorWithIndexM, mapVectorWithIndexM_, + foldLoop, foldVector, foldVectorG, foldVectorWithIndex, + mapMatrixWithIndex, mapMatrixWithIndexM, mapMatrixWithIndexM_, + liftMatrix, liftMatrix2, liftMatrix2Auto, + + -- * Auxiliary classes + Element, Container, Product, Contraction, LSDiv, + Complexable(), RealElement(), + RealOf, ComplexOf, SingleOf, DoubleOf, + IndexOf, + Field, Normed +) where + +import Data.Packed.Foreign +import Data.Packed.Development +import Data.Packed.ST +import Numeric.Container(Container,Contraction,LSDiv,Product, + Complexable(),RealElement(), + RealOf, ComplexOf, SingleOf, DoubleOf, IndexOf) +import Data.Packed +import Numeric.LinearAlgebra.Algorithms(Field,Normed) + diff --git a/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs b/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs index 9cb67d4..40fef45 100644 --- a/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs +++ b/packages/base/src/Numeric/LinearAlgebra/LAPACK.hs @@ -3,7 +3,6 @@ -- Module : Numeric.LinearAlgebra.LAPACK -- Copyright : (c) Alberto Ruiz 2006-14 -- License : BSD3 --- -- Maintainer : Alberto Ruiz -- Stability : provisional -- diff --git a/packages/base/src/Numeric/LinearAlgebra/Util.hs b/packages/base/src/Numeric/LinearAlgebra/Util.hs index 533c54b..f0470ab 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util.hs @@ -3,9 +3,8 @@ {- | Module : Numeric.LinearAlgebra.Util Copyright : (c) Alberto Ruiz 2013 -License : GPL - -Maintainer : Alberto Ruiz (aruiz at um dot es) +License : BSD3 +Maintainer : Alberto Ruiz Stability : provisional -} diff --git a/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs b/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs index d04c46b..1775f14 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util/Convolution.hs @@ -3,9 +3,8 @@ {- | Module : Numeric.LinearAlgebra.Util.Convolution Copyright : (c) Alberto Ruiz 2012 -License : GPL - -Maintainer : Alberto Ruiz (aruiz at um dot es) +License : BSD3 +Maintainer : Alberto Ruiz Stability : provisional -} @@ -17,7 +16,7 @@ module Numeric.LinearAlgebra.Util.Convolution( corr2, conv2, separable ) where -import Numeric.LinearAlgebra +import Numeric.Container vectSS :: Element t => Int -> Vector t -> Matrix t -- cgit v1.2.3