From e21f42f742959ec9452add9b6c6e08d30d9584ed Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 8 Jun 2007 23:07:45 +0000 Subject: diagRect, svdC --- lib/Data/Packed/Internal/Matrix.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Data') diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index bd333d4..4383e79 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs @@ -315,3 +315,10 @@ diagG v = reshape c $ fromList $ [ l!!(i-1) * delta k i | k <- [1..c], i <- [1.. l = toList v delta i j | i==j = 1 | otherwise = 0 + +diagRect s r c + | dim s < min r c = error "diagRect" + | r == c = diag s + | r < c = joinHoriz [diag s , zeros (r,c-r)] + | otherwise = joinVert [diag s , zeros (r-c,c)] + where zeros (r,c) = reshape c $ constant (r*c) 0 -- cgit v1.2.3