summaryrefslogtreecommitdiff
path: root/lib/Numeric/ContainerBoot.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/ContainerBoot.hs')
-rw-r--r--lib/Numeric/ContainerBoot.hs108
1 files changed, 1 insertions, 107 deletions
diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs
index 0215711..d50dd36 100644
--- a/lib/Numeric/ContainerBoot.hs
+++ b/lib/Numeric/ContainerBoot.hs
@@ -38,11 +38,7 @@ module Numeric.ContainerBoot (
38 IndexOf, 38 IndexOf,
39 module Data.Complex, 39 module Data.Complex,
40 -- * Experimental 40 -- * Experimental
41 build', konst', 41 build', konst'
42 -- * Deprecated
43 (.*),(*/),(<|>),(<->),
44 vectorMax,vectorMin,
45 vectorMaxIndex, vectorMinIndex
46) where 42) where
47 43
48import Data.Packed 44import Data.Packed
@@ -50,18 +46,11 @@ import Data.Packed.ST as ST
50import Numeric.Conversion 46import Numeric.Conversion
51import Data.Packed.Internal 47import Data.Packed.Internal
52import Numeric.GSL.Vector 48import Numeric.GSL.Vector
53
54#if __GLASGOW_HASKELL__ >= 704
55import Foreign.C.Types(CInt(..))
56#endif
57
58import Data.Complex 49import Data.Complex
59import Control.Monad(ap) 50import Control.Monad(ap)
60 51
61import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ) 52import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ)
62 53
63import System.IO.Unsafe
64
65------------------------------------------------------------------- 54-------------------------------------------------------------------
66 55
67type family IndexOf (c :: * -> *) 56type family IndexOf (c :: * -> *)
@@ -518,101 +507,6 @@ type instance ElementOf (Matrix a) = a
518 507
519------------------------------------------------------------ 508------------------------------------------------------------
520 509
521conjugateAux fun x = unsafePerformIO $ do
522 v <- createVector (dim x)
523 app2 fun vec x vec v "conjugateAux"
524 return v
525
526conjugateQ :: Vector (Complex Float) -> Vector (Complex Float)
527conjugateQ = conjugateAux c_conjugateQ
528foreign import ccall "conjugateQ" c_conjugateQ :: TQVQV
529
530conjugateC :: Vector (Complex Double) -> Vector (Complex Double)
531conjugateC = conjugateAux c_conjugateC
532foreign import ccall "conjugateC" c_conjugateC :: TCVCV
533
534----------------------------------------------------
535
536{-# DEPRECATED (.*) "use scale a x or scalar a * x" #-}
537
538-- -- | @x .* a = scale x a@
539-- (.*) :: (Linear c a) => a -> c a -> c a
540infixl 7 .*
541a .* x = scale a x
542
543----------------------------------------------------
544
545{-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-}
546
547-- -- | @a *\/ x = scale (recip x) a@
548-- (*/) :: (Linear c a) => c a -> a -> c a
549infixl 7 */
550v */ x = scale (recip x) v
551
552
553------------------------------------------------
554
555{-# DEPRECATED (<|>) "define operator a & b = fromBlocks[[a,b]] and use asRow/asColumn to join vectors" #-}
556{-# DEPRECATED (<->) "define operator a // b = fromBlocks[[a],[b]] and use asRow/asColumn to join vectors" #-}
557
558class Joinable a b where
559 joinH :: Element t => a t -> b t -> Matrix t
560 joinV :: Element t => a t -> b t -> Matrix t
561
562instance Joinable Matrix Matrix where
563 joinH m1 m2 = fromBlocks [[m1,m2]]
564 joinV m1 m2 = fromBlocks [[m1],[m2]]
565
566instance Joinable Matrix Vector where
567 joinH m v = joinH m (asColumn v)
568 joinV m v = joinV m (asRow v)
569
570instance Joinable Vector Matrix where
571 joinH v m = joinH (asColumn v) m
572 joinV v m = joinV (asRow v) m
573
574infixl 4 <|>
575infixl 3 <->
576
577{-- - | Horizontal concatenation of matrices and vectors:
578
579@> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0]
580(6><4)
581 [ 1.0, 0.0, 0.0, 1.0
582 , 0.0, 1.0, 0.0, 2.0
583 , 0.0, 0.0, 1.0, 3.0
584 , 3.0, 0.0, 0.0, 4.0
585 , 0.0, 3.0, 0.0, 5.0
586 , 0.0, 0.0, 3.0, 6.0 ]@
587-}
588-- (<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
589a <|> b = joinH a b
590
591-- -- | Vertical concatenation of matrices and vectors.
592-- (<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
593a <-> b = joinV a b
594
595-------------------------------------------------------------------
596
597{-# DEPRECATED vectorMin "use minElement" #-}
598vectorMin :: (Container Vector t, Element t) => Vector t -> t
599vectorMin = minElement
600
601{-# DEPRECATED vectorMax "use maxElement" #-}
602vectorMax :: (Container Vector t, Element t) => Vector t -> t
603vectorMax = maxElement
604
605
606{-# DEPRECATED vectorMaxIndex "use minIndex" #-}
607vectorMaxIndex :: Vector Double -> Int
608vectorMaxIndex = round . toScalarR MaxIdx
609
610{-# DEPRECATED vectorMinIndex "use maxIndex" #-}
611vectorMinIndex :: Vector Double -> Int
612vectorMinIndex = round . toScalarR MinIdx
613
614-----------------------------------------------------
615
616class Build f where 510class Build f where
617 build' :: BoundsOf f -> f -> ContainerOf f 511 build' :: BoundsOf f -> f -> ContainerOf f
618 512