[Haskell-cafe] matrix computations based on the GSL

Henning Thielemann lemming at henning-thielemann.de
Fri Jul 8 05:29:37 EDT 2005


On Fri, 8 Jul 2005, Alberto Ruiz wrote:

> The server is working again.
>
> On Thursday 07 July 2005 20:58, Alberto Ruiz wrote:
> > I' sorry, our web server is temporarily down :-(
> >
> > >
> > > http://dis.um.es/~alberto/hmatrix/matrix.html

I would remove the 'matrix' portions of the function names, since this
information is already contained in the module name. E.g. after importing
LinearAlgebra.Matrix as Matrix, Matrix.matrix look strange, but
Matrix.fromList says everything.

I suggest

 matrix         -> fromList
 matrixElements -> toList
 displayMatrix  -> display
 readMatrix  -> fromFile :: FilePath -> IO Matrix
 writeMatrix -> toFile :: FilePath -> Matrix -> IO ()
 blockMatrix -> fromBlocks or fromMatrices
 subMatrix   -> clip or cut or take
 matrixScale  -> scale
 matrixOffset -> offset
 matrixAdd    -> add
 matrixSub    -> sub
 matrixMul    -> mul  (element-wise multiplication?
          then better zipMul or elementwiseMul, elMul what know I :-)
 matrixDiv    -> div
 matrixSigns  -> signs
 matrixAbs    -> abs
 matrix_x_matrix  ... hm difficult
 matrix_x_vector
 vector_x_matrix

 msin :: Matrix -> Matrix
 mcos :: Matrix -> Matrix
 mtan :: Matrix -> Matrix
 masin :: Matrix -> Matrix
 macos :: Matrix -> Matrix
 matan :: Matrix -> Matrix
 matan2 :: Matrix -> Matrix -> Matrix
 msinh :: Matrix -> Matrix
 mcosh :: Matrix -> Matrix
 mtanh :: Matrix -> Matrix
 masinh :: Matrix -> Matrix
 macosh :: Matrix -> Matrix
 matanh :: Matrix -> Matrix
 mexp :: Matrix -> Matrix
 mlog :: Matrix -> Matrix

If there are no efficiency concerns, I would drop element-wise operations
and prefer a matrix-map and a matrix-zipWith. If these operations shall
remain I would somehow point to their element-wise operation in the name.



More information about the Haskell-Cafe mailing list