Boost logo

Ublas :

From: Ian McCulloch (ianmcc_at_[hidden])
Date: 2006-06-06 10:39:34


dvir schirman wrote:

> ok here is my code:

The problem has nothing to do with uBLAS.

>
> main.C
> --------------
> #include "tdagent.H"
>
> #include
> "simple_env.H"
>
> #include
> <iostream.h>
>
> #include
> <vector>
>
> int
> main()
>
> {
>
> simple_env *env;

At the point, env is an uninitialized pointer to a simple_env. In general,
it is a good idea to initialize variables at the point of declaration, for
example "simple_env* env = new simple_env();"

>
> tdagent *agent;
>
> boost::numeric::ublas::vector<
> float> aaa;
>
> aaa.resize(3);
>
> std::vector<
> float> uu;
>
> env->create();

Here, you are calling a member function via an uninitialized pointer.
Anything could happen; as the old saying goes, you are lucky it didn't
reformat your harddrive.

Cheers,
Ian