I am trying to use Haskell's Linear Algebra library to compute some eigenvalues, but first I need to try to add matrices first.
import Numeric.LinearAlgebra.Data
matrix 3 [1,2,3,4,5,6,7,8,9 ] + matrix 3 [1,2,3,4,5,6,7,8,9 ]
(3><3)
[ 2.0, 4.0, 6.0
, 8.0, 10.0, 12.0
, 14.0, 16.0, 18.0 ]
However, if I try to represent another way I get error message
( 3 >< 3 ) [1,2,3,4,5,6,7,8,9 ] + ( 3 >< 3 ) [1,2,3,4,5,6,7,8,9 ]
No instance for (Element a0) arising from a use of ‘print’
The type variable ‘a0’ is ambiguous
I am not even sure about matrix 3 [1,2,3,4,5,6,7,8,9 ]
since I would like to specify that I want a 3 × 3 matrix. Where did the other 3 go?