summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Matrix.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Matrix.hs')
-rw-r--r--lib/Data/Packed/Matrix.hs19
1 files changed, 11 insertions, 8 deletions
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