diff options
author | Justin Le <justin@jle.im> | 2016-01-07 02:00:37 -0800 |
---|---|---|
committer | Justin Le <justin@jle.im> | 2016-01-07 02:00:37 -0800 |
commit | 5d703ef02dc7bfd51b953753a7fef0e68a9dcc5b (patch) | |
tree | 8537bc949ad31322f8752472014c661b47ae426d /packages/base/src | |
parent | 190d0184a4cf487dbd140e8a1fab56ccb5af08ab (diff) |
withOrth added, to mirror withNullSapce, for Static
Diffstat (limited to 'packages/base/src')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index e06474e..43a21a3 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -49,7 +49,7 @@ module Numeric.LinearAlgebra.Static( | |||
49 | linSolve, (<\>), | 49 | linSolve, (<\>), |
50 | -- * Factorizations | 50 | -- * Factorizations |
51 | svd, withCompactSVD, svdTall, svdFlat, Eigen(..), | 51 | svd, withCompactSVD, svdTall, svdFlat, Eigen(..), |
52 | withNullspace, qr, chol, | 52 | withNullspace, withOrth, qr, chol, |
53 | -- * Norms | 53 | -- * Norms |
54 | Normed(..), | 54 | Normed(..), |
55 | -- * Random arrays | 55 | -- * Random arrays |
@@ -326,6 +326,15 @@ withNullspace (LA.nullspace . extract -> a) f = | |||
326 | Nothing -> error "static/dynamic mismatch" | 326 | Nothing -> error "static/dynamic mismatch" |
327 | Just (SomeNat (_ :: Proxy k)) -> f (mkL a :: L n k) | 327 | Just (SomeNat (_ :: Proxy k)) -> f (mkL a :: L n k) |
328 | 328 | ||
329 | withOrth | ||
330 | :: forall m n z . (KnownNat m, KnownNat n) | ||
331 | => L m n | ||
332 | -> (forall k. (KnownNat k) => L n k -> z) | ||
333 | -> z | ||
334 | withOrth (LA.orth . extract -> a) f = | ||
335 | case someNatVal $ fromIntegral $ cols a of | ||
336 | Nothing -> error "static/dynamic mismatch" | ||
337 | Just (SomeNat (_ :: Proxy k)) -> f (mkL a :: L n k) | ||
329 | 338 | ||
330 | withCompactSVD | 339 | withCompactSVD |
331 | :: forall m n z . (KnownNat m, KnownNat n) | 340 | :: forall m n z . (KnownNat m, KnownNat n) |