summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-05-06 08:50:50 +0200
committerAlberto Ruiz <aruiz@um.es>2014-05-06 08:50:50 +0200
commitc9914d694d3b86ece46fa0c76e0466c6cd394d14 (patch)
tree7fa1c5a95b204912f5d560c843ae6045ee8d2780 /lib/Numeric/LinearAlgebra
parent4078cf44c98b42960be27843782f6983bb66017f (diff)
extend conformability to empty arrays
Diffstat (limited to 'lib/Numeric/LinearAlgebra')
-rw-r--r--lib/Numeric/LinearAlgebra/Util.hs18
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
166col :: [Double] -> Matrix Double 166col :: [Double] -> Matrix Double
167col = asColumn . fromList 167col = 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-}
185infixl 9 ¿ 193infixl 9 ¿
186(¿) :: Element t => Matrix t -> [Int] -> Matrix t 194(¿) :: Element t => Matrix t -> [Int] -> Matrix t
187m ¿ ks = trans . extractRows ks . trans $ m 195(¿)= flip extractColumns
188 196
189 197
190cross :: Vector Double -> Vector Double -> Vector Double 198cross :: Vector Double -> Vector Double -> Vector Double