
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

ITK 327, Fall 2008 Assignment 5, 40 points
Write ML functions for the following problems and save them in asg5.sml. As usual, follow the instructions given for the previous assignments to submit a soft-copy of your works through the web-submit. You also have to submit a hard-copy of your programs. Use the same function names required in the problems.
Part I. Chapter 9 Exercises: 3, 6, 10, 26, 27, and 28.
Part II.
Part III. (Extra Bonus: 10 points) Write a function matrixMult of type
int list list * int list list -> int list list
to perform a matrix multiplication. The matrix multiplication is given as follows:
Mm×n =
a 1 , 1 a 1 , 2 · · · a 1 ,j · · · a 1 ,n a 2 , 1 a 2 , 2 · · · a 2 ,j · · · a 2 ,n .. .
.. .
.. .
.. .
.. .
.. . ai, 1 ai, 2 · · · ai,j · · · ai,n .. .
.. .
.. .
.. .
.. .
.. . am, 1 am, 2 · · · am,j · · · am,n
The ith^ row of M forms a vector (ai, 1 , ai, 2 , · · · · · · , ai,n) called ith^ row-vector of M. Likewise, the jth^ column of M forms a vector (a 1 ,j , a 2 ,j , · · · · · · , am,j ) called jth^ column-vector of M.
For our ML function, let a int list represent a row-vector of a matrix. Thus, a list of vectors represents a matrix. I.e, a matrix is of type int list list. For example, let A be [[1,2],[3,4]]. Then A is a 2 × 2 matrix, and matrixMult (A,A) should return [[7,10], [15,22]] because of the following calculation. [ 1 2 3 4
Due: Oct. 30, Thursday ©c Chung-Chih Li P-