summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Vector.hs
blob: 9818d58575b799efad9e93ee32230c96234379d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-----------------------------------------------------------------------------
-- |
-- Module      :  Data.Packed.Vector
-- Copyright   :  (c) Alberto Ruiz 2007
-- License     :  GPL-style
--
-- Maintainer  :  Alberto Ruiz <aruiz@um.es>
-- Stability   :  provisional
-- Portability :  portable
--
-- Vectors
--
-----------------------------------------------------------------------------

module Data.Packed.Vector (
    Vector,
    fromList, (|>), toList,
    dim, (@>),
    subVector, join,
    constant, linspace,

    liftVector, liftVector2
) where

import Data.Packed.Internal
import Complex

{- | Creates a real vector containing a range of values:

@\> linspace 5 (-3,7)
5 |> [-3.0,-0.5,2.0,4.5,7.0]@
-}
linspace :: Int -> (Double, Double) -> Vector Double
linspace n (a,b) = fromList [a, a+delta .. b]
    where delta = (b-a)/(fromIntegral n -1)