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 --- packages/base/hmatrix-base.cabal | 4 +- packages/base/src/Data/Packed.hs | 1 + packages/base/src/Data/Packed/Development.hs | 1 + packages/base/src/Data/Packed/Foreign.hs | 1 + packages/base/src/Data/Packed/Internal.hs | 6 +- packages/base/src/Data/Packed/Matrix.hs | 5 +- packages/base/src/Data/Packed/Numeric.hs | 1 - packages/base/src/Data/Packed/ST.hs | 2 +- packages/base/src/Data/Packed/Vector.hs | 5 +- packages/base/src/Numeric/Container.hs | 6 +- packages/base/src/Numeric/LinearAlgebra.hs | 30 ----- .../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 +- packages/base/src/Numeric/Matrix.hs | 7 +- packages/base/src/Numeric/Vector.hs | 5 +- 20 files changed, 304 insertions(+), 67 deletions(-) delete mode 100644 packages/base/src/Numeric/LinearAlgebra.hs 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') diff --git a/packages/base/hmatrix-base.cabal b/packages/base/hmatrix-base.cabal index 3f12dad..638390a 100644 --- a/packages/base/hmatrix-base.cabal +++ b/packages/base/hmatrix-base.cabal @@ -39,10 +39,12 @@ library Numeric.LinearAlgebra.LAPACK Numeric.LinearAlgebra.Algorithms Numeric.Container - Numeric.LinearAlgebra Numeric.LinearAlgebra.Util Numeric.LinearAlgebra.Util.Convolution Data.Packed.IO + Numeric.LinearAlgebra.Base + Numeric.LinearAlgebra.Devel + Numeric.LinearAlgebra.Data other-modules: Data.Packed.Internal, Data.Packed.Internal.Common, diff --git a/packages/base/src/Data/Packed.hs b/packages/base/src/Data/Packed.hs index c66718a..129bd22 100644 --- a/packages/base/src/Data/Packed.hs +++ b/packages/base/src/Data/Packed.hs @@ -10,6 +10,7 @@ Types for dense 'Vector' and 'Matrix' of 'Storable' elements. -} ----------------------------------------------------------------------------- +{-# OPTIONS_HADDOCK hide #-} module Data.Packed ( -- * Vector diff --git a/packages/base/src/Data/Packed/Development.hs b/packages/base/src/Data/Packed/Development.hs index 6dfd551..1efedc9 100644 --- a/packages/base/src/Data/Packed/Development.hs +++ b/packages/base/src/Data/Packed/Development.hs @@ -13,6 +13,7 @@ -- in the @examples\/devel@ folder included in the package. -- ----------------------------------------------------------------------------- +{-# OPTIONS_HADDOCK hide #-} module Data.Packed.Development ( createVector, createMatrix, diff --git a/packages/base/src/Data/Packed/Foreign.hs b/packages/base/src/Data/Packed/Foreign.hs index efa51ca..1ec3694 100644 --- a/packages/base/src/Data/Packed/Foreign.hs +++ b/packages/base/src/Data/Packed/Foreign.hs @@ -6,6 +6,7 @@ -- @ glUniformMatrix4fv 0 1 (fromIntegral gl_TRUE) \`appMatrix\` perspective 0.01 100 (pi\/2) (4\/3) -- @ -- +{-# OPTIONS_HADDOCK hide #-} module Data.Packed.Foreign ( app , appVector, appVectorLen diff --git a/packages/base/src/Data/Packed/Internal.hs b/packages/base/src/Data/Packed/Internal.hs index 537e51e..59a72fc 100644 --- a/packages/base/src/Data/Packed/Internal.hs +++ b/packages/base/src/Data/Packed/Internal.hs @@ -2,11 +2,9 @@ -- | -- Module : Data.Packed.Internal -- Copyright : (c) Alberto Ruiz 2007 --- License : GPL-style --- --- Maintainer : Alberto Ruiz +-- License : BSD3 +-- Maintainer : Alberto Ruiz -- Stability : provisional --- Portability : portable -- -- Reexports all internal modules -- diff --git a/packages/base/src/Data/Packed/Matrix.hs b/packages/base/src/Data/Packed/Matrix.hs index d94d167..b3be823 100644 --- a/packages/base/src/Data/Packed/Matrix.hs +++ b/packages/base/src/Data/Packed/Matrix.hs @@ -8,9 +8,8 @@ -- | -- Module : Data.Packed.Matrix -- Copyright : (c) Alberto Ruiz 2007-10 --- License : GPL --- --- Maintainer : Alberto Ruiz +-- License : BSD3 +-- Maintainer : Alberto Ruiz -- Stability : provisional -- -- A Matrix representation suitable for numerical computations using LAPACK and GSL. diff --git a/packages/base/src/Data/Packed/Numeric.hs b/packages/base/src/Data/Packed/Numeric.hs index 4892089..c13e91d 100644 --- a/packages/base/src/Data/Packed/Numeric.hs +++ b/packages/base/src/Data/Packed/Numeric.hs @@ -10,7 +10,6 @@ -- Module : Data.Packed.Numeric -- Copyright : (c) Alberto Ruiz 2010-14 -- License : BSD3 --- -- Maintainer : Alberto Ruiz -- Stability : provisional -- diff --git a/packages/base/src/Data/Packed/ST.hs b/packages/base/src/Data/Packed/ST.hs index dae457c..5c45c7b 100644 --- a/packages/base/src/Data/Packed/ST.hs +++ b/packages/base/src/Data/Packed/ST.hs @@ -9,12 +9,12 @@ -- License : BSD3 -- Maintainer : Alberto Ruiz -- Stability : provisional --- Portability : portable -- -- In-place manipulation inside the ST monad. -- See examples/inplace.hs in the distribution. -- ----------------------------------------------------------------------------- +{-# OPTIONS_HADDOCK hide #-} module Data.Packed.ST ( -- * Mutable Vectors diff --git a/packages/base/src/Data/Packed/Vector.hs b/packages/base/src/Data/Packed/Vector.hs index a8f6bb1..53fe563 100644 --- a/packages/base/src/Data/Packed/Vector.hs +++ b/packages/base/src/Data/Packed/Vector.hs @@ -4,9 +4,8 @@ -- | -- Module : Data.Packed.Vector -- Copyright : (c) Alberto Ruiz 2007-10 --- License : GPL --- --- Maintainer : Alberto Ruiz +-- License : BSD3 +-- Maintainer : Alberto Ruiz -- Stability : provisional -- -- 1D arrays suitable for numeric computations using external libraries. diff --git a/packages/base/src/Numeric/Container.hs b/packages/base/src/Numeric/Container.hs index b7d3b80..240e5f5 100644 --- a/packages/base/src/Numeric/Container.hs +++ b/packages/base/src/Numeric/Container.hs @@ -9,11 +9,9 @@ -- | -- Module : Numeric.Container -- Copyright : (c) Alberto Ruiz 2010-14 --- License : GPL --- --- Maintainer : Alberto Ruiz +-- License : BSD3 +-- Maintainer : Alberto Ruiz -- Stability : provisional --- Portability : portable -- -- Basic numeric operations on 'Vector' and 'Matrix', including conversion routines. -- diff --git a/packages/base/src/Numeric/LinearAlgebra.hs b/packages/base/src/Numeric/LinearAlgebra.hs deleted file mode 100644 index 1db860c..0000000 --- a/packages/base/src/Numeric/LinearAlgebra.hs +++ /dev/null @@ -1,30 +0,0 @@ ------------------------------------------------------------------------------ -{- | -Module : Numeric.LinearAlgebra -Copyright : (c) Alberto Ruiz 2006-10 -License : GPL-style - -Maintainer : Alberto Ruiz (aruiz at um dot es) -Stability : provisional -Portability : uses ffi - -This module reexports all normally required functions for Linear Algebra applications. - -It also provides instances of standard classes 'Show', 'Read', 'Eq', -'Num', 'Fractional', and 'Floating' for 'Vector' and 'Matrix'. -In arithmetic operations one-component vectors and matrices automatically -expand to match the dimensions of the other operand. - --} ------------------------------------------------------------------------------ -{-# OPTIONS_HADDOCK hide #-} - -module Numeric.LinearAlgebra ( - module Numeric.Container, - module Numeric.LinearAlgebra.Algorithms -) where - -import Numeric.Container -import Numeric.LinearAlgebra.Algorithms -import Numeric.Matrix() -import Numeric.Vector() 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 diff --git a/packages/base/src/Numeric/Matrix.hs b/packages/base/src/Numeric/Matrix.hs index 3478aae..962ee84 100644 --- a/packages/base/src/Numeric/Matrix.hs +++ b/packages/base/src/Numeric/Matrix.hs @@ -7,12 +7,11 @@ ----------------------------------------------------------------------------- -- | -- Module : Numeric.Matrix --- Copyright : (c) Alberto Ruiz 2010 --- License : GPL-style +-- Copyright : (c) Alberto Ruiz 2014 +-- License : BSD3 -- --- Maintainer : Alberto Ruiz +-- Maintainer : Alberto Ruiz -- Stability : provisional --- Portability : portable -- -- Provides instances of standard classes 'Show', 'Read', 'Eq', -- 'Num', 'Fractional', and 'Floating' for 'Matrix'. diff --git a/packages/base/src/Numeric/Vector.hs b/packages/base/src/Numeric/Vector.hs index 2769cd9..3a425f5 100644 --- a/packages/base/src/Numeric/Vector.hs +++ b/packages/base/src/Numeric/Vector.hs @@ -7,11 +7,10 @@ -- | -- Module : Numeric.Vector -- Copyright : (c) Alberto Ruiz 2011 --- License : GPL-style +-- License : BSD3 -- --- Maintainer : Alberto Ruiz +-- Maintainer : Alberto Ruiz -- Stability : provisional --- Portability : portable -- -- Provides instances of standard classes 'Show', 'Read', 'Eq', -- 'Num', 'Fractional', and 'Floating' for 'Vector'. -- cgit v1.2.3