diff options
Diffstat (limited to 'lib/Numeric/GSL/Vector.hs')
-rw-r--r-- | lib/Numeric/GSL/Vector.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index d94b377..65f3a2e 100644 --- a/lib/Numeric/GSL/Vector.hs +++ b/lib/Numeric/GSL/Vector.hs | |||
@@ -73,24 +73,28 @@ data FunCodeS = Norm2 | |||
73 | 73 | ||
74 | toScalarAux fun code v = unsafePerformIO $ do | 74 | toScalarAux fun code v = unsafePerformIO $ do |
75 | r <- createVector 1 | 75 | r <- createVector 1 |
76 | fun (fromEnum code) // vec v // vec r // check "toScalarAux" [v] | 76 | ww2 withVector v withVector r $ \v r -> |
77 | fun (fromEnum code) // v // r // check "toScalarAux" | ||
77 | return (r `at` 0) | 78 | return (r `at` 0) |
78 | 79 | ||
79 | vectorMapAux fun code v = unsafePerformIO $ do | 80 | vectorMapAux fun code v = unsafePerformIO $ do |
80 | r <- createVector (dim v) | 81 | r <- createVector (dim v) |
81 | fun (fromEnum code) // vec v // vec r // check "vectorMapAux" [v] | 82 | ww2 withVector v withVector r $ \v r -> |
83 | fun (fromEnum code) // v // r // check "vectorMapAux" | ||
82 | return r | 84 | return r |
83 | 85 | ||
84 | vectorMapValAux fun code val v = unsafePerformIO $ do | 86 | vectorMapValAux fun code val v = unsafePerformIO $ do |
85 | r <- createVector (dim v) | 87 | r <- createVector (dim v) |
86 | pval <- newArray [val] | 88 | pval <- newArray [val] |
87 | fun (fromEnum code) pval // vec v // vec r // check "vectorMapValAux" [v] | 89 | ww2 withVector v withVector r $ \v r -> |
90 | fun (fromEnum code) pval // v // r // check "vectorMapValAux" | ||
88 | free pval | 91 | free pval |
89 | return r | 92 | return r |
90 | 93 | ||
91 | vectorZipAux fun code u v = unsafePerformIO $ do | 94 | vectorZipAux fun code u v = unsafePerformIO $ do |
92 | r <- createVector (dim u) | 95 | r <- createVector (dim u) |
93 | fun (fromEnum code) // vec u // vec v // vec r // check "vectorZipAux" [u,v] | 96 | ww3 withVector u withVector v withVector r $ \u v r -> |
97 | fun (fromEnum code) // u // v // r // check "vectorZipAux" | ||
94 | return r | 98 | return r |
95 | 99 | ||
96 | --------------------------------------------------------------------- | 100 | --------------------------------------------------------------------- |