summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Le <justin@jle.im>2016-01-11 03:33:10 -0800
committerJustin Le <justin@jle.im>2016-01-11 03:33:10 -0800
commit86b9e7cf3b9c29e8351b313860054caa485dc987 (patch)
tree7bf2fc410b506f6df175922c4708dde0329bf8b7
parent273de57881fd5cf3092816ddeb45b026612adeae (diff)
Disp instance for Sym and Her
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Static.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs
index 720b011..6d828d7 100644
--- a/packages/base/src/Numeric/LinearAlgebra/Static.hs
+++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs
@@ -77,6 +77,7 @@ import qualified Numeric.LinearAlgebra.Devel as LA
77import Data.Proxy(Proxy(..)) 77import Data.Proxy(Proxy(..))
78import Internal.Static 78import Internal.Static
79import Control.Arrow((***)) 79import Control.Arrow((***))
80import Text.Printf
80 81
81ud1 :: R n -> Vector ℝ 82ud1 :: R n -> Vector ℝ
82ud1 (R (Dim v)) = v 83ud1 (R (Dim v)) = v
@@ -296,6 +297,20 @@ her :: KnownNat n => M n n -> Her n
296her m = Her $ (m + LA.tr m)/2 297her m = Her $ (m + LA.tr m)/2
297 298
298 299
300instance (KnownNat n) => Disp (Sym n)
301 where
302 disp n (Sym x) = do
303 let a = extract x
304 let su = LA.dispf n a
305 printf "Sym %d" (cols a) >> putStr (dropWhile (/='\n') $ su)
306
307instance (KnownNat n) => Disp (Her n)
308 where
309 disp n (Her x) = do
310 let a = extract x
311 let su = LA.dispcf n a
312 printf "Her %d" (cols a) >> putStr (dropWhile (/='\n') $ su)
313
299 314
300instance KnownNat n => Eigen (Sym n) (R n) (L n n) 315instance KnownNat n => Eigen (Sym n) (R n) (L n n)
301 where 316 where