tensor-ops-0.1.0.0: Tensor manipulation operations with tensorflow-style automatic differentiation

Safe HaskellNone
LanguageHaskell2010

TensorOps.BLAS

Synopsis

Documentation

data BShape a Source #

Constructors

BV !a 
BM !a !a 

Instances

Functor BShape Source # 

Methods

fmap :: (a -> b) -> BShape a -> BShape b #

(<$) :: a -> BShape b -> BShape a #

Eq a0 => Eq (BShape a0) Source # 

Methods

(==) :: BShape a0 -> BShape a0 -> Bool #

(/=) :: BShape a0 -> BShape a0 -> Bool #

Ord a0 => Ord (BShape a0) Source # 

Methods

compare :: BShape a0 -> BShape a0 -> Ordering #

(<) :: BShape a0 -> BShape a0 -> Bool #

(<=) :: BShape a0 -> BShape a0 -> Bool #

(>) :: BShape a0 -> BShape a0 -> Bool #

(>=) :: BShape a0 -> BShape a0 -> Bool #

max :: BShape a0 -> BShape a0 -> BShape a0 #

min :: BShape a0 -> BShape a0 -> BShape a0 #

Show a0 => Show (BShape a0) Source # 

Methods

showsPrec :: Int -> BShape a0 -> ShowS #

show :: BShape a0 -> String #

showList :: [BShape a0] -> ShowS #

SOrd a0 => SOrd (BShape a0) Source # 

Methods

sCompare :: Sing (BShape a0) t0 -> Sing (BShape a0) t1 -> Sing Ordering (Apply (BShape a0) Ordering (Apply (BShape a0) (TyFun (BShape a0) Ordering -> Type) (CompareSym0 (BShape a0)) t0) t1) #

(%:<) :: Sing (BShape a0) t0 -> Sing (BShape a0) t1 -> Sing Bool (Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) ((:<$) (BShape a0)) t0) t1) #

(%:<=) :: Sing (BShape a0) t0 -> Sing (BShape a0) t1 -> Sing Bool (Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) ((:<=$) (BShape a0)) t0) t1) #

(%:>) :: Sing (BShape a0) t0 -> Sing (BShape a0) t1 -> Sing Bool (Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) ((:>$) (BShape a0)) t0) t1) #

(%:>=) :: Sing (BShape a0) t0 -> Sing (BShape a0) t1 -> Sing Bool (Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) ((:>=$) (BShape a0)) t0) t1) #

sMax :: Sing (BShape a0) t0 -> Sing (BShape a0) t1 -> Sing (BShape a0) (Apply (BShape a0) (BShape a0) (Apply (BShape a0) (TyFun (BShape a0) (BShape a0) -> Type) (MaxSym0 (BShape a0)) t0) t1) #

sMin :: Sing (BShape a0) t0 -> Sing (BShape a0) t1 -> Sing (BShape a0) (Apply (BShape a0) (BShape a0) (Apply (BShape a0) (TyFun (BShape a0) (BShape a0) -> Type) (MinSym0 (BShape a0)) t0) t1) #

SEq a0 => SEq (BShape a0) Source # 

Methods

(%:==) :: Sing (BShape a0) a -> Sing (BShape a0) b -> Sing Bool ((BShape a0 :== a) b) #

(%:/=) :: Sing (BShape a0) a -> Sing (BShape a0) b -> Sing Bool ((BShape a0 :/= a) b) #

SDecide a0 => SDecide (BShape a0) Source # 

Methods

(%~) :: Sing (BShape a0) a -> Sing (BShape a0) b -> Decision ((BShape a0 :~: a) b) #

SingKind a0 => SingKind (BShape a0) Source # 

Associated Types

type DemoteRep (BShape a0) :: * #

Methods

fromSing :: Sing (BShape a0) a -> DemoteRep (BShape a0) #

toSing :: DemoteRep (BShape a0) -> SomeSing (BShape a0) #

(Storable a, Show a, Element a) => Show1 (BShape Nat) (HMat a) # 

Methods

