summaryrefslogtreecommitdiff
path: root/lib/Numeric/ContainerBoot.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2011-12-22 17:26:09 +0100
committerAlberto Ruiz <aruiz@um.es>2011-12-22 17:26:09 +0100
commitd7b7ff9dff27a6a74785c92c9393704fe0072e0e (patch)
treeeb47835d7629f68ab700eec1f8ee7399ba4c06ad /lib/Numeric/ContainerBoot.hs
parent49219343d035992c2942a309a1d5594f4f96a8b1 (diff)
ok hmatrix, hmatrix-tests, hmatrix-glpk
Diffstat (limited to 'lib/Numeric/ContainerBoot.hs')
-rw-r--r--lib/Numeric/ContainerBoot.hs89
1 files changed, 3 insertions, 86 deletions
diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs
index a605545..d913435 100644
--- a/lib/Numeric/ContainerBoot.hs
+++ b/lib/Numeric/ContainerBoot.hs
@@ -3,6 +3,7 @@
3{-# LANGUAGE FlexibleInstances #-} 3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE MultiParamTypeClasses #-} 4{-# LANGUAGE MultiParamTypeClasses #-}
5{-# LANGUAGE UndecidableInstances #-} 5{-# LANGUAGE UndecidableInstances #-}
6{-# LANGUAGE PolyKinds #-}
6 7
7----------------------------------------------------------------------------- 8-----------------------------------------------------------------------------
8-- | 9-- |
@@ -37,11 +38,7 @@ module Numeric.ContainerBoot (
37 IndexOf, 38 IndexOf,
38 module Data.Complex, 39 module Data.Complex,
39 -- * Experimental 40 -- * Experimental
40 build', konst', 41 build', konst'
41 -- * Deprecated
42 (.*),(*/),(<|>),(<->),
43 vectorMax,vectorMin,
44 vectorMaxIndex, vectorMinIndex
45) where 42) where
46 43
47import Data.Packed 44import Data.Packed
@@ -49,7 +46,7 @@ import Data.Packed.ST as ST
49import Numeric.Conversion 46import Numeric.Conversion
50import Data.Packed.Internal 47import Data.Packed.Internal
51import Numeric.GSL.Vector 48import Numeric.GSL.Vector
52 49import Foreign.C.Types(CInt(..))
53import Data.Complex 50import Data.Complex
54import Control.Monad(ap) 51import Control.Monad(ap)
55 52
@@ -526,86 +523,6 @@ conjugateC :: Vector (Complex Double) -> Vector (Complex Double)
526conjugateC = conjugateAux c_conjugateC 523conjugateC = conjugateAux c_conjugateC
527foreign import ccall "conjugateC" c_conjugateC :: TCVCV 524foreign import ccall "conjugateC" c_conjugateC :: TCVCV
528 525
529----------------------------------------------------
530
531{-# DEPRECATED (.*) "use scale a x or scalar a * x" #-}
532
533-- -- | @x .* a = scale x a@
534-- (.*) :: (Linear c a) => a -> c a -> c a
535infixl 7 .*
536a .* x = scale a x
537
538----------------------------------------------------
539
540{-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-}
541
542-- -- | @a *\/ x = scale (recip x) a@
543-- (*/) :: (Linear c a) => c a -> a -> c a
544infixl 7 */
545v */ x = scale (recip x) v
546
547
548------------------------------------------------
549
550{-# DEPRECATED (<|>) "define operator a & b = fromBlocks[[a,b]] and use asRow/asColumn to join vectors" #-}
551{-# DEPRECATED (<->) "define operator a // b = fromBlocks[[a],[b]] and use asRow/asColumn to join vectors" #-}
552
553class Joinable a b where
554 joinH :: Element t => a t -> b t -> Matrix t
555 joinV :: Element t => a t -> b t -> Matrix t
556
557instance Joinable Matrix Matrix where
558 joinH m1 m2 = fromBlocks [[m1,m2]]
559 joinV m1 m2 = fromBlocks [[m1],[m2]]
560
561instance Joinable Matrix Vector where
562 joinH m v = joinH m (asColumn v)
563 joinV m v = joinV m (asRow v)
564
565instance Joinable Vector Matrix where
566 joinH v m = joinH (asColumn v) m
567 joinV v m = joinV (asRow v) m
568
569infixl 4 <|>
570infixl 3 <->
571
572{-- - | Horizontal concatenation of matrices and vectors:
573
574@> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0]
575(6><4)
576 [ 1.0, 0.0, 0.0, 1.0
577 , 0.0, 1.0, 0.0, 2.0
578 , 0.0, 0.0, 1.0, 3.0
579 , 3.0, 0.0, 0.0, 4.0
580 , 0.0, 3.0, 0.0, 5.0
581 , 0.0, 0.0, 3.0, 6.0 ]@
582-}
583-- (<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
584a <|> b = joinH a b
585
586-- -- | Vertical concatenation of matrices and vectors.
587-- (<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
588a <-> b = joinV a b
589
590-------------------------------------------------------------------
591
592{-# DEPRECATED vectorMin "use minElement" #-}
593vectorMin :: (Container Vector t, Element t) => Vector t -> t
594vectorMin = minElement
595
596{-# DEPRECATED vectorMax "use maxElement" #-}
597vectorMax :: (Container Vector t, Element t) => Vector t -> t
598vectorMax = maxElement
599
600
601{-# DEPRECATED vectorMaxIndex "use minIndex" #-}
602vectorMaxIndex :: Vector Double -> Int
603vectorMaxIndex = round . toScalarR MaxIdx
604
605{-# DEPRECATED vectorMinIndex "use maxIndex" #-}
606vectorMinIndex :: Vector Double -> Int
607vectorMinIndex = round . toScalarR MinIdx
608
609----------------------------------------------------- 526-----------------------------------------------------
610 527
611class Build f where 528class Build f where