From 3cfce69bf3cb7d7f7976abb454b64f6fa3a32c97 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 23 Sep 2010 09:49:04 +0000 Subject: minor doc fix, clean Plot --- lib/Data/Packed/Internal/Matrix.hs | 26 ++++++++++++++------------ lib/Data/Packed/Matrix.hs | 7 +++++-- lib/Data/Packed/Vector.hs | 2 ++ 3 files changed, 21 insertions(+), 14 deletions(-) (limited to 'lib/Data/Packed') diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 7b823de..b616442 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs @@ -75,7 +75,11 @@ import Foreign.C.String data MatrixOrder = RowMajor | ColumnMajor deriving (Show,Eq) --- | Matrix representation suitable for GSL and LAPACK computations. +{- | Matrix representation suitable for GSL and LAPACK computations. + +The elements are stored in a continuous memory array. + +-} data Matrix t = MC { irows :: {-# UNPACK #-} !Int , icols :: {-# UNPACK #-} !Int , cdat :: {-# UNPACK #-} !(Vector t) } @@ -245,9 +249,14 @@ compat m1 m2 = rows m1 == rows m2 && cols m1 == cols m2 ------------------------------------------------------------------ --- | Supported element types for basic matrix operations. --- provides unoptimised defaults for all (Storable a) instances --- @instance Element Foo where@ +{- | Supported matrix elements. + + This class provides optimized internal + operations for selected element types. + It provides unoptimised defaults for any 'Storable' type, + so you can create instances simply as: + @instance Element Foo@. +-} class (Storable a) => Element a where subMatrixD :: (Int,Int) -- ^ (r0,c0) starting position -> (Int,Int) -- ^ (rt,ct) dimensions of submatrix @@ -257,30 +266,23 @@ class (Storable a) => Element a where transdata = transdataP -- transdata' constantD :: a -> Int -> Vector a constantD = constantP -- constant' -{- - conjugateD :: Vector a -> Vector a - conjugateD = id --} + instance Element Float where transdata = transdataAux ctransF constantD = constantAux cconstantF --- conjugateD = id instance Element Double where transdata = transdataAux ctransR constantD = constantAux cconstantR --- conjugateD = id instance Element (Complex Float) where transdata = transdataAux ctransQ constantD = constantAux cconstantQ --- conjugateD = conjugateQ instance Element (Complex Double) where transdata = transdataAux ctransC constantD = constantAux cconstantC --- conjugateD = conjugateC ------------------------------------------------------------------- diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 1fa8903..50a321d 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs @@ -7,7 +7,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Data.Packed.Matrix --- Copyright : (c) Alberto Ruiz 2007 +-- Copyright : (c) Alberto Ruiz 2007-10 -- License : GPL-style -- -- Maintainer : Alberto Ruiz @@ -16,11 +16,14 @@ -- -- A Matrix representation suitable for numerical computations using LAPACK and GSL. -- +-- This module provides basic functions for manipulation of structure. + ----------------------------------------------------------------------------- module Data.Packed.Matrix ( + Matrix, Element, - Matrix,rows,cols, + rows,cols, (><), trans, reshape, flatten, diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 2e0a9f5..eaf4b9c 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs @@ -11,6 +11,8 @@ -- -- 1D arrays suitable for numeric computations using external libraries. -- +-- This module provides basic functions for manipulation of structure. +-- ----------------------------------------------------------------------------- module Data.Packed.Vector ( -- cgit v1.2.3