packages feed

hmatrix-static 0.2 → 0.3

raw patch · 3 files changed

+27/−2 lines, 3 filesdep ~hmatrixPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hmatrix

API changes (from Hackage documentation)

+ Data.Packed.Static.Matrix: buildMatrix :: (PositiveT m, PositiveT n, Element a) => ((Int, Int) -> a) -> Matrix (m, n) a
+ Data.Packed.Static.Vector: buildVector :: (PositiveT n, Element a) => (Int -> a) -> Vector n a

Files

Data/Packed/Static/Matrix.hs view
@@ -24,6 +24,8 @@   withRows,   withCols,   withSquare,+  -- * By-index construction+  buildMatrix,   -- * To/from lists   (><),   matFromList,@@ -137,6 +139,17 @@ withSquare :: forall n t. PositiveT n => (Int -> Matrix (n,n) t) -> Matrix (n,n) t withSquare = ($ n) where     n = fromIntegerT (undefined :: n)++--------- by-index construction+{- | Constructs a matrix using the function from row\/column index. The first of the pair is the row; the second is the column. Indexing is 0-based.++@\> buildMatrix (fromIntegral . uncurry (^)) \`atShape\` (d3,d4)+[$mat| 1.0, 0.0, 0.0, 0.0;+       1.0, 1.0, 1.0, 1.0;+       1.0, 2.0, 4.0, 8.0 |]@+-}+buildMatrix :: (PositiveT m, PositiveT n, Element a) => ((Int, Int) -> a) -> Matrix (m,n) a+buildMatrix f = withShape (\m n -> Matrix (H.buildMatrix m n f))  --------- to/from lists {- | Constructs a matrix from a list. The size
Data/Packed/Static/Vector.hs view
@@ -19,6 +19,8 @@    refineVec,    atDim,    atShape,+   -- * Construction by index+   buildVector,    -- * To/from lists    fromListU,    toList,@@ -77,6 +79,16 @@ atDim :: (forall n. PositiveT n => Vector n t) -> Int -> Vector Unknown t atDim v n | n > 0     = fromJust $ reifyPositiveD (toInteger n) (\n -> forgetShapeU $ v `atShape` n)           | otherwise = error $ "atDim: negative vector length: " ++ show n++------- By-index construction+{- | Builds a vector given a function from indices. Indexing is 0-based.++@\> buildVector fromIntegral \`atShape\` d5+[$vec| 0.0, 1.0, 2.0, 3.0, 4.0 |]@+-}+buildVector :: (PositiveT n, Element a) => (Int -> a) -> Vector n a+buildVector f = withDim (\len -> Vector $ H.buildVector len f)+  -------- To / from lists {- | Constructs a vector from all the elements of a list.
hmatrix-static.cabal view
@@ -1,5 +1,5 @@ Name:          hmatrix-static-Version:       0.2+Version:       0.3 Synopsis:      hmatrix with vector and matrix sizes encoded in types License:       GPL License-file:  LICENSE@@ -49,5 +49,5 @@        Rank2Types, TypeFamilies, TypeOperators,        EmptyDataDecls, TemplateHaskell -  Build-Depends: base==4.*, hmatrix>=0.5&&<0.7, tfp==0.2.*, array==0.2.*, +  Build-Depends: base==4.*, hmatrix==0.7.*, tfp==0.2.*, array==0.2.*,                   haskell-src-meta>=0.0.3.1&&<0.0.7, parsec==3.*, template-haskell