[Haskell-cafe] Matrices

Cetin Sert cetin.sert at gmail.com
Sun Apr 19 05:53:43 EDT 2009


http://ccnmtl.columbia.edu/projects/qmss/the_chisquare_test/about_the_chisquare_test.html

given two matrices,

Prelude Data.Matrix.Dense Data.Vector.Dense> m
listMatrix (2,2) [46.0,37.0,71.0,83.0]
Prelude Data.Matrix.Dense Data.Vector.Dense> es
listMatrix (2,2)
[40.9746835443038,42.0253164556962,76.0253164556962,77.9746835443038]

how can I flatten them to do:
[ (o-e)^2 / e | o <- m, e <- es ]

or use a function that will apply a given function to every
corresponding elements of 2 or n matrices and create a result matrix?

If I should use a different matrix type or library altogether, please
specify which one and how ^__^"

Best Regards,
Cetin Sert


More information about the Haskell-Cafe mailing list