showsPrec1 :: Int -> f a -> ShowS #

show1 :: f a -> String #

(Storable a, NFData a) => NFData1 (BShape Nat) (HMat a) Source # 

Methods

rnf1 :: f a -> () Source #

POrd (BShape a0) (Proxy * (BShape a0)) Source # 

Associated Types

type Compare (Proxy * (BShape a0)) (arg0 :: Proxy * (BShape a0)) (arg1 :: Proxy * (BShape a0)) :: Ordering #

type ((Proxy * (BShape a0)) :< (arg0 :: Proxy * (BShape a0))) (arg1 :: Proxy * (BShape a0)) :: Bool #

type ((Proxy * (BShape a0)) :<= (arg0 :: Proxy * (BShape a0))) (arg1 :: Proxy * (BShape a0)) :: Bool #

type ((Proxy * (BShape a0)) :> (arg0 :: Proxy * (BShape a0))) (arg1 :: Proxy * (BShape a0)) :: Bool #

type ((Proxy * (BShape a0)) :>= (arg0 :: Proxy * (BShape a0))) (arg1 :: Proxy * (BShape a0)) :: Bool #

type Max (Proxy * (BShape a0)) (arg0 :: Proxy * (BShape a0)) (arg1 :: Proxy * (BShape a0)) :: a0 #

type Min (Proxy * (BShape a0)) (arg0 :: Proxy * (BShape a0)) (arg1 :: Proxy * (BShape a0)) :: a0 #

PEq (BShape k0) (Proxy * (BShape k0)) Source # 

Associated Types

type ((Proxy * (BShape k0)) :== (x :: Proxy * (BShape k0))) (y :: Proxy * (BShape k0)) :: Bool #

type ((Proxy * (BShape k0)) :/= (x :: Proxy * (BShape k0))) (y :: Proxy * (BShape k0)) :: Bool #

SingI a0 n0 => SingI (BShape a0) (BV a0 n0) Source # 

Methods

sing :: Sing (BV a0 n0) a #

(SingI a0 n0, SingI a0 n1) => SingI (BShape a0) (BM a0 n0 n1) Source # 

Methods

sing :: Sing (BM a0 n0 n1) a #

data Sing (BShape a0) Source # 
data Sing (BShape a0) where
type DemoteRep (BShape a0) Source # 
type DemoteRep (BShape a0) = BShape (DemoteRep a0)
type Min (BShape a0) arg0 arg1 Source # 
type Min (BShape a0) arg0 arg1 = Apply (BShape a0) (BShape a0) (Apply (BShape a0) (TyFun (BShape a0) (BShape a0) -> Type) (Min_1627967391Sym0 (BShape a0)) arg0) arg1
type Max (BShape a0) arg0 arg1 Source # 
type Max (BShape a0) arg0 arg1 = Apply (BShape a0) (BShape a0) (Apply (BShape a0) (TyFun (BShape a0) (BShape a0) -> Type) (Max_1627967358Sym0 (BShape a0)) arg0) arg1
type (:>=) (BShape a0) arg0 arg1 Source # 
type (:>=) (BShape a0) arg0 arg1 = Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) (TFHelper_1627967325Sym0 (BShape a0)) arg0) arg1
type (:>) (BShape a0) arg0 arg1 Source # 
type (:>) (BShape a0) arg0 arg1 = Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) (TFHelper_1627967292Sym0 (BShape a0)) arg0) arg1
type (:<=) (BShape a0) arg0 arg1 Source # 
type (:<=) (BShape a0) arg0 arg1 = Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) (TFHelper_1627967259Sym0 (BShape a0)) arg0) arg1
type (:<) (BShape a0) arg0 arg1 Source # 
type (:<) (BShape a0) arg0 arg1 = Apply (BShape a0) Bool (Apply (BShape a0) (TyFun (BShape a0) Bool -> Type) (TFHelper_1627967226Sym0 (BShape a0)) arg0) arg1
type Compare (BShape a0) a1 a2 Source # 
type Compare (BShape a0) a1 a2
type (:/=) (BShape k0) x y Source # 
type (:/=) (BShape k0) x y = Not ((:==) (BShape k0) x y)
type (:==) (BShape k0) a0 b0 Source # 
type (:==) (BShape k0) a0 b0

