Boost logo

Boost Users :

Subject: [Boost-users] [Math/Statistical Distributions] Help on using distributions' global accessors
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-06-04 09:40:09


Dear Boost users,

I don't understand why the code in the attached file
"test_distributions_ko.zip" does not work. :(

It compiles without problems, but as I run it I get the following
error as soon as the *variance* accessor is called:

--- [error] ---
Running 2 test cases...
...
unknown location(0): fatal error in "exponential_distribution": memory
access violation at address: 0x7fffa6254ff8: no mapping at fault
address
test.cpp(34): last checkpoint

*** 1 failure detected in test suite "test::stats test suite"
--- [/error] ---

I've also tried to replace the use of inheritance with the removal of
class "exponential_distribution" and directly injecting inside my
namespace the Boost one, that is:
namespace test { namespace stats {
  using ::boost::math::exponential_distribution;
  using ::boost::math::exponential;
}}
but without success.

Instead, the error *disappear* if I use the code in
"test_distributions_ok.zip", where instead of using inheritance and
"injection" I use membeship (i.e., composition). Why?

My compiler is GCC 4.3.2 and my system is Fedora 10 x86_64.

If you want to try the attached code you can simply type 'make' from
your shell (provided you have a unix like system) and then run the
command "./test".

A note about the code: you may ask yourself why I'm redefining some
functions already defined by the Boost library.
The reason lies in the fact that my final goal is to create a wrapping
library in order to change without pain the underlying real
implementation.

An help or a hint would be very very very appreciated!! :)

Thank you very much!

-- Marco





Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net