Matrix multiplication in OCAML Please help with a question in OCaml This problem
ID: 3889478 • Letter: M
Question
Matrix multiplication in OCAML
Please help with a question in OCaml
This problem deals with operations on matrices of numbers. To represent matrices, we will use a list of lists of numbers, where the ith list corresponds to the ith row of the matrix. For example, the list
corresponds to a 3 × 3 matrix whose first row has the numbers 3, 17 and 32, whose second row has the numbers 2, 10 and 4 and whose last row has the numbers 7, 5 and 9.
For a list of lists of this kind to qualify as a matrix, every row must have an equal number of columns. Define a function
that returns true or false depending on whether or not the given list of lists of integers represents a "good" matrix.
Define a function
that will generate a new matrix from a given one by multiplying each element by the given number. For example, you should see the following kind of interaction based on this function: