I'm trying to print this matrix into a file, but for it to be executed into gnuplot I need to create a file without the commas and brackets, how do I do that?
*install hmatrix
*install hmatrix-special
*import Numeric.LinearAlgebra
(5><2)
[ 0.12130139101653795, -3.9532277879855915e-2
, -9.943512129289413e-2, -1.8736674261187188e-2
, 0.21650870755682688, -7.774998273846949e-3
, -0.19540767578866855, -4.889335919164774e-2
, -4.296730149180415e-2, 0.11493730960653939 ]
This will print out the matrix with each row on its own line:
{-# LANGUAGE NoMonomorphismRestriction #-}
import Numeric.LinearAlgebra
m :: Matrix Double
m = (5><2)
[ 0.12130139101653795, -3.9532277879855915e-2
, -9.943512129289413e-2, -1.8736674261187188e-2
, 0.21650870755682688, -7.774998273846949e-3
, -0.19540767578866855, -4.889335919164774e-2
, -4.296730149180415e-2, 0.11493730960653939 ]
printMatrix m = do
putStrLn $ unlines $ map (unwords . map show . toList ) (toRows m)
test = printMatrix m