diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-06-10 16:10:14 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-06-10 16:10:14 +0200 |
commit | 05e40db4fdc85b73f38ae5e105db0d523176debe (patch) | |
tree | ef0e87d3c7f6ca6d65cbaec6d6783db72df177f4 /packages/base/src/Numeric/Complex.hs | |
parent | a928a3a1713704cf3d5148bedc7ff8acb1347599 (diff) |
Domain class
Diffstat (limited to 'packages/base/src/Numeric/Complex.hs')
-rw-r--r-- | packages/base/src/Numeric/Complex.hs | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/packages/base/src/Numeric/Complex.hs b/packages/base/src/Numeric/Complex.hs deleted file mode 100644 index d194af3..0000000 --- a/packages/base/src/Numeric/Complex.hs +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | {-# LANGUAGE DataKinds #-} | ||
2 | {-# LANGUAGE KindSignatures #-} | ||
3 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} | ||
4 | {-# LANGUAGE MultiParamTypeClasses #-} | ||
5 | {-# LANGUAGE FunctionalDependencies #-} | ||
6 | {-# LANGUAGE FlexibleContexts #-} | ||
7 | {-# LANGUAGE ScopedTypeVariables #-} | ||
8 | {-# LANGUAGE EmptyDataDecls #-} | ||
9 | {-# LANGUAGE Rank2Types #-} | ||
10 | {-# LANGUAGE FlexibleInstances #-} | ||
11 | {-# LANGUAGE TypeOperators #-} | ||
12 | {-# LANGUAGE ViewPatterns #-} | ||
13 | {-# LANGUAGE GADTs #-} | ||
14 | |||
15 | |||
16 | {- | | ||
17 | Module : Numeric.HMatrix.Static.Complex | ||
18 | Copyright : (c) Alberto Ruiz 2006-14 | ||
19 | License : BSD3 | ||
20 | Stability : experimental | ||
21 | |||
22 | -} | ||
23 | |||
24 | module Numeric.Complex( | ||
25 | C, M, | ||
26 | vec2, vec3, vec4, (&), (#), | ||
27 | vect, | ||
28 | Her, her, 𝑖, | ||
29 | ) where | ||
30 | |||
31 | import GHC.TypeLits | ||
32 | import Numeric.LinearAlgebra.Util(ℂ,iC) | ||
33 | import qualified Numeric.LinearAlgebra.HMatrix as LA | ||
34 | import Numeric.LinearAlgebra.Static | ||
35 | |||
36 | |||
37 | 𝑖 :: Sized ℂ s c => s | ||
38 | 𝑖 = konst iC | ||
39 | |||
40 | newtype Her n = Her (M n n) | ||
41 | |||
42 | her :: KnownNat n => M n n -> Her n | ||
43 | her m = Her $ (m + LA.tr m)/2 | ||
44 | |||
45 | |||
46 | |||
47 | |||
48 | infixl 4 & | ||
49 | (&) :: forall n . KnownNat n | ||
50 | => C n -> ℂ -> C (n+1) | ||
51 | u & x = u # (mkC (LA.scalar x) :: C 1) | ||
52 | |||
53 | infixl 4 # | ||
54 | (#) :: forall n m . (KnownNat n, KnownNat m) | ||
55 | => C n -> C m -> C (n+m) | ||
56 | (C u) # (C v) = C (vconcat u v) | ||
57 | |||
58 | |||
59 | |||
60 | vec2 :: ℂ -> ℂ -> C 2 | ||
61 | vec2 a b = C (gvec2 a b) | ||
62 | |||
63 | vec3 :: ℂ -> ℂ -> ℂ -> C 3 | ||
64 | vec3 a b c = C (gvec3 a b c) | ||
65 | |||
66 | |||
67 | vec4 :: ℂ -> ℂ -> ℂ -> ℂ -> C 4 | ||
68 | vec4 a b c d = C (gvec4 a b c d) | ||
69 | |||
70 | vect :: forall n . KnownNat n => [ℂ] -> C n | ||
71 | vect xs = C (gvect "C" xs) | ||
72 | |||