From 24f6bdb3b6ab2ae0f664162588aa8840b417333f Mon Sep 17 00:00:00 2001 From: Sidharth Kapur Date: Thu, 31 Dec 2015 11:27:29 -0600 Subject: Add Normed instance for Static matrix and vector --- packages/base/src/Numeric/LinearAlgebra/Static.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'packages/base/src/Numeric/LinearAlgebra') diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index 4de4d7a..3b7282a 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs @@ -643,3 +643,18 @@ instance (KnownNat n', KnownNat m') => Testable (L n' m') where checkT _ = test +-------------------------------------------------------------------------------- + +instance KnownNat n => Normed (R n) + where + norm_0 v = norm_0 (extract v) + norm_1 v = norm_1 (extract v) + norm_2 v = norm_2 (extract v) + norm_Inf v = norm_Inf (extract v) + +instance (KnownNat m, KnownNat n) => Normed (L m n) + where + norm_0 m = norm_0 (extract m) + norm_1 m = norm_1 (extract m) + norm_2 m = norm_2 (extract m) + norm_Inf m = norm_Inf (extract m) -- cgit v1.2.3