diff options
Diffstat (limited to 'packages/base/src/Internal/Modular.hs')
-rw-r--r-- | packages/base/src/Internal/Modular.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/base/src/Internal/Modular.hs b/packages/base/src/Internal/Modular.hs index eb0c5a8..e67aa67 100644 --- a/packages/base/src/Internal/Modular.hs +++ b/packages/base/src/Internal/Modular.hs | |||
@@ -135,6 +135,7 @@ instance (Integral t, KnownNat n) => Num (Mod n t) | |||
135 | fromInteger = l0 (\m x -> fromInteger x `mod` (fromIntegral m)) | 135 | fromInteger = l0 (\m x -> fromInteger x `mod` (fromIntegral m)) |
136 | 136 | ||
137 | 137 | ||
138 | #if 0 | ||
138 | instance KnownNat m => Element (Mod m I) | 139 | instance KnownNat m => Element (Mod m I) |
139 | where | 140 | where |
140 | constantD x n = i2f (constantD (unMod x) n) | 141 | constantD x n = i2f (constantD (unMod x) n) |
@@ -168,6 +169,7 @@ instance KnownNat m => Element (Mod m Z) | |||
168 | gemm u a b c = gemmg (c_gemmML m') (f2i u) (f2iM a) (f2iM b) (f2iM c) | 169 | gemm u a b c = gemmg (c_gemmML m') (f2i u) (f2iM a) (f2iM b) (f2iM c) |
169 | where | 170 | where |
170 | m' = fromIntegral . natVal $ (undefined :: Proxy m) | 171 | m' = fromIntegral . natVal $ (undefined :: Proxy m) |
172 | #endif | ||
171 | 173 | ||
172 | 174 | ||
173 | instance KnownNat m => CTrans (Mod m I) | 175 | instance KnownNat m => CTrans (Mod m I) |
@@ -306,10 +308,10 @@ f2i :: Storable t => Vector (Mod n t) -> Vector t | |||
306 | f2i v = unsafeFromForeignPtr (castForeignPtr fp) (i) (n) | 308 | f2i v = unsafeFromForeignPtr (castForeignPtr fp) (i) (n) |
307 | where (fp,i,n) = unsafeToForeignPtr v | 309 | where (fp,i,n) = unsafeToForeignPtr v |
308 | 310 | ||
309 | f2iM :: (Element t, Element (Mod n t)) => Matrix (Mod n t) -> Matrix t | 311 | f2iM :: (Storable t, Storable (Mod n t)) => Matrix (Mod n t) -> Matrix t |
310 | f2iM m = m { xdat = f2i (xdat m) } | 312 | f2iM m = m { xdat = f2i (xdat m) } |
311 | 313 | ||
312 | i2fM :: (Element t, Element (Mod n t)) => Matrix t -> Matrix (Mod n t) | 314 | i2fM :: (Storable t, Storable (Mod n t)) => Matrix t -> Matrix (Mod n t) |
313 | i2fM m = m { xdat = i2f (xdat m) } | 315 | i2fM m = m { xdat = i2f (xdat m) } |
314 | 316 | ||
315 | vmod :: forall m t. (KnownNat m, Storable t, Integral t, Numeric t) => Vector t -> Vector (Mod m t) | 317 | vmod :: forall m t. (KnownNat m, Storable t, Integral t, Numeric t) => Vector t -> Vector (Mod m t) |