Linear Algebra Lab

We can represent vectors as Array[Double] and matrices as Array[Array[Double]].

Complete the implementation of LinearAlgebra.scala.

Notes

·       Don't use fancy pre-defined array methods. The point of this lab is to gain experience using for-loops.

·       Do not assume matrices must be square, N x M matrices are allowed. But the dim method, which returns the dimension of a matrix as a pair of integers, should throw an exception if all of the rows of the matrix do not have the same length. Also, do not assume constant values for N or M.

·       Throw an exception if the dimensions don't match. For example, only vectors of dimension N can be multiplied by a matrix of dimension N x M. Notice that the last line of the test harness threw an exception for this reason.

·       Consult a linear algebra text if you're unsure of what these methods do.

·       Extending LinearAlgebraUtils means we don't need to qualify the names of functions in the demo code.