diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 2 | ||||
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 19 |
3 files changed, 13 insertions, 10 deletions
@@ -11,6 +11,8 @@ | |||
11 | 11 | ||
12 | * added a general multiplication operator (×) | 12 | * added a general multiplication operator (×) |
13 | 13 | ||
14 | * improved build and konst | ||
15 | |||
14 | * Plot functions moved to Numeric.LinearAlgebra.Util | 16 | * Plot functions moved to Numeric.LinearAlgebra.Util |
15 | * removed (!) (use (¦) instead) | 17 | * removed (!) (use (¦) instead) |
16 | 18 | ||
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 |
130 | infixl 9 |> | 128 | infixl 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 | |||
109 | joinHoriz :: Element t => [Matrix t] -> Matrix t | 109 | joinHoriz :: Element t => [Matrix t] -> Matrix t |
110 | joinHoriz ms = trans. joinVert . map trans $ ms | 110 | joinHoriz 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 | ||
114 | Single row/column components are automatically expanded to match the | 114 | Single row-column components are automatically expanded to match the |
115 | corresponding common row and column: | 115 | corresponding 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 | ||
124 | 8x10 | 125 | 8x10 |
125 | 1 0 0 0 0 7 7 7 10 20 | 126 | 1 0 0 0 0 7 7 7 10 20 |
@@ -129,7 +130,9 @@ corresponding common row and column: | |||
129 | 0 0 0 0 1 7 7 7 10 20 | 130 | 0 0 0 0 1 7 7 7 10 20 |
130 | 3 3 3 3 3 1 0 0 0 0 | 131 | 3 3 3 3 3 1 0 0 0 0 |
131 | 3 3 3 3 3 0 2 0 0 0 | 132 | 3 3 3 3 3 0 2 0 0 0 |
132 | 3 3 3 3 3 0 0 3 0 0@ | 133 | 3 3 3 3 3 0 0 3 0 0 |
134 | @ | ||
135 | |||
133 | -} | 136 | -} |
134 | fromBlocks :: Element t => [[Matrix t]] -> Matrix t | 137 | fromBlocks :: Element t => [[Matrix t]] -> Matrix t |
135 | fromBlocks = fromBlocksRaw . adaptBlocks | 138 | fromBlocks = fromBlocksRaw . adaptBlocks |