Blog Closed

This blog has moved to Github. This page will not be updated and is not open for comments. Please go to the new site for updated content.

Friday, April 18, 2008

Matrices

I did some work last night on my matrix class for Octave. It's going along pretty well although much of my code is pretty sloppy. I stayed up pretty late last night working on it, and the result is not the best looking nor most consistent code I've ever written.

I've got basic elements in place. I can create new matrices of any size. I can determine when a matrix is a vector (and I can separate between row and column vectors), I can determine when a matrix is a scalar. I can add two matrices, multiply, subtract. I can negate a matrix, transpose it, or scalar multiply it. I can test two matrices for equality.

The next big operation to support is the determinant. However, this is composed of smaller operations which I would need to implement first. Also, there are more then one way to do it:
  1. The classic is Laplacian decomposition. This would be relatively easy to implement. I would need to create a function to compute minors, which in turn would require me to compute cofactors. This would be recursive, and would be inefficient for large matrices.
  2. A better idea would be LU decomposition. This would require me to write up gaussian row operation functions, row reduction algorithms, and a simple trace.
  3. Also good would be QR decomposition, which would provide a good head start for eigen decomposition later on. This would require an implementation using either gram-schmidt orthonormalization, householder reflections, or givens rotations. Gram-schmidt would probably not be too difficult since I already have vector dot-products (but no vector 2-norms yet).
Either option two or 3 would be good, and the sub-steps would set me up nicely for later work on eigen decomposition or matrix inversion. Of course, we are getting to the point where I may want to do the rest of the development work using Octave and not PIR as I have been doing. Between me and that goal, however, is integrating this new matrix class into the octave parser.

I'm not planning to do any of the rest of this today, or even next week because of the final cleanup work that I need to do on my thesis source code. I have to clean some of the code up (add a lot of comments which are sorely needed), and work out a few kinks. Ideally, this won't take me too too long

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.