Keean Schupke k.schupke at imperial.ac.uk
Tue Jun 14 07:54:08 EDT 2005

```David Roundy wrote:

>On Sun, Jun 12, 2005 at 08:00:02PM +0100, Keean Schupke wrote:
>
>
>>- Standard arithmetic operators do standard matrix operations (except
>>"/" is unimplemented - until I write a Gaussian-elimination routine)
>>
>>
>
>It would be nice to at least implement "/" for division by scalars... yes
>one could use ./ for that, but it's less nice.
>
>
Can be done... matrix division also not that hard...

>
>
>>- 'dot' operators '.*' './' do elementwise operations on matrices, and
>>are composed into a matrix level analogue of the
>>    standard Numeric class hierachy.
>>- Any operation involving a scalar applies that operation to each
>>element in the matrix.
>>
>>
>
>Looks nice.
>
>
>
>>- operations in Floating that have no obvious matrix equivalents are
>>applied elementwise (sin/cos/tan)
>>
>>
>
>At least sin and cos do have matrix equivalents (imag(mexp(M)), etc)...
>
>
You learn something everyday... I guess I knew this already as I know
about the power series definitions of
sin and cos... guess I just didn't think about it too much. Would we
rather have:

sin and sinm (elementwise and matrix) - same as matlab

OR

sine and sin (elementwise and matrix) - applies matrix form as 'normal'

OR some other.

>
>
>>- operations in Floating that have matrix equivalents (exp) are applied
>>elementwise for consistancy with the other functions in the Floating
>>class.
>>
>>
>
>Okay... I don't really expect to use mexp anyways (although it *is* handy
>in quantum mechanics, if you can store the entire hamiltonian).
>
>Shouldn't this be an instance of Functor, and have the mmap be called fmap?
>I'd would lean towards making 'exp' be matrix exponentiation.
>
Ah... No.

class Functor m where
fmap :: a -> b -> m a -> m b

But the type of "mmap" is

mmap :: e -> e -> Matrix a i e -> Matrix a i e

in other words we map values to the same type, not a different type.

>
>
>>I will add features as I require them, but if anyone actually wants to
>>use it, I will consider patches and requests for features...
>>
>>
>
>I don't suppose there's a chance you could set up a public darcs repository
>for this?
>
>
>
Yes ... will do.

>>Idea's and improvements greatly appreciated...
>>
>>
>
>One thing that would really help would be a nicer show instance.  As a
>corollary, a read instance would also be nice.
>
>
Definitely, had planned to do this.

Keean.
```