|
Boost Users : |
Subject: Re: [Boost-users] boost::multi_array SWIG binding
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-10 16:09:34
AMDG
NJ Duncan wrote:
> I'm fairly new to C++ and learning as I go, but there is very little info
> out there on my particular problem.
>
> I am trying to turn a model I've written in C++ into a python module
> using SWIG.
> The main problems I'm having are initializing Boost multiarray
> containers then
> getting data into and out of them.
>
> Here is some sample code:
>
> <snip>
>
> Unfortunately I get the following error message:
>
> python: /usr/include/boost/multi_array/multi_array_ref.hpp:481:
> boost::multi_array_ref<T,
> NumDims>& boost::multi_array_ref<T, NumDims>::operator=(const
> ConstMultiArray&)
> [with ConstMultiArray = boost::multi_array<double, 2ul,
> std::allocator<double> >,
> T = double, long unsigned int NumDims = 2ul]: Assertion
> `std::equal(other.shape(),
> other.shape()+this->num_dimensions(), this->shape())' failed.
>
> I think I have assigned the array extents incorrectly,
> but I'm not sure of the proper way to do this as part of a C++ class.
I don't think that's the problem. Something is assuming that
boost::multi_array has a normal assignment operator--it doesn't.
You can only assign multi-arrays that have the same dimensions.
Since there are no assignments in the code you posted, it's hard
to tell where the problem is. If you can get a stack trace from
the assertion, the error will probably be easy to spot.
> Any ideas, I'm starting to pull my hair out, I hope there is a simple
> answer.
In Christ,
Steven Watanabe
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