summaryrefslogtreecommitdiff
path: root/packages/base
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-05-25 08:46:59 +0200
committerAlberto Ruiz <aruiz@um.es>2015-05-25 08:46:59 +0200
commit11095a22c59bed6a011723641dfb782415e2c02b (patch)
treefde840b71f395077b274a15ae3e0e3935d06818c /packages/base
parent88a39a5d1bdf7799a2e1f38d420f4392bb9c35bc (diff)
range
Diffstat (limited to 'packages/base')
-rw-r--r--packages/base/src/C/vector-aux.c8
-rw-r--r--packages/base/src/Data/Packed/Internal/Numeric.hs2
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Data.hs4
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Static.hs2
-rw-r--r--packages/base/src/Numeric/Vectorized.hs13
5 files changed, 24 insertions, 5 deletions
diff --git a/packages/base/src/C/vector-aux.c b/packages/base/src/C/vector-aux.c
index b67275f..134ca7a 100644
--- a/packages/base/src/C/vector-aux.c
+++ b/packages/base/src/C/vector-aux.c
@@ -1040,3 +1040,11 @@ int div_vector(int m, KIVEC(v), IVEC(r)) {
1040 OK 1040 OK
1041} 1041}
1042 1042
1043int range_vector(IVEC(r)) {
1044 int k;
1045 for(k=0; k<rn; k++) {
1046 rp[k] = k;
1047 }
1048 OK
1049}
1050
diff --git a/packages/base/src/Data/Packed/Internal/Numeric.hs b/packages/base/src/Data/Packed/Internal/Numeric.hs
index fec8c05..60dd167 100644
--- a/packages/base/src/Data/Packed/Internal/Numeric.hs
+++ b/packages/base/src/Data/Packed/Internal/Numeric.hs
@@ -39,7 +39,7 @@ module Data.Packed.Internal.Numeric (
39 roundVector, fromInt, 39 roundVector, fromInt,
40 RealOf, ComplexOf, SingleOf, DoubleOf, 40 RealOf, ComplexOf, SingleOf, DoubleOf,
41 IndexOf, 41 IndexOf,
42 CInt, Extractor(..), (??), 42 CInt, Extractor(..), (??), range,
43 module Data.Complex 43 module Data.Complex
44) where 44) where
45 45
diff --git a/packages/base/src/Numeric/LinearAlgebra/Data.hs b/packages/base/src/Numeric/LinearAlgebra/Data.hs
index 7bc0497..b40054c 100644
--- a/packages/base/src/Numeric/LinearAlgebra/Data.hs
+++ b/packages/base/src/Numeric/LinearAlgebra/Data.hs
@@ -28,7 +28,7 @@ module Numeric.LinearAlgebra.Data(
28 Indexable(..), 28 Indexable(..),
29 29
30 -- * Construction 30 -- * Construction
31 scalar, Konst(..), Build(..), assoc, accum, linspace, -- ones, zeros, 31 scalar, Konst(..), Build(..), assoc, accum, linspace, range,-- ones, zeros,
32 32
33 -- * Diagonal 33 -- * Diagonal
34 ident, diag, diagl, diagRect, takeDiag, 34 ident, diag, diagl, diagRect, takeDiag,
@@ -82,6 +82,6 @@ import Numeric.LinearAlgebra.Util hiding ((&),(#))
82import Data.Complex 82import Data.Complex
83import Numeric.Sparse 83import Numeric.Sparse
84import Data.Packed.Internal.Vector(Idxs) 84import Data.Packed.Internal.Vector(Idxs)
85import Data.Packed.Internal.Numeric(CInt,Extractor(..),(??),fromInt) 85import Data.Packed.Internal.Numeric(CInt,Extractor(..),(??),fromInt,range)
86 86
87 87
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs
index 25b10b4..f7017e7 100644
--- a/packages/base/src/Numeric/LinearAlgebra/Static.hs
+++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs
@@ -65,7 +65,7 @@ import Numeric.LinearAlgebra hiding (
65 row,col,vector,matrix,linspace,toRows,toColumns, 65 row,col,vector,matrix,linspace,toRows,toColumns,
66 (<\>),fromList,takeDiag,svd,eig,eigSH,eigSH', 66 (<\>),fromList,takeDiag,svd,eig,eigSH,eigSH',
67 eigenvalues,eigenvaluesSH,eigenvaluesSH',build, 67 eigenvalues,eigenvaluesSH,eigenvaluesSH',build,
68 qr,size,app,mul,dot,chol) 68 qr,size,app,mul,dot,chol,range)
69import qualified Numeric.LinearAlgebra as LA 69import qualified Numeric.LinearAlgebra as LA
70import Data.Proxy(Proxy) 70import Data.Proxy(Proxy)
71import Numeric.LinearAlgebra.Static.Internal 71import Numeric.LinearAlgebra.Static.Internal
diff --git a/packages/base/src/Numeric/Vectorized.hs b/packages/base/src/Numeric/Vectorized.hs
index 70bd48b..d0ff562 100644
--- a/packages/base/src/Numeric/Vectorized.hs
+++ b/packages/base/src/Numeric/Vectorized.hs
@@ -19,7 +19,8 @@ module Numeric.Vectorized (
19 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ, vectorZipI, 19 FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, vectorZipQ, vectorZipI,
20 vectorScan, saveMatrix, 20 vectorScan, saveMatrix,
21 Seed, RandDist(..), randomVector, 21 Seed, RandDist(..), randomVector,
22 sortVector, roundVector 22 sortVector, roundVector,
23 range
23) where 24) where
24 25
25import Data.Packed.Internal.Common 26import Data.Packed.Internal.Common
@@ -389,3 +390,13 @@ roundVector v = unsafePerformIO $ do
389 390
390foreign import ccall unsafe "round_vector" c_round_vector :: TVV 391foreign import ccall unsafe "round_vector" c_round_vector :: TVV
391 392
393--------------------------------------------------------------------------------
394
395range :: Int -> Idxs
396range n = unsafePerformIO $ do
397 r <- createVector n
398 app1 c_range_vector vec r "range"
399 return r
400
401foreign import ccall unsafe "range_vector" c_range_vector :: CV CInt (IO CInt)
402