
On Wed, Jun 29, 2005 at 01:38:51PM +0200, Alberto Ruiz wrote:
Wow! It is exactly the same idea! I did not find the above message by Keean in my google searchs when I decided to work on this, it is very recent! After a quick look to the thread I wish I would have followed the discussions... A much more serious work was in progress. At least it was fun and I have learnt a lot of Haskell...
Your library is far more complete than Keean's is so far, and looks very nice. The one thing I'd like to see (and here I agree with Hennig) is a distinction between matrices and tensors. Your library is really very tensor-based, but tensors and matrices are very different beasts. I imagine one could take your Block, which is really a sort of generalized tensor, and implement a Matrix type such as data Matrix = M (Block Double) (or perhaps for arbitrary element type) with the constructor not exported, so that Matrices will always be guaranteed to be two-dimensional. Then for matrices one could define * to be matrix multiplication, sqrt, exp, cos, sin etc to be matrix functions (expm etc in octave-speak), and then define .* and ./ to be as defined in octave. This definition would allow considerably more type-safeness than your current implementation (which seems scarily dynamically typed to me). Alas, we'd still not have the truly strong typing I'd dream about where one could define matMul :: Int n, m, l => Matrix n m -> Matrix m l -> Matrix n l which as I understand things, isn't possible in Haskell without some sort of weird type trickery. Of course, if you had this kind of type trickery, you might not need to declare a separate Matrix type, since you'd be able to represent the dimensionality of the Block in its type.
And next I will study Keean's library.
And hopefully you and he can work together to create a great library (and I'll be able to mooch off of whatever you create...). :) -- David Roundy http://www.darcs.net