Gaussian elimination: Difference between revisions
m
→From scratch
(From scratch) |
m (→From scratch) |
||
Line 1,416:
===From scratch===
<lang Haskell>
isMatrix xs = null xs || all ((== (length.head $ xs)).length) xs
Line 1,446 ⟶ 1,445:
go (x:xs) (y:ys) zs = go xs ys $ (val x y zs):zs
triangle::(Num a, Ord a) => [[a]] -> [[a]] -> ([[a]],[[a]])
triangle xs bs = triang ([],[]) (xs,bs)
where
Line 1,454 ⟶ 1,453:
where ((us@(u:tus)):uss,cs:css) = bubble zs
bubble::
bubble (xs,bs) = (go xs, go bs)
where
idmax = snd.
go ys = let (us,vs) = splitAt idmax ys in vs ++ us
|