Jump to content

Gaussian elimination: Difference between revisions

Line 1,696:
 
===Determinant and permutation matrix are given===
<lang Haskell>mult:: Num a => [[a]] -> [[a]] -> [[a]]
foldlZipWith::mult uss vss = map (a(\xs -> bif ->null c)xs ->then (d[] ->else cfoldl1 ->(zipWith d(+)) ->xs). dzipWith ->(\vs [a]u -> [b]map (u*) ->vs) vss) duss
foldlZipWith _ _ u [] _ = u
foldlZipWith _ _ u _ [] = u
foldlZipWith f g u (x:xs) (y:ys) = foldlZipWith f g (g u (f x y)) xs ys
foldl1ZipWith::(a -> b -> c) -> (c -> c -> c) -> [a] -> [b] -> c
foldl1ZipWith _ _ [] _ = error "First list is empty"
foldl1ZipWith _ _ _ [] = error "Second list is empty"
foldl1ZipWith f g (x:xs) (y:ys) = foldlZipWith f g (f x y) xs ys
multAdd::(a -> b -> c) -> (c -> c -> c) -> [[a]] -> [[b]] -> [[c]]
multAdd f g xs ys = map (\us -> foldl1ZipWith (\u vs -> map (f u) vs) (zipWith g) us ys) xs
mult:: Num a => [[a]] -> [[a]] -> [[a]]
mult xs ys = multAdd (*) (+) xs ys
 
triangle::(Fractional a, Ord a) => [[a]] -> [[a]] -> (a,[(([a],[a]),Int)])
678

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.