Add addition, difference and negation to UE3 A.4
This commit is contained in:
parent
32f7a83d2d
commit
2a36ed1de7
@ -95,14 +95,14 @@ Aufgabe A.4
|
||||
> | isEmpty (M m1) || isEmpty (M m2) = fehlerwert
|
||||
> | matrixtyp (M m1) == KeineMatrix || matrixtyp (M m2) == KeineMatrix = fehlerwert
|
||||
> | matrixtyp (M m1) /= matrixtyp (M m2) = fehlerwert
|
||||
> | otherwise = M ([[0]])
|
||||
> | otherwise = M (zipWith (zipWith (+)) m1 m2)
|
||||
|
||||
> diff :: Matrix -> Matrix -> Matrix
|
||||
> diff (M m1) (M m2)
|
||||
> | isEmpty (M m1) || isEmpty (M m2) = fehlerwert
|
||||
> | matrixtyp (M m1) == KeineMatrix || matrixtyp (M m2) == KeineMatrix = fehlerwert
|
||||
> | matrixtyp (M m1) /= matrixtyp (M m2) = fehlerwert
|
||||
> | otherwise = M ([[0]])
|
||||
> | otherwise = M (zipWith (zipWith (-)) m1 m2)
|
||||
|
||||
> mult :: Matrix -> Matrix -> Matrix
|
||||
> mult (M m1) (M m2)
|
||||
@ -114,16 +114,16 @@ Aufgabe A.4
|
||||
> negation (M m1)
|
||||
> | isEmpty (M m1)= fehlerwert
|
||||
> | matrixtyp (M m1) == KeineMatrix = fehlerwert
|
||||
> | otherwise = M ([[0]])
|
||||
> | otherwise = M (map (map ((-1)*)) m1)
|
||||
|
||||
> absolute :: Matrix -> Matrix
|
||||
> absolute (M m1)
|
||||
> | isEmpty (M m1)= fehlerwert
|
||||
> | matrixtyp (M m1) == KeineMatrix = fehlerwert
|
||||
> | otherwise = M ([[0]])
|
||||
> | otherwise = M (map (map (abs)) m1)
|
||||
|
||||
> sign :: Matrix -> Matrix
|
||||
> sign (M m1)
|
||||
> | isEmpty (M m1)= fehlerwert
|
||||
> | matrixtyp (M m1) == KeineMatrix = fehlerwert
|
||||
> | isEmpty (M m1)= error "Vorzeichenfunktion undefiniert"
|
||||
> | matrixtyp (M m1) == KeineMatrix = error "Vorzeichenfunktion undefiniert"
|
||||
> | otherwise = M ([[0]])
|
||||
|
Reference in New Issue
Block a user