diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-09-23 08:04:33 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-09-23 08:04:33 +0000 |
commit | 778e63dcc2b348914a4f6975f5328ff7fd25638a (patch) | |
tree | f52df4d9e0ad86ab037cd6124e1cfed2b2454d0f /lib/Data/Packed/Matrix.hs | |
parent | 0c739613926ac44254a9de9ea81351a974805c45 (diff) |
experimental build, build', konst'
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index e046ead..1fa8903 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs | |||
@@ -252,13 +252,18 @@ asColumn v = reshape 1 v | |||
252 | 252 | ||
253 | 253 | ||
254 | {- | creates a Matrix of the specified size using the supplied function to | 254 | {- | creates a Matrix of the specified size using the supplied function to |
255 | to map the row/column position to the value at that row/column position. | 255 | to map the row\/column position to the value at that row\/column position. |
256 | 256 | ||
257 | @> buildMatrix 3 4 (\ (r,c) -> fromIntegral r * fromIntegral c) | 257 | @> buildMatrix 3 4 (\ (r,c) -> fromIntegral r * fromIntegral c) |
258 | (3><4) | 258 | (3><4) |
259 | [ 0.0, 0.0, 0.0, 0.0, 0.0 | 259 | [ 0.0, 0.0, 0.0, 0.0, 0.0 |
260 | , 0.0, 1.0, 2.0, 3.0, 4.0 | 260 | , 0.0, 1.0, 2.0, 3.0, 4.0 |
261 | , 0.0, 2.0, 4.0, 6.0, 8.0]@ | 261 | , 0.0, 2.0, 4.0, 6.0, 8.0]@ |
262 | |||
263 | Hilbert matrix of order N: | ||
264 | |||
265 | @hilb n = buildMatrix n n (\(i,j)->1/(fromIntegral i + fromIntegral j +1))@ | ||
266 | |||
262 | -} | 267 | -} |
263 | buildMatrix :: Element a => Int -> Int -> ((Int, Int) -> a) -> Matrix a | 268 | buildMatrix :: Element a => Int -> Int -> ((Int, Int) -> a) -> Matrix a |
264 | buildMatrix rc cc f = | 269 | buildMatrix rc cc f = |