summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/Tensor.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-06-04 19:10:28 +0000
committerAlberto Ruiz <aruiz@um.es>2007-06-04 19:10:28 +0000
commit7430630fa0504296b796223e01cbd417b88650ef (patch)
treec338dea8b82867a4c161fcee5817ed2ca27c7258 /lib/Data/Packed/Internal/Tensor.hs
parent0a9817cc481fb09f1962eb2c272125e56a123814 (diff)
separation of Internal
Diffstat (limited to 'lib/Data/Packed/Internal/Tensor.hs')
-rw-r--r--lib/Data/Packed/Internal/Tensor.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Data/Packed/Internal/Tensor.hs b/lib/Data/Packed/Internal/Tensor.hs
new file mode 100644
index 0000000..11101a9
--- /dev/null
+++ b/lib/Data/Packed/Internal/Tensor.hs
@@ -0,0 +1,32 @@
1{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-}
2-----------------------------------------------------------------------------
3-- |
4-- Module : Data.Packed.Internal.Tensor
5-- Copyright : (c) Alberto Ruiz 2007
6-- License : GPL-style
7--
8-- Maintainer : Alberto Ruiz <aruiz@um.es>
9-- Stability : provisional
10-- Portability : portable (uses FFI)
11--
12-- Fundamental types
13--
14-----------------------------------------------------------------------------
15
16module Data.Packed.Internal.Tensor where
17
18import Data.Packed.Internal.Vector
19import Data.Packed.Internal.Matrix
20
21
22data IdxTp = Covariant | Contravariant deriving Show
23
24data Tensor t = T { dims :: [(Int,(IdxTp,String))]
25 , ten :: Vector t
26 } deriving Show
27
28rank = length . dims
29
30outer u v = dat (multiply RowMajor r c)
31 where r = matrixFromVector RowMajor 1 u
32 c = matrixFromVector RowMajor (dim v) v