diff options
author | Alberto Ruiz <aruiz@um.es> | 2016-01-18 11:45:36 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2016-01-18 11:45:36 +0100 |
commit | a7c1ccf2f1f69982076ad2acc1029abc95460430 (patch) | |
tree | 246e94d4f1d67bb3650118d17184cbf289469680 /packages | |
parent | 8fe477ce386f1b9c092e5cebfee440b5542b64a3 (diff) | |
parent | d64d1b468197198213c850c47f7fe79bd3b1a2ab (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.hs | 15 |
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 | |||
77 | import Data.Proxy(Proxy(..)) | 77 | 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 | 81 | ||
81 | ud1 :: R n -> Vector ℝ | 82 | ud1 :: R n -> Vector ℝ |
82 | ud1 (R (Dim v)) = v | 83 | ud1 (R (Dim v)) = v |
@@ -291,6 +292,20 @@ her :: KnownNat n => M n n -> Her n | |||
291 | her m = Her $ (m + LA.tr m)/2 | 292 | her m = Her $ (m + LA.tr m)/2 |
292 | 293 | ||
293 | 294 | ||
295 | instance (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 | |||
302 | instance (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 | ||
295 | instance KnownNat n => Eigen (Sym n) (R n) (L n n) | 310 | instance KnownNat n => Eigen (Sym n) (R n) (L n n) |
296 | where | 311 | where |