<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Message: 29<br>
Date: Sat, 6 Nov 2010 13:22:10 +0100<br>
From: Roel van Dijk <<a href="mailto:vandijk.roel@gmail.com">vandijk.roel@gmail.com</a>><br>
Subject: [Haskell-cafe] hmatrix's fitModel function crashes ghc(i)<br>
To: Haskell Caf? <<a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>><br>
Message-ID:<br>
<AANLkTim5eGSL_BZ+RUv-=d-Z3DB65Sc8o=<a href="mailto:cKQLTcyKT4@mail.gmail.com">cKQLTcyKT4@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
Hello,<br>
<br>
I would like to use hmatrix to do some function fitting with the<br>
Levenberg Marquardt algorithm. As an example I would like to fit the<br>
very simple function "f x = a*x + b" on some data points. The problem<br>
is that executing the 'fitModel' function crashes GHC(i) with a<br>
segmentation fault. This makes debugging difficult. Can anyone spot<br>
what I am doing wrong? Given all the lists of Double's it seems very<br>
easy to make an error regarding the number of arguments with the model<br>
function or the derivative.<br>
<br>
Try to evaluate the 'test' function in the small program listed below.<br>
I would expect an output of [1, 0] (y = 1*x + 0) instead of a<br>
segmentation fault.<br>
<br>
Relevant versions:<br>
- hmatrix-0.10.0.0<br>
- gsl-1.14<br>
- ghc-6.12.3 (64 bit)<br>
<br></blockquote><div><br>Is that the 64 bit Linux ghc?<br><br>I think the problem is with the GSL random number generation through GHCi.<br><br>Try:<br><br>> module Test where<br>> <br>> Import Numeric.Container(RandDist,randomVector)<br>
><br>> seed = 0<br>> size = 100<br>> <br>> main = putStrLn $ show $ randomVector seed Gaussian size<br> <br>This should work when compiled with `ghc --make` and crash when invoked in `ghci`.<br><br>I think the problem is with linking static data in GHCi on x86_64.<br>
<br>Hope this helps. I seem to recall there might be a ghc trac ticket related to this but a quick search turned up nothing.<br><br>Cheers,<br><br>Vivian<br></div></div><br>