type family BShapeDims (s :: BShape k) = (ks :: [k]) | ks -> s where ... Source #

Equations

BShapeDims (BV x) = '[x] 
BShapeDims (BM x y) = '[x, y] 

data BShapeP :: (k -> Type) -> BShape k -> Type where Source #

Constructors

PBV :: {..} -> BShapeP f (BV a) 

Fields

PBM :: {..} -> BShapeP f (BM a b) 

Fields

pbvProd :: BShapeP f (BV a) -> Prod f '[a] Source #

pbmProd :: BShapeP f (BM a b) -> Prod f '[a, b] Source #

class NatKind k => BLAS b where Source #

Associated Types

type ElemB b :: Type Source #

Methods

liftB :: Sing s -> (Vec n (ElemB b) -> ElemB b) -> Vec n (b s) -> b s Source #

axpy :: ElemB b -> b (BV n) -> Maybe (b (BV n)) -> b (BV n) Source #

dot :: b (BV n) -> b (BV n) -> ElemB b Source #

ger :: b (BV n) -> b (BV m) -> b (BM n m) Source #

gemv :: ElemB b -> b (BM n m) -> b (BV m) -> Maybe (ElemB b, b (BV n)) -> b (BV n) Source #

gemm :: ElemB b -> b (BM n o) -> b (BM o m) -> Maybe (ElemB b, b (BM n m)) -> b (BM n m) Source #

scaleB :: ElemB b -> b s -> b s Source #

addB :: b s -> b s -> b s Source #

indexB :: BShapeP (IndexN k) s -> b s -> ElemB b Source #

indexRowB :: IndexN k n -> b (BM n m) -> b (BV m) Source #

transpB :: b (BM n m) -> b (BM m n) Source #

iRowsB :: Applicative f => (IndexN k n -> b (BV m) -> f (b (BV o))) -> b (BM n m) -> f (b (BM n o)) Source #

iElemsB :: Applicative f => (BShapeP (IndexN k) s -> ElemB b -> f (ElemB b)) -> b s -> f (b s) Source #

bgenA :: Applicative f => Sing s -> (BShapeP (IndexN k) s -> f (ElemB b)) -> f (b s) Source #

bgenRowsA :: (Applicative f, SingI n) => (IndexN k n -> f (b (BV m))) -> f (b (BM n m)) Source #

eye :: Sing n -> b (BM n n) Source #

traceB :: b (BM n n) -> ElemB b Source #

diagB :: b (BV n) -> b (BM n n) Source #

getDiagB :: b (BM n n) -> b (BV n) Source #

sumB :: b s -> ElemB b Source #

Instances

(Container Vector a, Numeric a) => BLAS Nat (HMat a) Source # 

Associated Types

type ElemB (HMat a) (b :: BShape (HMat a) -> Type) :: Type Source #

Methods

liftB :: Sing (BShape (HMat a)) s -> (Vec n (ElemB (HMat a) b) -> ElemB (HMat a) b) -> Vec n (b s) -> b s Source #

axpy :: ElemB (HMat a) b -> b (BV (HMat a) n) -> Maybe (b (BV (HMat a) n)) -> b (BV (HMat a) n) Source #

dot :: b (BV (HMat a) n) -> b (BV (HMat a) n) -> ElemB (HMat a) b Source #

ger :: b (BV (HMat a) n) -> b (BV (HMat a) m) -> b (BM (HMat a) n m) Source #

gemv :: ElemB (HMat a) b -> b (BM (HMat a) n m) -> b (BV (HMat a) m) -> Maybe (ElemB (HMat a) b, b (BV (HMat a) n)) -> b (BV (HMat a) n) Source #

