[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Seg faults and altered parameters using vector views

From: Brian Gough
Subject: Re: [Help-gsl] Seg faults and altered parameters using vector views
Date: Tue, 09 Jan 2007 20:07:12 +0000
User-agent: Wanderlust/2.14.0 (Africa) Emacs/21.3 Mule/5.0 (SAKAKI)

At Thu, 4 Jan 2007 17:59:44 -0500,
Michael Braun wrote:
> I am having some trouble working with vector views, and I am hoping someone 
> can point me in the right direction (I am a relatively new C programmer, so I 
> am still learning some new tricks).
> Below is a function that computes the log density of a multivariate normal 
> distribution using gsl vectors and matrices.  The eventual result is correct 
> (i.e., consistent with other sources).  The problem is that the matrix sigma 
> is changed in the calling function (the top left corner element changes to 
> something else).  I find this odd, since I never change any part of sigma in 
> this function.
> In addition, I draw your attention to the two fprintf statements in the lines 
> marked A and B.  If both are commented out, there is no problem other than 
> what I just described.  If the fprintf statement is inserted at line A *or 
> before*, again there is no additional problem.  However, if I call the 
> fprintf function at line B or later, I get a segmentation fault with the 
> message 
>        *** caught segfault ***
>       address 0x4, cause 'memory not mapped'


For memory problems I'd recommend the testing the code with the
'valgrind' memory checker. e.g.

  $ valgrind --tool=memcheck a.out

It should help in tracking down any errors.

best regards,

Brian Gough
(GSL Maintainer)

Network Theory Ltd,
Commercial support for GSL ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]