[Haskell-cafe] matrix computations based on the GSL

Keean Schupke k.schupke at imperial.ac.uk
Tue Jul 5 13:37:36 EDT 2005


Henning Thielemann wrote:

>I'm uncertain about how who want to put the different kinds of
>multiplication into one method, even with multi-parameter type classes.
>You need instances
>
> (*) :: Matrix -> Matrix -> Matrix
> (*) :: RowVector -> Matrix -> RowVector
> (*) :: Matrix -> ColumnVector -> ColumnVector
> (*) :: RowVector -> ColumnVector -> Scalar
> (*) :: ColumnVector -> RowVector -> Matrix
> (*) :: Scalar -> RowVector -> RowVector
> (*) :: RowVector -> Scalar -> RowVector
> (*) :: Scalar -> ColumnVector -> ColumnVector
> (*) :: ColumnVector -> Scalar -> ColumnVector
>
>but you have to make sure that it is not possible to write an expression
>which needs
> (*) :: Matrix -> RowVector -> RowVector
>
>Further you need
> transpose :: RowVector -> ColumnVector
> transpose :: ColumnVector -> RowVector
> transpose :: Matrix -> Matrix
>and you must forbid, say
> transpose :: RowVector -> RowVector
>  
>
Of course if they are all of type Matrix this problem disappears. What
is the
difference between a 1xN matrix and a vector? Please explain...

    Keean.


More information about the Haskell-Cafe mailing list