summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2016-01-18 11:45:36 +0100
committerAlberto Ruiz <aruiz@um.es>2016-01-18 11:45:36 +0100
commita7c1ccf2f1f69982076ad2acc1029abc95460430 (patch)
tree246e94d4f1d67bb3650118d17184cbf289469680 /packages
parent8fe477ce386f1b9c092e5cebfee440b5542b64a3 (diff)
parentd64d1b468197198213c850c47f7fe79bd3b1a2ab (diff)
Merge pull request #172 from mstksg/master
`Disp` instance for `Sym` and `Her`
Diffstat (limited to 'packages')
-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 1ab7e57..e18ba0c 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
@@ -291,6 +292,20 @@ her :: KnownNat n => M n n -> Her n
291her m = Her $ (m + LA.tr m)/2 292her m = Her $ (m + LA.tr m)/2
292 293
293 294
295instance (KnownNat n) => Disp (Sym n)
296 where
297 disp n (Sym x) = do
298 let a = extract x
299 let su = LA.dispf n a
300 printf "Sym %d" (cols a) >> putStr (dropWhile (/='\n') $ su)
301
302instance (KnownNat n) => Disp (Her n)
303 where
304 disp n (Her x) = do
305 let a = extract x
306 let su = LA.dispcf n a
307 printf "Her %d" (cols a) >> putStr (dropWhile (/='\n') $ su)
308
294 309
295instance KnownNat n => Eigen (Sym n) (R n) (L n n) 310instance KnownNat n => Eigen (Sym n) (R n) (L n n)
296 where 311 where