diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-01-18 09:51:31 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-01-18 09:51:31 +0000 |
commit | 102d6b19beadd76b28d32e1aa40844fad19af756 (patch) | |
tree | 1b7736d5d392b0ef43e2e119fc2d1d1a91cd5831 /examples/lie.hs | |
parent | 830164c7c34d874aa66754206be956f85456842f (diff) |
deprecate .* and */
Diffstat (limited to 'examples/lie.hs')
-rw-r--r-- | examples/lie.hs | 7 |
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 | ||
3 | import Numeric.LinearAlgebra | 3 | import Numeric.LinearAlgebra |
4 | import Text.Printf(printf) | ||
5 | 4 | ||
6 | disp = putStrLn . format " " (printf "%.5f") | 5 | disp = putStrLn . dispf 5 |
7 | 6 | ||
8 | rot1 :: Double -> Matrix Double | 7 | rot1 :: Double -> Matrix Double |
9 | rot1 a = (3><3) | 8 | rot1 a = (3><3) |
@@ -50,14 +49,14 @@ infix 8 & | |||
50 | a & b = a <> b - b <> a | 49 | a & b = a <> b - b <> a |
51 | 50 | ||
52 | infixl 6 |+| | 51 | infixl 6 |+| |
53 | a |+| b = a + b + a & b */2 + (a-b) & (a & b) */12 | 52 | a |+| b = a + b + a&b /2 + (a-b)&(a & b) /12 |
54 | 53 | ||
55 | main = do | 54 | main = 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):" |