summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs7
1 files changed, 7 insertions, 0 deletions
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..
315 l = toList v 315 l = toList v
316 delta i j | i==j = 1 316 delta i j | i==j = 1
317 | otherwise = 0 317 | otherwise = 0
318
319diagRect s r c
320 | dim s < min r c = error "diagRect"
321 | r == c = diag s
322 | r < c = joinHoriz [diag s , zeros (r,c-r)]
323 | otherwise = joinVert [diag s , zeros (r-c,c)]
324 where zeros (r,c) = reshape c $ constant (r*c) 0