diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-07-18 07:31:41 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-07-18 07:31:41 +0000 |
commit | 9d21bf7a1516d8e6a57198ce71c2cc11a8e0520b (patch) | |
tree | b2feed462cc18bb9b81efc7bc6e9f56347411cb2 /lib/GSL/Compat.hs | |
parent | 04c76641caa9e1184fe504c584ddeb5420e994d6 (diff) |
easyVision compiles ok
Diffstat (limited to 'lib/GSL/Compat.hs')
-rw-r--r-- | lib/GSL/Compat.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/GSL/Compat.hs b/lib/GSL/Compat.hs index 2cae0c4..560a7d8 100644 --- a/lib/GSL/Compat.hs +++ b/lib/GSL/Compat.hs | |||
@@ -16,7 +16,7 @@ Creates reasonable numeric instances for Vectors and Matrices. In the context of | |||
16 | 16 | ||
17 | module GSL.Compat( | 17 | module GSL.Compat( |
18 | Mul,(<>), readMatrix, size, dispR, dispC, format, gmap, Joinable, (<|>),(<->), GSL.Compat.constant, | 18 | Mul,(<>), readMatrix, size, dispR, dispC, format, gmap, Joinable, (<|>),(<->), GSL.Compat.constant, |
19 | vectorMax, vectorMin, fromArray2D, fromComplex, GSL.Compat.pnorm, scale | 19 | vectorMax, vectorMin, vectorMaxIndex, vectorMinIndex, fromArray2D, fromComplex, GSL.Compat.pnorm, scale |
20 | ) where | 20 | ) where |
21 | 21 | ||
22 | import Data.Packed.Internal hiding (dsp) | 22 | import Data.Packed.Internal hiding (dsp) |
@@ -435,10 +435,19 @@ a <-> b = joinV a b | |||
435 | 435 | ||
436 | ---------------------------------------------------------- | 436 | ---------------------------------------------------------- |
437 | 437 | ||
438 | vectorMax :: Vector Double -> Double | ||
438 | vectorMax = toScalarR Max | 439 | vectorMax = toScalarR Max |
439 | 440 | ||
441 | vectorMin :: Vector Double -> Double | ||
440 | vectorMin = toScalarR Min | 442 | vectorMin = toScalarR Min |
441 | 443 | ||
444 | vectorMaxIndex :: Vector Double -> Int | ||
445 | vectorMaxIndex = round . toScalarR MaxIdx | ||
446 | |||
447 | vectorMinIndex :: Vector Double -> Int | ||
448 | vectorMinIndex = round . toScalarR MinIdx | ||
449 | |||
450 | fromArray2D :: (Field e) => Array (Int, Int) e -> Matrix e | ||
442 | fromArray2D m = (r><c) (elems m) | 451 | fromArray2D m = (r><c) (elems m) |
443 | where ((r0,c0),(r1,c1)) = bounds m | 452 | where ((r0,c0),(r1,c1)) = bounds m |
444 | r = r1-r0+1 | 453 | r = r1-r0+1 |
@@ -462,8 +471,11 @@ fromComplexM m = (reshape c a, reshape c b) | |||
462 | where c = cols m | 471 | where c = cols m |
463 | [a,b] = toColumns $ reshape 2 $ asReal $ flatten m | 472 | [a,b] = toColumns $ reshape 2 $ asReal $ flatten m |
464 | 473 | ||
474 | fromComplex :: Matrix (Complex Double) -> (Matrix Double, Matrix Double) | ||
465 | fromComplex = fromComplexM | 475 | fromComplex = fromComplexM |
466 | 476 | ||
477 | |||
478 | pnorm :: (Normed t1, Num t) => t -> t1 -> Double | ||
467 | pnorm 0 = LinearAlgebra.Algorithms.pnorm Infinity | 479 | pnorm 0 = LinearAlgebra.Algorithms.pnorm Infinity |
468 | pnorm 1 = LinearAlgebra.Algorithms.pnorm PNorm1 | 480 | pnorm 1 = LinearAlgebra.Algorithms.pnorm PNorm1 |
469 | pnorm 2 = LinearAlgebra.Algorithms.pnorm PNorm2 \ No newline at end of file | 481 | pnorm 2 = LinearAlgebra.Algorithms.pnorm PNorm2 \ No newline at end of file |