Add multiplication to UE3 A.4

This commit is contained in:
Ivaylo Ivanov 2021-11-04 20:23:12 +01:00
parent 2123b282bc
commit 226d053dca
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,7 @@
> module Angabe3 where
> import Data.List
1. Vervollstaendigen Sie gemaess Angabentext!
2. Vervollst<73>ndigen Sie auch die vorgegebenen Kommentaranf<6E>nge!
3. Loeschen Sie keine Deklarationen aus diesem Rahmenprogramm, auch nicht die Modulanweisug!
@ -109,7 +111,8 @@ Implement each of the num functions for the matrices
> mult :: Matrix -> Matrix -> Matrix
> mult (M m1) (M m2)
> | matrixtyp (M m1) == KeineMatrix || matrixtyp (M m2) == KeineMatrix = fehlerwert
> | otherwise = M ([[0]])
> | length (head m1) /= length m2 = fehlerwert
> | otherwise = M [[ sum $ zipWith (*) x y | y <- (transpose m2) ] | x <- m1]
> negation :: Matrix -> Matrix
> negation (M m1)