diff options
Diffstat (limited to 'packages/base')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index 3e772b2..a55ae44 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -78,6 +78,7 @@ import Data.Proxy(Proxy(..)) | |||
78 | import Internal.Static | 78 | import Internal.Static |
79 | import Control.Arrow((***)) | 79 | import Control.Arrow((***)) |
80 | import Text.Printf | 80 | import Text.Printf |
81 | import Data.Type.Equality ((:~:)(Refl)) | ||
81 | 82 | ||
82 | ud1 :: R n -> Vector ℝ | 83 | ud1 :: R n -> Vector ℝ |
83 | ud1 (R (Dim v)) = v | 84 | ud1 (R (Dim v)) = v |
@@ -444,11 +445,9 @@ exactLength | |||
444 | :: forall n m . (KnownNat n, KnownNat m) | 445 | :: forall n m . (KnownNat n, KnownNat m) |
445 | => R m | 446 | => R m |
446 | -> Maybe (R n) | 447 | -> Maybe (R n) |
447 | exactLength v | 448 | exactLength v = do |
448 | | natVal (Proxy :: Proxy n) == natVal (Proxy :: Proxy m) | 449 | Refl <- sameNat (Proxy :: Proxy n) (Proxy :: Proxy m) |
449 | = Just (mkR (unwrap v)) | 450 | return $ mkR (unwrap v) |
450 | | otherwise | ||
451 | = Nothing | ||
452 | 451 | ||
453 | withMatrix | 452 | withMatrix |
454 | :: forall z | 453 | :: forall z |
@@ -470,12 +469,10 @@ exactDims | |||
470 | :: forall n m j k . (KnownNat n, KnownNat m, KnownNat j, KnownNat k) | 469 | :: forall n m j k . (KnownNat n, KnownNat m, KnownNat j, KnownNat k) |
471 | => L m n | 470 | => L m n |
472 | -> Maybe (L j k) | 471 | -> Maybe (L j k) |
473 | exactDims m | 472 | exactDims m = do |
474 | | natVal (Proxy :: Proxy m) == natVal (Proxy :: Proxy j) | 473 | Refl <- sameNat (Proxy :: Proxy m) (Proxy :: Proxy j) |
475 | && natVal (Proxy :: Proxy n) == natVal (Proxy :: Proxy k) | 474 | Refl <- sameNat (Proxy :: Proxy n) (Proxy :: Proxy k) |
476 | = Just (mkL (unwrap m)) | 475 | return $ mkL (unwrap m) |
477 | | otherwise | ||
478 | = Nothing | ||
479 | 476 | ||
480 | randomVector | 477 | randomVector |
481 | :: forall n . KnownNat n | 478 | :: forall n . KnownNat n |