Gaussian elimination: Difference between revisions
Content added Content deleted
m (→From scratch) |
m (→From scratch) |
||
Line 1,418: | Line 1,418: | ||
isMatrix xs = null xs || all ((== (length.head $ xs)).length) xs |
isMatrix xs = null xs || all ((== (length.head $ xs)).length) xs |
||
isSquareMatrix xs = null xs || all ((== (length xs)).length) xs |
|||
multiply:: Num a => [[a]] -> [[a]] -> [[a]] |
multiply:: Num a => [[a]] -> [[a]] -> [[a]] |
||
Line 1,433: | Line 1,433: | ||
solveGauss:: (Fractional a, Ord a) => [[a]] -> [[a]] -> [[a]] |
solveGauss:: (Fractional a, Ord a) => [[a]] -> [[a]] -> [[a]] |
||
solveGauss xs bs | null xs || null bs || length xs /= length bs || (not $ |
solveGauss xs bs | null xs || null bs || length xs /= length bs || (not $ isSquareMatrix xs) || (not $ isMatrix bs) = [] |
||
| otherwise = uncurry solveTriangle $ triangle xs bs |
| otherwise = uncurry solveTriangle $ triangle xs bs |
||