Sunday 27 November 2011

The Matrix, Is Out There

After getting started with the new matrix implementations, having the input parameters as a list of matrices is turning out to be a bit more of a pain than anticipated.

The main downside is the fact that we now have to iterate through the list of matrices in order to perform add(), subtract(), multiply() on each.  We also have to save the results of the previous additions and pass those on for the next set. Something like this:





I haven't run any speed tests but this seems like it may be slow, but for now it will have to do.

Now for my two concerns regarding the API and reality.

  1. Our add(), subtract(), and multiply() functions all take 2 parameters, ml, the list of matrices and result, the optional variable in which we will store our result.  The API specifies that if the list is only one matrix long then we will return the one matrix.  What if the result parameter has values in it and the list only has one matrix? then we will not add the two properly.  Maybe this will never happen, ill wait to ask in iRC.
  2. The inverse(m) function returns the inverse of the given matrix.  A square matrix will only have an inverse if the determinant of that matrix is not zero.  This situation is not covered in the api.
That is about it for now, going to get these cleared up and then move forward.

No comments:

Post a Comment