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.hs62
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs
index 8707473..d61633e 100644
--- a/lib/Numeric/ContainerBoot.hs
+++ b/lib/Numeric/ContainerBoot.hs
@@ -502,47 +502,6 @@ type instance ElementOf (Vector a) = a
502type instance ElementOf (Matrix a) = a 502type instance ElementOf (Matrix a) = a
503 503
504------------------------------------------------------------ 504------------------------------------------------------------
505{-
506class Build f where
507 build' :: BoundsOf f -> f -> ContainerOf f
508
509
510#if MIN_VERSION_base(4,7,0)
511-- ghc >= 7.7 considers:
512--
513-- > a -> a
514-- > b -> b -> b
515--
516-- to overlap
517type family BoundsOf x where
518 BoundsOf (a -> a) = Int
519 BoundsOf (a->a->a) = (Int,Int)
520type family ContainerOf x where
521 ContainerOf (a->a) = Vector a
522 ContainerOf (a->a->a) = Matrix a
523#else
524type family BoundsOf x
525type family ContainerOf x
526type instance BoundsOf (a->a) = Int
527type instance BoundsOf (a->a->a) = (Int,Int)
528type instance ContainerOf (a->a) = Vector a
529type instance ContainerOf (a->a->a) = Matrix a
530#endif
531
532
533instance (Element a, Num a) => Build (a->a) where
534 build' = buildV
535
536instance (Element a,
537#if MIN_VERSION_base(4,7,0)
538 BoundsOf (a -> a -> a) ~ (Int,Int),
539 ContainerOf (a -> a -> a) ~ Matrix a,
540#endif
541 Num a)
542 => Build (a->a->a) where
543 build' = buildM
544
545-}
546 505
547buildM (rc,cc) f = fromLists [ [f r c | c <- cs] | r <- rs ] 506buildM (rc,cc) f = fromLists [ [f r c | c <- cs] | r <- rs ]
548 where rs = map fromIntegral [0 .. (rc-1)] 507 where rs = map fromIntegral [0 .. (rc-1)]
@@ -551,27 +510,6 @@ buildM (rc,cc) f = fromLists [ [f r c | c <- cs] | r <- rs ]
551buildV n f = fromList [f k | k <- ks] 510buildV n f = fromList [f k | k <- ks]
552 where ks = map fromIntegral [0 .. (n-1)] 511 where ks = map fromIntegral [0 .. (n-1)]
553 512
554{-
555
556----------------------------------------------------
557-- experimental
558
559class Konst s where
560 konst' :: Element e => e -> s -> ContainerOf' s e
561
562type family ContainerOf' x y
563
564type instance ContainerOf' Int a = Vector a
565type instance ContainerOf' (Int,Int) a = Matrix a
566
567instance Konst Int where
568 konst' = constantD
569
570instance Konst (Int,Int) where
571 konst' k (r,c) = reshape c $ konst' k (r*c)
572
573-}
574
575-------------------------------------------------------- 513--------------------------------------------------------
576-- | conjugate transpose 514-- | conjugate transpose
577ctrans :: (Container Vector e, Element e) => Matrix e -> Matrix e 515ctrans :: (Container Vector e, Element e) => Matrix e -> Matrix e