Hi to all,
i wrote a class (Influx), where i try to define there a
boost::multi_arry occ_sign_change.
Once i tried in Influx::Influx to write:
occ_sign_change = vec::uint32_1d_t ( boost::extents[ num_elements ] );
i was able to compile, but at run time i got the following error:
randum.rc3_64: /usr/include/boost/multi_array/multi_array_ref.hpp:487:
boost::multi_array_ref& boost::multi_array_ref::operator=(const ConstMultiArray&) [with ConstMultiArray =
boost::multi_array, T =
unsigned int, long unsigned int NumDims = 1ul]: Assertion
`std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape())' failed.
that is why i rewrote the above line as following:
vec::uint32_1d_t occ_sign_change ( boost::extents[ num_elements ] );
but now, when i call for the size of occ_sign_change in Influx::Clean, i get
that the size is zero.
how could i solve this problem?
regards
#include
#include
#include "randum.rc3.hpp"
namespace vec {
typedef boost::multi_array< uint32_t , 1> uint32_1d_t;
typedef boost::multi_array< uint32_t , 2> uint32_2d_t;
typedef boost::multi_array< uint32_t , 3> uint32_3d_t;
typedef boost::multi_array< uint32_t , 1> uint32_1d_t;
typedef boost::multi_array< uint32_t , 2> uint32_2d_t;
typedef boost::multi_array< double , 1> double_1d_t;
typedef boost::multi_array< double , 2> double_2d_t;
typedef uint32_1d_t::index index_t;
}
class Influx {
public:
Influx ( uint32_t num_elements , double p_, double kappa_ ,
vec::uint32_2d_t *Pointer_ , threshold_t threshold_ , uint32_t num_bits ,
uint16_t max_runs_ );
void Update ();
void Validity ( const uint32_t i );
void Clean( uint32_t run );
boost::dynamic_bitset<> occupied;
vec::uint32_1d_t occupied_counter;
vec::uint32_1d_t num_neighbours;
vec::uint32_1d_t occ_sign_change;
private:
std::vector< uint32_t > remove_node_v;
vec::uint32_2d_t *Pointer;
std::vector< uint32_t > num_neighbours_epoch;
double p;
double kappa;
threshold_t threshold;
uint16_t max_runs;
uint32_t bits_mask;
uint32_t complement_num;
};
Influx::Influx ( uint32_t num_elements , double p_, double kappa_ ,
vec::uint32_2d_t *Pointer_ , threshold_t threshold_ , uint32_t num_bits ,
uint16_t max_runs_ ) {
bits_mask = ( 1 << num_bits ) - 1;
Pointer = Pointer_;
p = p_;
kappa = kappa_;
threshold = threshold_;
max_runs = max_runs_;
complement_num = 0;
num_neighbours_epoch = std::vector< uint32_t > ( num_elements , 0);
occupied = boost::dynamic_bitset<> ( num_elements , 0 ); // all 0's by
default
vec::uint32_1d_t occupied_counter ( boost::extents[ num_elements ] );
vec::uint32_1d_t occ_sign_change ( boost::extents[ num_elements ] );
vec::uint32_1d_t num_neighbours ( boost::extents[ num_elements ] );
remove_node_v.reserve( num_elements );
std::fill_n( occupied_counter.begin() , occupied_counter.num_elements()
, 0 );
std::fill_n( occ_sign_change.begin() , occ_sign_change.num_elements()
, 0 );
std::fill_n( num_neighbours.origin() , num_neighbours.num_elements()
, 0 );
}
void Influx::Clean ( uint32_t run ) {
for ( vec::uint32_1d_t::size_type i = 0 ; i < remove_node_v.size() ; i++
) {
occupied[ remove_node_v[i] ] = 0;
if ( run >= max_runs ) {
std::cout << "size occ_sign_change: " << occ_sign_change.size()
<< std::endl;
occ_sign_change[ remove_node_v[i] ]++;
}
}
remove_node_v.clear();
}