@@ -1,6 +1,8 @@
1module Data.Matrix
1module Data.Matrix
4+import Control.Algebra.VectorSpace
3−import Control.Algebra
5+import public Control.Algebra.NumericInstances
5import Data.Complex
7import Data.Complex
6import Data.ZZ
8import Data.ZZ
@@ -40,8 +42,7 @@ instance Ring a => Ring (Vect n a) where
40instance RingWithUnity a => RingWithUnity (Vect n a) where
42instance RingWithUnity a => RingWithUnity (Vect n a) where
41 unity {n} = replicate n unity
43 unity {n} = replicate n unity
43−instance Field a => Field (Vect n a) where
45+--instance Field a => Field (Vect n a) where
44− inverseM = map inverseM
46instance RingWithUnity a => Module a (Vect n a) where
47instance RingWithUnity a => Module a (Vect n a) where
47 (<#>) r v = map (r <.>) v
48 (<#>) r v = map (r <.>) v
@@ -147,104 +148,3 @@ Id {d} = map (\n => basis n) $ allN d
148-- TODO: Prove properties of matrix algebra for 'Verified' algebraic classes
149-- TODO: Prove properties of matrix algebra for 'Verified' algebraic classes
150−-----------------------------------------------------------------------
151−-- Numberic data types as rings
152−-----------------------------------------------------------------------
154−instance Semigroup Integer where
157−instance Monoid Integer where
160−instance Group Integer where
163−instance AbelianGroup Integer
165−instance Ring Integer where
168−instance RingWithUnity Integer where
172−instance Semigroup Int where
175−instance Monoid Int where
178−instance Group Int where
181−instance AbelianGroup Int
183−instance Ring Int where
186−instance RingWithUnity Int where
190−instance Semigroup Float where
193−instance Monoid Float where
196−instance Group Float where
199−instance AbelianGroup Float
201−instance Ring Float where
204−instance RingWithUnity Float where
207−instance Field Float where
211−instance Semigroup Nat where
214−instance Monoid Nat where
217−instance Semigroup ZZ where
220−instance Monoid ZZ where
223−instance Group ZZ where
226−instance AbelianGroup ZZ
228−instance Ring ZZ where
231−instance RingWithUnity ZZ where
235−instance Semigroup a => Semigroup (Complex a) where
236− (<+>) (a :+ b) (c :+ d) = (a <+> c) :+ (b <+> d)
238−instance Monoid a => Monoid (Complex a) where
239− neutral = (neutral :+ neutral)
241−instance Group a => Group (Complex a) where
242− inverse (r :+ i) = (inverse r :+ inverse i)
244−instance Ring a => AbelianGroup (Complex a) where {}
246−instance Ring a => Ring (Complex a) where
247− (<.>) (a :+ b) (c :+ d) = (a <.> c <-> b <.> d) :+ (a <.> d <+> b <.> c)
249−instance RingWithUnity a => RingWithUnity (Complex a) where
250− unity = (unity :+ neutral)