diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-06 08:50:50 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-06 08:50:50 +0200 |
commit | c9914d694d3b86ece46fa0c76e0466c6cd394d14 (patch) | |
tree | 7fa1c5a95b204912f5d560c843ae6045ee8d2780 /lib/Numeric/LinearAlgebra | |
parent | 4078cf44c98b42960be27843782f6983bb66017f (diff) |
extend conformability to empty arrays
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Util.hs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/Numeric/LinearAlgebra/Util.hs b/lib/Numeric/LinearAlgebra/Util.hs index 7164827..7d134bf 100644 --- a/lib/Numeric/LinearAlgebra/Util.hs +++ b/lib/Numeric/LinearAlgebra/Util.hs | |||
@@ -166,7 +166,7 @@ row = asRow . fromList | |||
166 | col :: [Double] -> Matrix Double | 166 | col :: [Double] -> Matrix Double |
167 | col = asColumn . fromList | 167 | col = asColumn . fromList |
168 | 168 | ||
169 | {- | extract selected rows | 169 | {- | extract rows |
170 | 170 | ||
171 | >>> (20><4) [1..] ? [2,1,1] | 171 | >>> (20><4) [1..] ? [2,1,1] |
172 | (3><4) | 172 | (3><4) |
@@ -179,12 +179,20 @@ infixl 9 ? | |||
179 | (?) :: Element t => Matrix t -> [Int] -> Matrix t | 179 | (?) :: Element t => Matrix t -> [Int] -> Matrix t |
180 | (?) = flip extractRows | 180 | (?) = flip extractRows |
181 | 181 | ||
182 | -- | extract selected columns | 182 | {- | extract columns |
183 | -- | 183 | |
184 | -- (unicode 0x00bf, inverted question mark) | 184 | (unicode 0x00bf, inverted question mark, Alt-Gr ?) |
185 | |||
186 | >>> (3><4) [1..] ¿ [3,0] | ||
187 | (3><2) | ||
188 | [ 4.0, 1.0 | ||
189 | , 8.0, 5.0 | ||
190 | , 12.0, 9.0 ] | ||
191 | |||
192 | -} | ||
185 | infixl 9 ¿ | 193 | infixl 9 ¿ |
186 | (¿) :: Element t => Matrix t -> [Int] -> Matrix t | 194 | (¿) :: Element t => Matrix t -> [Int] -> Matrix t |
187 | m ¿ ks = trans . extractRows ks . trans $ m | 195 | (¿)= flip extractColumns |
188 | 196 | ||
189 | 197 | ||
190 | cross :: Vector Double -> Vector Double -> Vector Double | 198 | cross :: Vector Double -> Vector Double -> Vector Double |