gemm :: ElemB (HMat a) b -> b (BM (HMat a) n o) -> b (BM (HMat a) o m) -> Maybe (ElemB (HMat a) b, b (BM (HMat a) n m)) -> b (BM (HMat a) n m) Source #

scaleB :: ElemB (HMat a) b -> b s -> b s Source #

addB :: b s -> b s -> b s Source #

indexB :: BShapeP (HMat a) (IndexN (HMat a)) s -> b s -> ElemB (HMat a) b Source #

indexRowB :: IndexN (HMat a) n -> b (BM (HMat a) n m) -> b (BV (HMat a) m) Source #

transpB :: b (BM (HMat a) n m) -> b (BM (HMat a) m n) Source #

iRowsB :: Applicative f => (IndexN (HMat a) n -> b (BV (HMat a) m) -> f (b (BV (HMat a) o))) -> b (BM (HMat a) n m) -> f (b (BM (HMat a) n o)) Source #

iElemsB :: Applicative f => (BShapeP (HMat a) (IndexN (HMat a)) s -> ElemB (HMat a) b -> f (ElemB (HMat a) b)) -> b s -> f (b s) Source #

bgenA :: Applicative f => Sing (BShape (HMat a)) s -> (BShapeP (HMat a) (IndexN (HMat a)) s -> f (ElemB (HMat a) b)) -> f (b s) Source #

bgenRowsA :: (Applicative f, SingI (HMat a) n) => (IndexN (HMat a) n -> f (b (BV (HMat a) m))) -> f (b (BM (HMat a) n m)) Source #

eye :: Sing (HMat a) n -> b (BM (HMat a) n n) Source #

traceB :: b (BM (HMat a) n n) -> ElemB (HMat a) b Source #

diagB :: b (BV (HMat a) n) -> b (BM (HMat a) n n) Source #

getDiagB :: b (BM (HMat a) n n) -> b (BV (HMat a) n) Source #

sumB :: b s -> ElemB (HMat a) b Source #

data family Sing k (a :: k) :: * #

The singleton kind-indexed data family.

Instances

data Sing Bool 
data Sing Bool where
data Sing Ordering 
data Sing Nat 
data Sing Nat where
data Sing Symbol 
data Sing Symbol where
data Sing () 
data Sing () where
data Sing N # 
data Sing N = SN {}
type WitnessC ØC (SingI k a) (Sing k a) # 
type WitnessC ØC (SingI k a) (Sing k a) = ØC
data Sing [a0] 
data Sing [a0] where
data Sing (Maybe a0) 
data Sing (Maybe a0) where
data Sing (BShape a0) # 
data Sing (BShape a0) where
data Sing (NonEmpty a0) 
data Sing (NonEmpty a0) where
data Sing (Either a0 b0) 
data Sing (Either a0 b0) where
data Sing (a0, b0) 
data Sing (a0, b0) where
data Sing ((~>) k1 k2) 
data Sing ((~>) k1 k2) = SLambda {}
data Sing (a0, b0, c0) 
data Sing (a0, b0, c0) where
data Sing (a0, b0, c0, d0) 
data Sing (a0, b0, c0, d0) where
data Sing (a0, b0, c0, d0, e0) 
data Sing (a0, b0, c0, d0, e0) where
data Sing (a0, b0, c0, d0, e0, f0) 
data Sing (a0, b0, c0, d0, e0, f0) where
data Sing (a0, b0, c0, d0, e0, f0, g0) 
data Sing (a0, b0, c0, d0, e0, f0, g0) where

type SBShape = (Sing :: BShape a -> Type) Source #

elemsB :: (Applicative f, BLAS b) => (ElemB b -> f (ElemB b)) -> b s -> f (b s) Source #

zipB :: BLAS b => Sing s -> (ElemB b -> ElemB b -> ElemB b) -> b s -> b s -> b s Source #

bgen :: forall k b s. BLAS b => Sing s -> (BShapeP (IndexN k) s -> ElemB b) -> b s Source #

bgenRows :: (BLAS b, SingI n) => (IndexN k n -> b (BV m)) -> b (BM n m) Source #