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

Safe HaskellNone
LanguageHaskell2010

TensorOps.Backend.BTensor

Documentation

data BTensor :: (k -> Type -> Type) -> (BShape k -> Type) -> [k] -> Type Source #

Instances

(Vec k2 v, BLAS k2 b, RealFloat (ElemB k2 b), Nesting1 (* -> *) k2 (Proxy k2) Functor v, Nesting1 (* -> *) k2 (Proxy k2) Foldable v, Nesting1 (* -> *) k2 (Sing k2) Applicative v, Nesting1 (* -> *) k2 (Sing k2) Distributive v, Eq1 k2 (IndexN k2)) => Tensor k2 (BTensor k2 v b) Source # 

Associated Types

type ElemT (BTensor k2 v b) (t :: [BTensor k2 v b] -> Type) :: Type Source #

Methods

liftT :: SingI [BTensor k2 v b] o => (Vec n (ElemT (BTensor k2 v b) t) -> ElemT (BTensor k2 v b) t) -> Vec n (t o) -> t o Source #

gmul :: (SingI [BTensor k2 v b] ((BTensor k2 v b ++ Reverse (BTensor k2 v b) os) ns), SingI [BTensor k2 v b] ((BTensor k2 v b ++ ms) ns)) => Length (BTensor k2 v b) ms -> Length (BTensor k2 v b) os -> Length (BTensor k2 v b) ns -> t ((BTensor k2 v b ++ ms) os) -> t ((BTensor k2 v b ++ Reverse (BTensor k2 v b) os) ns) -> t ((BTensor k2 v b ++ ms) ns) Source #

sumT :: SingI [BTensor k2 v b] o => [t o] -> t o Source #

scaleT :: SingI [BTensor k2 v b] o => ElemT (BTensor k2 v b) t -> t o -> t o Source #

transp :: (SingI [BTensor k2 v b] ns, SingI [BTensor k2 v b] (Reverse (BTensor k2 v b) ns)) => t ns -> t (Reverse (BTensor k2 v b) ns) Source #

mapRows :: SingI [BTensor k2 v b] ((BTensor k2 v b ++ ns) ms) => Length (BTensor k2 v b) ns -> (t ms -> t ms) -> t ((BTensor k2 v b ++ ns) ms) -> t ((BTensor k2 v b ++ ns) ms) Source #

sumRows :: (SingI [BTensor k2 v b] ((BTensor k2 v b ': n) ns), SingI [BTensor k2 v b] ns) => t ((BTensor k2 v b ': n) ns) -> t ns Source #

diag :: SingI [BTensor k2 v b] ((BTensor k2 v b ': n) ns) => Uniform (BTensor k2 v b) n ns -> t ((BTensor k2 v b ': n) [BTensor k2 v b]) -> t ((BTensor k2 v b ': n) ns) Source #

getDiag :: SingI (BTensor k2 v b) n => Uniform (BTensor k2 v b) n ns -> t ((BTensor k2 v b ': n) ((BTensor k2 v b ': n) ns)) -> t ((BTensor k2 v b ': n) [BTensor k2 v b]) Source #

genRand :: (ContGen d, PrimMonad m, SingI [BTensor k2 v b] ns) => d -> Gen (PrimState m) -> m (t ns) Source #

generateA :: (Applicative f, SingI [BTensor k2 v b] ns) => (Prod (BTensor k2 v b) (IndexN (BTensor k2 v b)) ns -> f (ElemT (BTensor k2 v b) t)) -> f (t ns) Source #

ixRows :: (Applicative f, SingI [BTensor k2 v b] ((BTensor k2 v b ++ ms) os)) => Length (BTensor k2 v b) ms -> Length (BTensor k2 v b) os -> (Prod (BTensor k2 v b) (IndexN (BTensor k2 v b)) ms -> t ns -> f (t os)) -> t ((BTensor k2 v b ++ ms) ns) -> f (t ((BTensor k2 v b ++ ms) os)) Source #

(!) :: t ns -> Prod (BTensor k2 v b) (IndexN (BTensor k2 v b)) ns -> ElemT (BTensor k2 v b) t Source #

(NFData (ElemB k b), NFData1 (BShape k) b, Nesting * k (Proxy k) NFData v) => Nesting1 * [k] (Proxy [k]) NFData (BTensor k v b) Source # 

Methods

nesting1 :: BTensor k v b a -> Wit (c (v a)) Source #

(Nesting * k (Proxy k) Show v, Show1 (BShape k) b, Show (ElemB k b)) => Show1 [k] (BTensor k v b) Source # 

Methods

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

show1 :: f a -> String #

(NFData (ElemB k b), NFData1 (BShape k) b, Nesting * k (Proxy k) NFData v) => NFData1 [k] (BTensor k v b) Source # 

Methods

rnf1 :: f a -> () Source #

(BLAS k b, Vec k v, Nesting1 (* -> *) k (Proxy k) Functor v, Nesting1 (* -> *) k (Sing k) Applicative v, SingI [k] ns, Num (ElemB k b)) => Num (BTensor k v b ns) Source # 

Methods

(+) :: BTensor k v b ns -> BTensor k v b ns -> BTensor k v b ns #

(-) :: BTensor k v b ns -> BTensor k v b ns -> BTensor k v b ns #

(*) :: BTensor k v b ns -> BTensor k v b ns -> BTensor k v b ns #

negate :: BTensor k v b ns -> BTensor k v b ns #

abs :: BTensor k v b ns -> BTensor k v b ns #

signum :: BTensor k v b ns -> BTensor k v b ns #

fromInteger :: Integer -> BTensor k v b ns #

(Nesting * k (Proxy k) Show v, Show1 (BShape k) b, Show (ElemB k b)) => Show (BTensor k v b s) Source # 

Methods

showsPrec :: Int -> BTensor k v b s -> ShowS #

show :: BTensor k v b s -> String #

showList :: [BTensor k v b s] -> ShowS #

(NFData (ElemB k b), NFData1 (BShape k) b, Nesting * k (Proxy k) NFData v) => NFData (BTensor k v b js) Source # 

Methods

rnf :: BTensor k v b js -> () #

type ElemT k (BTensor k v b) Source # 
type ElemT k (BTensor k v b) = ElemB k b

type BTensorL = BTensor (Flip2 VecT I) Source #

type BTensorV = BTensor (Flip2 VectorT I) Source #

data HMat :: Type -> BShape Nat -> Type 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 #

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

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 #

(SingI (BShape Nat) s, Container Vector a, Container Matrix a, Num a) => Num (HMat a s) Source # 

Methods

(+) :: HMat a s -> HMat a s -> HMat a s #

(-) :: HMat a s -> HMat a s -> HMat a s #

(*) :: HMat a s -> HMat a s -> HMat a s #

negate :: HMat a s -> HMat a s #

abs :: HMat a s -> HMat a s #

signum :: HMat a s -> HMat a s #

fromInteger :: Integer -> HMat a s #

(Storable a, Show a, Element a) => Show (HMat a s) Source # 

Methods

showsPrec :: Int -> HMat a s -> ShowS #

show :: HMat a s -> String #

showList :: [HMat a s] -> ShowS #

(Storable a, NFData a) => NFData (HMat a s) Source # 

Methods

rnf :: HMat a s -> () #

type ElemB Nat (HMat a) Source # 
type ElemB Nat (HMat a) = a