diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-09-04 11:48:33 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-09-04 11:48:33 +0000 |
commit | badf588ae2940df6f4ce144f31e90e8973f144a4 (patch) | |
tree | 0d82b431823c51daf285213e3aeb0190d90db02b /lib/Numeric/LinearAlgebra/Algorithms.hs | |
parent | 7aa4500e6c71964094374d553faad1b1754cbc65 (diff) |
unit tests for norms
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Algorithms.hs')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index 28063a9..7d2f84d 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -639,47 +639,47 @@ instance Normed (Vector Double) where | |||
639 | pnorm PNorm1 = norm1 | 639 | pnorm PNorm1 = norm1 |
640 | pnorm PNorm2 = norm2 | 640 | pnorm PNorm2 = norm2 |
641 | pnorm Infinity = normInf | 641 | pnorm Infinity = normInf |
642 | pnorm Frobenius = normInf | 642 | pnorm Frobenius = norm2 |
643 | 643 | ||
644 | instance Normed (Vector (Complex Double)) where | 644 | instance Normed (Vector (Complex Double)) where |
645 | pnorm PNorm1 = realPart . norm1 | 645 | pnorm PNorm1 = realPart . norm1 |
646 | pnorm PNorm2 = realPart . norm2 | 646 | pnorm PNorm2 = realPart . norm2 |
647 | pnorm Infinity = realPart . normInf | 647 | pnorm Infinity = realPart . normInf |
648 | pnorm Frobenius = realPart . normInf | 648 | pnorm Frobenius = pnorm PNorm2 |
649 | 649 | ||
650 | instance Normed (Vector Float) where | 650 | instance Normed (Vector Float) where |
651 | pnorm PNorm1 = realToFrac . norm1 | 651 | pnorm PNorm1 = realToFrac . norm1 |
652 | pnorm PNorm2 = realToFrac . norm2 | 652 | pnorm PNorm2 = realToFrac . norm2 |
653 | pnorm Infinity = realToFrac . normInf | 653 | pnorm Infinity = realToFrac . normInf |
654 | pnorm Frobenius = realToFrac . normInf | 654 | pnorm Frobenius = pnorm PNorm2 |
655 | 655 | ||
656 | instance Normed (Vector (Complex Float)) where | 656 | instance Normed (Vector (Complex Float)) where |
657 | pnorm PNorm1 = realToFrac . realPart . norm1 | 657 | pnorm PNorm1 = realToFrac . realPart . norm1 |
658 | pnorm PNorm2 = realToFrac . realPart . norm2 | 658 | pnorm PNorm2 = realToFrac . realPart . norm2 |
659 | pnorm Infinity = realToFrac . realPart . normInf | 659 | pnorm Infinity = realToFrac . realPart . normInf |
660 | pnorm Frobenius = realToFrac . realPart . normInf | 660 | pnorm Frobenius = pnorm PNorm2 |
661 | 661 | ||
662 | 662 | ||
663 | instance Normed (Matrix Double) where | 663 | instance Normed (Matrix Double) where |
664 | pnorm PNorm1 = maximum . map norm1 . toColumns | 664 | pnorm PNorm1 = maximum . map (pnorm PNorm1) . toColumns |
665 | pnorm PNorm2 = (@>0) . singularValues | 665 | pnorm PNorm2 = (@>0) . singularValues |
666 | pnorm Infinity = pnorm PNorm1 . trans | 666 | pnorm Infinity = pnorm PNorm1 . trans |
667 | pnorm Frobenius = norm2 . flatten | 667 | pnorm Frobenius = pnorm PNorm2 . flatten |
668 | 668 | ||
669 | instance Normed (Matrix (Complex Double)) where | 669 | instance Normed (Matrix (Complex Double)) where |
670 | pnorm PNorm1 = maximum . map (realPart.norm1) . toColumns | 670 | pnorm PNorm1 = maximum . map (pnorm PNorm1) . toColumns |
671 | pnorm PNorm2 = (@>0) . singularValues | 671 | pnorm PNorm2 = (@>0) . singularValues |
672 | pnorm Infinity = pnorm PNorm1 . trans | 672 | pnorm Infinity = pnorm PNorm1 . trans |
673 | pnorm Frobenius = realPart . norm2 . flatten | 673 | pnorm Frobenius = pnorm PNorm2 . flatten |
674 | 674 | ||
675 | instance Normed (Matrix Float) where | 675 | instance Normed (Matrix Float) where |
676 | pnorm PNorm1 = realToFrac . maximum . map norm1 . toColumns | 676 | pnorm PNorm1 = maximum . map (pnorm PNorm1) . toColumns |
677 | pnorm PNorm2 = realToFrac . (@>0) . singularValues . double | 677 | pnorm PNorm2 = (@>0) . singularValues . double |
678 | pnorm Infinity = realToFrac . pnorm PNorm1 . trans | 678 | pnorm Infinity = pnorm PNorm1 . trans |
679 | pnorm Frobenius = realToFrac . norm2 . flatten | 679 | pnorm Frobenius = pnorm PNorm2 . flatten |
680 | 680 | ||
681 | instance Normed (Matrix (Complex Float)) where | 681 | instance Normed (Matrix (Complex Float)) where |
682 | pnorm PNorm1 = realToFrac . maximum . map (realPart.norm1) . toColumns | 682 | pnorm PNorm1 = maximum . map (pnorm PNorm1) . toColumns |
683 | pnorm PNorm2 = realToFrac . (@>0) . singularValues . double | 683 | pnorm PNorm2 = (@>0) . singularValues . double |
684 | pnorm Infinity = realToFrac . pnorm PNorm1 . trans | 684 | pnorm Infinity = pnorm PNorm1 . trans |
685 | pnorm Frobenius = realToFrac . realPart . norm2 . flatten | 685 | pnorm Frobenius = pnorm PNorm2 . flatten |