summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-01-18 09:51:31 +0000
committerAlberto Ruiz <aruiz@um.es>2010-01-18 09:51:31 +0000
commit102d6b19beadd76b28d32e1aa40844fad19af756 (patch)
tree1b7736d5d392b0ef43e2e119fc2d1d1a91cd5831 /examples
parent830164c7c34d874aa66754206be956f85456842f (diff)
deprecate .* and */
Diffstat (limited to 'examples')
-rw-r--r--examples/lie.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/lie.hs b/examples/lie.hs
index 87f7ed1..db21ea8 100644
--- a/examples/lie.hs
+++ b/examples/lie.hs
@@ -1,9 +1,8 @@
1-- The magic of Lie Algebra 1-- The magic of Lie Algebra
2 2
3import Numeric.LinearAlgebra 3import Numeric.LinearAlgebra
4import Text.Printf(printf)
5 4
6disp = putStrLn . format " " (printf "%.5f") 5disp = putStrLn . dispf 5
7 6
8rot1 :: Double -> Matrix Double 7rot1 :: Double -> Matrix Double
9rot1 a = (3><3) 8rot1 a = (3><3)
@@ -50,14 +49,14 @@ infix 8 &
50a & b = a <> b - b <> a 49a & b = a <> b - b <> a
51 50
52infixl 6 |+| 51infixl 6 |+|
53a |+| b = a + b + a & b */2 + (a-b) & (a & b) */12 52a |+| b = a + b + a&b /2 + (a-b)&(a & b) /12
54 53
55main = do 54main = do
56 let a = 45*deg 55 let a = 45*deg
57 b = 50*deg 56 b = 50*deg
58 c = -30*deg 57 c = -30*deg
59 exact = rot3 a <> rot1 b <> rot2 c 58 exact = rot3 a <> rot1 b <> rot2 c
60 lie = a.*g3 |+| b.*g1 |+| c.*g2 59 lie = scalar a * g3 |+| scalar b * g1 |+| scalar c * g2
61 putStrLn "position in the tangent space:" 60 putStrLn "position in the tangent space:"
62 disp lie 61 disp lie
63 putStrLn "exponential map back to the group (2 terms):" 62 putStrLn "exponential map back to the group (2 terms):"