hmatrix's fitModel function crashes ghc(i)

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

On 7 November 2010 15:19, Vivian McPhail
Message: 29
Date: Sat, 6 Nov 2010 13:22:10 +0100 From: Roel van Dijk
Subject: [Haskell-cafe] hmatrix's fitModel function crashes ghc(i) To: Haskell Caf? Message-ID: Content-Type: text/plain; charset=UTF-8 Hello,
I would like to use hmatrix to do some function fitting with the Levenberg Marquardt algorithm. As an example I would like to fit the very simple function "f x = a*x + b" on some data points. The problem is that executing the 'fitModel' function crashes GHC(i) with a segmentation fault. This makes debugging difficult. Can anyone spot what I am doing wrong? Given all the lists of Double's it seems very easy to make an error regarding the number of arguments with the model function or the derivative.
I think the problem is with linking static data in GHCi on x86_64.
Hope this helps. I seem to recall there might be a ghc trac ticket related to this but a quick search turned up nothing.
Here's the ticket:
http://hackage.haskell.org/trac/ghc/ticket/781 They aim to fix the problem (with fPIC) by ghc 7.2. Cheers, Vivian

Thank you for your reply. I will follow progress on the ticket.
On Mon, Nov 8, 2010 at 3:57 AM, Vivian McPhail
Here's the ticket:
http://hackage.haskell.org/trac/ghc/ticket/781
They aim to fix the problem (with fPIC) by ghc 7.2.
Cheers,
Vivian
participants (2)
-
Roel van Dijk
-
Vivian McPhail