diff --git a/Data/Packed/Static/Matrix.hs b/Data/Packed/Static/Matrix.hs
--- a/Data/Packed/Static/Matrix.hs
+++ b/Data/Packed/Static/Matrix.hs
@@ -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
diff --git a/Data/Packed/Static/Vector.hs b/Data/Packed/Static/Vector.hs
--- a/Data/Packed/Static/Vector.hs
+++ b/Data/Packed/Static/Vector.hs
@@ -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.
diff --git a/hmatrix-static.cabal b/hmatrix-static.cabal
--- a/hmatrix-static.cabal
+++ b/hmatrix-static.cabal
@@ -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
