summaryrefslogtreecommitdiff
path: root/packages/base
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base')
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Static.hs19
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(..))
78import Internal.Static 78import Internal.Static
79import Control.Arrow((***)) 79import Control.Arrow((***))
80import Text.Printf 80import Text.Printf
81import Data.Type.Equality ((:~:)(Refl))
81 82
82ud1 :: R n -> Vector ℝ 83ud1 :: R n -> Vector ℝ
83ud1 (R (Dim v)) = v 84ud1 (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)
447exactLength v 448exactLength 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
453withMatrix 452withMatrix
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)
473exactDims m 472exactDims 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
480randomVector 477randomVector
481 :: forall n . KnownNat n 478 :: forall n . KnownNat n