Hi there.

I'm strugling here with some boost python code (damn I hate C++) :

All I want to do is to initialize the content of an array with a numpy
ndarray parameter. I have this, which actually works. But I want to
add some kind of data check such as :

* is array two dimensional ?
* are the dimensions corresponding to map's width / height ?
* is array field with floats or ints ?

void
Layer::set_potentials (numeric::array& array)
{
  for (int h=0; h<map->height; h++){
    for (int w=0; w<map->width; w++){
      units[w+h*map->width]->potential =
extract<float>(array[make_tuple(w,h)]);
    }
  }
}


Some help is very welcome here ... thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to