static void adjust_size( const container_type &x1 , container_type &x2 ) { if( !same_size( x1 , x2 ) ) resize( x1 , x2 ); }
bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , boost::true_type ) { if ( !same_size( x.m_v , y ) ) { resize( x.m_v , y ); return true; } else return false; }
bool resize( const State &x ) { if( !same_size( x ) ) { m_v.resize( boost::size( x ) ); typename state_type::iterator begin1 = boost::begin( m_v ); typename State::const_iterator begin2 = boost::begin( x ); while( begin1 != boost::end( m_v ) ) (*begin1++).resize( boost::size( *begin2++ ) ); return true; } else return false; }
double distance_Matrix(dcMatrix A, dcMatrix B, double power) { if (!same_size(A,B)) { cout << "ERROR [distance_Matrix]: matrix not the same size!"<<endl; exit(1); } double dist = 0.0; for (unsigned int i=0; i<A.getNbRows(); i++) { for (unsigned int j=0; j<A.getNbCols(); j++) { dist += pow(A(i,j)-B(i,j),power); } } return pow(dist,1.0/power); }
bool same_size_op( const S1 &x1 , const S2 &x2 , boost::true_type ) const { return same_size( x1 , x2 ); }