summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Numeric/LinearAlgebra/Util.hs19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/Numeric/LinearAlgebra/Util.hs b/lib/Numeric/LinearAlgebra/Util.hs
index 3e4f6a9..c4b7776 100644
--- a/lib/Numeric/LinearAlgebra/Util.hs
+++ b/lib/Numeric/LinearAlgebra/Util.hs
@@ -19,7 +19,8 @@ module Numeric.LinearAlgebra.Util(
19 diagl, 19 diagl,
20 row, 20 row,
21 col, 21 col,
22 (&),(!), (#), 22 (&),(!), (¦), (#),
23 (?),(¿),
23 rand, randn, 24 rand, randn,
24 cross, 25 cross,
25 norm, 26 norm,
@@ -99,6 +100,11 @@ infixl 3 !
99(!) :: Matrix Double -> Matrix Double -> Matrix Double 100(!) :: Matrix Double -> Matrix Double -> Matrix Double
100a ! b = fromBlocks [[a,b]] 101a ! b = fromBlocks [[a,b]]
101 102
103-- | (00A6) horizontal concatenation of real matrices
104infixl 3 ¦
105(¦) :: Matrix Double -> Matrix Double -> Matrix Double
106a ¦ b = fromBlocks [[a,b]]
107
102-- | vertical concatenation of real matrices 108-- | vertical concatenation of real matrices
103(#) :: Matrix Double -> Matrix Double -> Matrix Double 109(#) :: Matrix Double -> Matrix Double -> Matrix Double
104infixl 2 # 110infixl 2 #
@@ -112,6 +118,17 @@ row = asRow . fromList
112col :: [Double] -> Matrix Double 118col :: [Double] -> Matrix Double
113col = asColumn . fromList 119col = asColumn . fromList
114 120
121-- | extract selected rows
122infixl 9 ?
123(?) :: Element t => Matrix t -> [Int] -> Matrix t
124(?) = flip extractRows
125
126-- | (00BF) extract selected columns
127infixl 9 ¿
128(¿) :: Element t => Matrix t -> [Int] -> Matrix t
129m ¿ ks = trans . extractRows ks . trans $ m
130
131
115cross :: Vector Double -> Vector Double -> Vector Double 132cross :: Vector Double -> Vector Double -> Vector Double
116-- ^ cross product (for three-element real vectors) 133-- ^ cross product (for three-element real vectors)
117cross x y | dim x == 3 && dim y == 3 = fromList [z1,z2,z3] 134cross x y | dim x == 3 && dim y == 3 = fromList [z1,z2,z3]