Haskell Matrix Library...

Keean Schupke k.schupke at imperial.ac.uk
Tue Jun 28 06:22:35 EDT 2005

Marcin 'Qrczak' Kowalczyk wrote:

>Benjamin Franksen <benjamin.franksen at bessy.de> writes:
>>BTW, isn't Matrix a functor over Num so we can use fmap for lifting?
>>Ah, doesn't work because of the extra Num constraint, grrr...
>I see no need of putting the Num constraint on the type definition.
>fmap will work.
Hmm... It appears I was being dense (or a perfectionist) as I couldn't
define a generic instance of
Functor for all Matrices generalised over Array type. Of course the
solution is just to define an instance
for each array type...

Here's the latest version ... now smaller with the Floating instance
removed, but an instance of Functor added,
and a better Show instance (that generates valid Haskell using the
constructor functions provided)... Have also
removed the Matlab style "scalar" by "matrix" operations, so to multiply
a scalar by each element use fmap
(or mmap)

    fmap (+1) matrix

I guess in the end it's just more Haskell like - even if it is harder to
read than the Matlab code.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Matrix.zip
Type: application/zip
Size: 12140 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/libraries/attachments/20050628/d12bcb03/Matrix.zip

More information about the Libraries mailing list