summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Internal/Vector.hs2
-rw-r--r--lib/Data/Packed/Matrix.hs19
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
index e5c3196..f0bd9aa 100644
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -123,8 +123,6 @@ toList v = safeRead v $ peekArray (dim v)
123{- | An alternative to 'fromList' with explicit dimension. The input 123{- | An alternative to 'fromList' with explicit dimension. The input
124 list is explicitly truncated if it is too long, so it may safely 124 list is explicitly truncated if it is too long, so it may safely
125 be used, for instance, with infinite lists. 125 be used, for instance, with infinite lists.
126
127 This is the format used in the instances for Show (Vector a).
128-} 126-}
129(|>) :: (Storable a) => Int -> [a] -> Vector a 127(|>) :: (Storable a) => Int -> [a] -> Vector a
130infixl 9 |> 128infixl 9 |>
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
index ab02670..2ab1541 100644
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -109,17 +109,18 @@ joinVert ms = case common cols ms of
109joinHoriz :: Element t => [Matrix t] -> Matrix t 109joinHoriz :: Element t => [Matrix t] -> Matrix t
110joinHoriz ms = trans. joinVert . map trans $ ms 110joinHoriz ms = trans. joinVert . map trans $ ms
111 111
112{- | Creates a matrix from blocks given as a list of lists of matrices. 112{- | Create a matrix from blocks given as a list of lists of matrices.
113 113
114Single row/column components are automatically expanded to match the 114Single row-column components are automatically expanded to match the
115corresponding common row and column: 115corresponding common row and column:
116 116
117@\> let disp = putStr . dispf 2 117@
118\> let vector xs = fromList xs :: Vector Double 118> let disp = putStr . dispf 2
119\> let diagl = diag . vector 119> let vector xs = fromList xs :: Vector Double
120\> let rowm = asRow . vector 120> let diagl = diag . vector
121> let rowm = asRow . vector
121 122
122\> disp $ fromBlocks [[ident 5, 7, rowm[10,20]], [3, diagl[1,2,3], 0]] 123> disp $ fromBlocks [[ident 5, 7, rowm[10,20]], [3, diagl[1,2,3], 0]]
123 124
1248x10 1258x10
1251 0 0 0 0 7 7 7 10 20 1261 0 0 0 0 7 7 7 10 20
@@ -129,7 +130,9 @@ corresponding common row and column:
1290 0 0 0 1 7 7 7 10 20 1300 0 0 0 1 7 7 7 10 20
1303 3 3 3 3 1 0 0 0 0 1313 3 3 3 3 1 0 0 0 0
1313 3 3 3 3 0 2 0 0 0 1323 3 3 3 3 0 2 0 0 0
1323 3 3 3 3 0 0 3 0 0@ 1333 3 3 3 3 0 0 3 0 0
134@
135
133-} 136-}
134fromBlocks :: Element t => [[Matrix t]] -> Matrix t 137fromBlocks :: Element t => [[Matrix t]] -> Matrix t
135fromBlocks = fromBlocksRaw . adaptBlocks 138fromBlocks = fromBlocksRaw . adaptBlocks