std::vector<typename Observator::observable_type> Metropolis<ConfigurationType, Step, RandomNumberGenerator>::do_metropolis_simulation(const TemperatureType& beta) { // Check the concept of the observator BOOST_CONCEPT_ASSERT((Concepts::ObservatorConcept<Observator,ConfigurationType>)); // Check the concept of the observable BOOST_CONCEPT_ASSERT((Concepts::ObservableConcept<typename Observator::observable_type>)); // Call the accumulator function using the VectorAccumulator Details::Metropolis::VectorAccumulator<typename Observator::observable_type> measurements_accumulator; do_metropolis_simulation<Observator>(beta, measurements_accumulator); // Return the plain data return measurements_accumulator.internal_vector; }
bool add_edge_aggregator(const std::string& key, EdgeMapType map_function, FinalizerType finalize_function) { BOOST_CONCEPT_ASSERT((graphlab::Serializable<ReductionType>)); BOOST_CONCEPT_ASSERT((graphlab::OpPlusEq<ReductionType>)); aggregator_type* aggregator = get_aggregator(); if(aggregator == NULL) { logstream(LOG_FATAL) << "Aggregation not supported by this engine!" << std::endl; return false; // does not return } return aggregator->template add_edge_aggregator<ReductionType> (key, map_function, finalize_function); } // end of add edge aggregator
typename range_value_type<CVsRange>::type evaluate( std::size_t degree, const CVsRange& cvs, const KnotsRange& knots, typename range_value_type<KnotsRange>::type u) { BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<CVsRange>)); BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<KnotsRange>)); std::size_t span = find_span( degree, boost::size( cvs), knots, u); boost::array<typename range_value_type<KnotsRange>::type, NURBS_MAX_BASIS_DEGREE> N; basis_functions( degree, u, span, knots, N.begin()); return evaluate( degree, cvs, N, span, u); }
inline void all_degree_centralities(const Graph& g, CentralityMap cent, Measure measure) { BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> )); typedef typename graph_traits<Graph>::vertex_descriptor Vertex; typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<CentralityMap,Vertex> )); typedef typename property_traits<CentralityMap>::value_type Centrality; VertexIterator i, end; for(boost::tie(i, end) = vertices(g); i != end; ++i) { Centrality c = degree_centrality(g, *i, measure); put(cent, *i, c); } }
void check_nsphere(S& to_check, RT radius, CT center_x, CT center_y, CT center_z) { BOOST_CONCEPT_ASSERT( (bg::concept::ConstNsphere<S>) ); BOOST_CONCEPT_ASSERT( (bg::concept::Nsphere<S>) ); BOOST_CHECK_EQUAL(bg::get_radius<0>(to_check), radius); BOOST_CHECK_EQUAL(bg::get<0>(to_check), center_x); BOOST_CHECK_EQUAL(bg::get<1>(to_check), center_y); if (bg::dimension<S>::value >= 3) { BOOST_CHECK_EQUAL(bg::get<2>(to_check), center_z); } }
void run_d_ary_heap_test(void) { typedef boost::heap::d_ary_heap<int, boost::heap::arity<D>, boost::heap::stable<stable>, boost::heap::compare<std::less<int> >, boost::heap::allocator<std::allocator<int> > > pri_queue; BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<pri_queue>)); run_concept_check<pri_queue>(); run_common_heap_tests<pri_queue>(); run_iterator_heap_tests<pri_queue>(); run_copyable_heap_tests<pri_queue>(); run_moveable_heap_tests<pri_queue>(); run_reserve_heap_tests<pri_queue>(); run_merge_tests<pri_queue>(); run_ordered_iterator_tests<pri_queue>(); if (stable) { typedef boost::heap::d_ary_heap<q_tester, boost::heap::arity<D>, boost::heap::stable<stable> > stable_pri_queue; run_stable_heap_tests<stable_pri_queue>(); } #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) cmpthings ord; boost::heap::d_ary_heap<thing, boost::heap::arity<D>, boost::heap::compare<cmpthings>, boost::heap::stable<stable> > vpq(ord); vpq.emplace(5, 6, 7); #endif }
point_angle_compare( const Point& origin, const NumberComparisonPolicy& cmp = NumberComparisonPolicy() ) : m_origin( origin ) , m_reference( 1., 0. ) , m_cmp(cmp) { BOOST_CONCEPT_ASSERT((Point2DConcept<Point>)); }
inline typename graph_traits<Graph>::degree_size_type possible_edges(const Graph& g, std::size_t k, directed_tag) { BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> )); typedef typename graph_traits<Graph>::degree_size_type T; return T(k) * (T(k) - 1); }
inline typename property_traits<ClusteringMap>::value_type mean_clustering_coefficient(const Graph& g, ClusteringMap cm) { BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> )); typedef typename graph_traits<Graph>::vertex_descriptor Vertex; typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<ClusteringMap,Vertex> )); typedef typename property_traits<ClusteringMap>::value_type Coefficient; Coefficient cc(0); VertexIterator i, end; for(boost::tie(i, end) = vertices(g); i != end; ++i) { cc += get(cm, *i); } return cc / Coefficient(num_vertices(g)); }
color3_t<typename range::value_type<ConstRandomAccessRange>::type, xyz_t> spectral_to_xyz( const CieXYZCurves& cie_xyz_curves, T min_wavelength, T max_wavelenght, const ConstRandomAccessRange& values) { BOOST_CONCEPT_ASSERT(( CieXYZFit<CieXYZCurves>)); typedef typename boost::range_iterator<const ConstRandomAccessRange>::type iterator_type; typedef typename range::value_type<ConstRandomAccessRange>::type real_type; std::size_t num_samples = boost::size( values); real_type w = min_wavelength; real_type w_step = max_wavelenght - min_wavelength / static_cast<real_type>( num_samples); color3_t<real_type, xyz_t> result( 0); for( iterator_type it( boost::begin( values)), e( boost::end( values)); it != e; ++it) { iterator_type next( it + 1); if( next != e) { real_type avg(( *it + *next) * real_type( 0.5)); result.x += cie_xyz_curves.X( w) * avg; result.y += cie_xyz_curves.Y( w) * avg; result.z += cie_xyz_curves.Z( w) * avg; } w += w_step; } return result; }
void run_d_ary_heap_mutable_test(void) { typedef boost::heap::d_ary_heap<int, boost::heap::mutable_<true>, boost::heap::arity<D>, boost::heap::stable<stable> > pri_queue; BOOST_CONCEPT_ASSERT((boost::heap::MutablePriorityQueue<pri_queue>)); run_common_heap_tests<pri_queue>(); run_moveable_heap_tests<pri_queue>(); run_reserve_heap_tests<pri_queue>(); run_mutable_heap_tests<pri_queue>(); run_merge_tests<pri_queue>(); run_ordered_iterator_tests<pri_queue>(); if (stable) { typedef boost::heap::d_ary_heap<q_tester, boost::heap::mutable_<true>, boost::heap::arity<D>, boost::heap::stable<stable> > stable_pri_queue; run_stable_heap_tests<stable_pri_queue>(); } }
void constraints() { BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> )); vis.examine_vertex(u,g); vis.finish_vertex(u,g); vis.examine_edge(e,g); }
static void apply(ApplyMethod) { typedef typename parameter_type_of < ApplyMethod, 0 >::type ptype; typedef typename parameter_type_of < ApplyMethod, 1 >::type sptype; // 1) must define meta-function return_type typedef typename strategy::distance::services::return_type<Strategy, ptype, sptype>::type rtype; // 2) must define underlying point-distance-strategy typedef typename strategy::distance::services::strategy_point_point<Strategy>::type stype; BOOST_CONCEPT_ASSERT ( (concept::PointDistanceStrategy<stype, Point, PointOfSegment>) ); Strategy *str = 0; ptype *p = 0; sptype *sp1 = 0; sptype *sp2 = 0; rtype r = str->apply(*p, *sp1, *sp2); boost::ignore_unused_variable_warning(str); boost::ignore_unused_variable_warning(r); }
void depth_first_search(const VertexListGraph& g, DFSVisitor vis, ColorMap color, typename graph_traits<VertexListGraph>::vertex_descriptor start_vertex) { typedef typename graph_traits<VertexListGraph>::vertex_descriptor Vertex; BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, VertexListGraph> )); typedef typename property_traits<ColorMap>::value_type ColorValue; typedef color_traits<ColorValue> Color; typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end; for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { Vertex u = implicit_cast<Vertex>(*ui); put(color, u, Color::white()); vis.initialize_vertex(u, g); } if (start_vertex != implicit_cast<Vertex>(*vertices(g).first)){ vis.start_vertex(start_vertex, g); detail::depth_first_visit_impl(g, start_vertex, vis, color, detail::nontruth2()); } for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { Vertex u = implicit_cast<Vertex>(*ui); ColorValue u_color = get(color, u); if (u_color == Color::white()) { vis.start_vertex(u, g); detail::depth_first_visit_impl(g, u, vis, color, detail::nontruth2()); } } }
void run_d_ary_heap_test(void) { typedef boost::heap::d_ary_heap<int, boost::heap::arity<D>, boost::heap::stable<stable>, boost::heap::compare<std::less<int> >, boost::heap::allocator<std::allocator<int> > > pri_queue; BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<pri_queue>)); run_concept_check<pri_queue>(); run_common_heap_tests<pri_queue>(); run_iterator_heap_tests<pri_queue>(); run_copyable_heap_tests<pri_queue>(); run_moveable_heap_tests<pri_queue>(); run_reserve_heap_tests<pri_queue>(); run_merge_tests<pri_queue>(); run_ordered_iterator_tests<pri_queue>(); if (stable) { typedef boost::heap::d_ary_heap<q_tester, boost::heap::arity<D>, boost::heap::stable<stable> > stable_pri_queue; run_stable_heap_tests<stable_pri_queue>(); } }
BOOST_AUTO_TEST_CASE_TEMPLATE(Iterator, T, InMemoryStorages) { T ims; BOOST_CONCEPT_ASSERT((boost::InputIterator<InMemoryStorage::const_iterator>)); for (int i = 0; i < 10; i++) { std::ostringstream convert; convert << i; Name name("/" + convert.str()); shared_ptr<Data> data = makeData(name); ims.insert(*data); } InMemoryStorage::const_iterator it = ims.begin(); InMemoryStorage::const_iterator tmp1 = it; BOOST_REQUIRE(tmp1 == it); InMemoryStorage::const_iterator tmp2 = tmp1++; BOOST_REQUIRE(tmp2 != tmp1); tmp2 = ++tmp1; BOOST_REQUIRE(tmp2 == tmp1); int i = 0; for (;it != ims.end(); it++) { std::ostringstream convert; convert << i; Name name("/" + convert.str()); BOOST_CHECK_EQUAL(it->getName(), name); BOOST_CHECK_EQUAL((*it).getName(), name); i++; } }
inline void write_graphviz (std::ostream& out, const Graph& g, VertexPropertiesWriter vpw, EdgePropertiesWriter epw, GraphPropertiesWriter gpw, VertexID vertex_id BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { BOOST_CONCEPT_ASSERT((EdgeListGraphConcept<Graph>)); typedef typename graph_traits<Graph>::directed_category cat_type; typedef graphviz_io_traits<cat_type> Traits; std::string name = "G"; out << Traits::name() << " " << name << " {" << std::endl; gpw(out); //print graph properties typename graph_traits<Graph>::vertex_iterator i, end; for(tie(i,end) = vertices(g); i != end; ++i) { out << get(vertex_id, *i); vpw(out, *i); //print vertex attributes out << ";" << std::endl; } typename graph_traits<Graph>::edge_iterator ei, edge_end; for(tie(ei, edge_end) = edges(g); ei != edge_end; ++ei) { out << get(vertex_id, source(*ei, g)) << Traits::delimiter() << get(vertex_id, target(*ei, g)) << " "; epw(out, *ei); //print edge attributes out << ";" << std::endl; } out << "}" << std::endl; }
void test_all_2d() { P1 p; P2 sp1, sp2; bg::read_wkt("POINT(1 1)", p); bg::read_wkt("POINT(0 0)", sp1); bg::read_wkt("POINT(2 3)", sp2); typedef typename bg::strategy::distance::projected_point < P1, P2 > strategy_type; BOOST_CONCEPT_ASSERT ( (bg::concept::PointSegmentDistanceStrategy<strategy_type>) ); strategy_type strategy; typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type; return_type d = strategy.apply(p, sp1, sp2); BOOST_CHECK_CLOSE(d, return_type(0.27735203958327), 0.001); }
void test_distance(double lon1, double lat1, double lon2, double lat2, double expected_km) { // Set radius type, but for integer coordinates we want to have floating point radius type typedef typename bg::promote_floating_point < typename bg::coordinate_type<P1>::type >::type rtype; typedef bg::srs::spheroid<rtype> stype; typedef bg::strategy::distance::thomas<stype> thomas_type; BOOST_CONCEPT_ASSERT ( (bg::concepts::PointDistanceStrategy<thomas_type, P1, P2>) ); thomas_type thomas; typedef typename bg::strategy::distance ::services::return_type<thomas_type, P1, P2>::type return_type; P1 p1; P2 p2; bg::assign_values(p1, lon1, lat1); bg::assign_values(p2, lon2, lat2); BOOST_CHECK_CLOSE(thomas.apply(p1, p2), return_type(1000.0 * expected_km), 0.001); BOOST_CHECK_CLOSE(bg::distance(p1, p2, thomas), return_type(1000.0 * expected_km), 0.001); }
std::vector<typename Observator::observable_type> Metropolis<ConfigurationType, Step, RandomNumberGenerator>::autocorrelation_function(const TemperatureType& beta, unsigned int maximal_time, unsigned int simulation_time_factor) { // Check the concept of the observator BOOST_CONCEPT_ASSERT((Concepts::ObservatorConcept<Observator,ConfigurationType>)); // Check the concept of the observable BOOST_CONCEPT_ASSERT((Concepts::ObservableConcept<typename Observator::observable_type>)); // Do the relaxation steps do_metropolis_steps(simulation_parameters.relaxation_steps, beta); // Define the vector with the results std::vector<typename Observator::observable_type> results; // Define the vector with the measurments of the observable and take the measurements std::vector<typename Observator::observable_type> observable_measurements; for (unsigned int i = 0; i <= maximal_time*simulation_time_factor; ++i) { do_metropolis_steps(this->get_config_space()->system_size(), beta); observable_measurements.push_back(Observator::observe(this->get_config_space())); } // Define an accumulator and calculate the mean value of the observable ba::accumulator_set<typename Observator::observable_type, ba::stats<ba::tag::mean> > acc_measured_mean(observable_measurements[0]); for (unsigned int i = 0; i <= maximal_time*simulation_time_factor; ++i) { acc_measured_mean(observable_measurements[i]); } typename Observator::observable_type measured_mean = ba::mean(acc_measured_mean); // Calculate the autocorrelation function using an accumulator for (unsigned int time = 0; time <= maximal_time; ++time) { // Calculate the mean autocorrelation function for time ba::accumulator_set<typename Observator::observable_type, ba::stats<ba::tag::mean> > acc_autocorrelation_function_time(observable_measurements[0]); for (unsigned int sweep = 0; sweep < simulation_time_factor; ++sweep) { unsigned int start_time = sweep*maximal_time; acc_autocorrelation_function_time(observable_measurements[start_time]*observable_measurements[start_time + time]); } // Add to the result vector results.push_back(ba::mean(acc_autocorrelation_function_time) - measured_mean*measured_mean); } // Return the result vector return results; }
void heap_merge(Heap1 & lhs, Heap2 & rhs) { BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap1>)); BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap2>)); // if this assertion is triggered, the value_compare types are incompatible BOOST_STATIC_ASSERT((boost::is_same<typename Heap1::value_compare, typename Heap2::value_compare>::value)); const bool same_heaps = boost::is_same<Heap1, Heap2>::value; typedef typename boost::mpl::if_c<same_heaps, detail::heap_merge_same<Heap1>, detail::heap_merge_emulate<Heap1, Heap2> >::type heap_merger; heap_merger::merge(lhs, rhs); }
void test_geometry(G const& geometry, int expected_size = 0) { #if defined(BOOST_GEOMETRY_TEST_RING) BOOST_CONCEPT_ASSERT( (boost::geometry::concept::ConstRing<G>) ); #elif defined(BOOST_GEOMETRY_TEST_MULTI_POINT) BOOST_CONCEPT_ASSERT( (boost::geometry::concept::ConstMultiPoint<G>) ); #else BOOST_CONCEPT_ASSERT( (boost::geometry::concept::ConstLinestring<G>) ); #endif typedef typename boost::geometry::point_type<G>::type P; typedef typename boost::geometry::coordinate_type<P>::type C; // Check range-like behaviour BOOST_CHECK_EQUAL(boost::size(geometry), expected_size); }
inline void simplify_insert(Geometry const& geometry, OutputIterator out, Distance const& max_distance, Strategy const& strategy) { concept::check<Geometry const>(); BOOST_CONCEPT_ASSERT( (geometry::concept::SimplifyStrategy<Strategy>) ); dispatch::simplify_insert<Geometry>::apply(geometry, out, max_distance, strategy); }
void constraints() { BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> )); vis.examine_edge(e, g); vis.edge_relaxed(e, g); vis.edge_not_relaxed(e, g); vis.edge_minimized(e, g); vis.edge_not_minimized(e, g); }
data_type& get_cell(const Point& point) { BOOST_CONCEPT_ASSERT(( Point2DConcept<Point> )); GEOMETRIX_ASSERT( is_contained( point ) ); boost::uint32_t i = m_gridTraits.get_x_index(get<0>(point)); boost::uint32_t j = m_gridTraits.get_y_index(get<1>(point)); return get_cell(i,j); }
void Metropolis<ConfigurationType,Step,RandomNumberGenerator>::do_metropolis_simulation(InverseTemperatureIterator beta_begin, InverseTemperatureIterator beta_end, AccumulatorIterator measurement_accumulator_begin, AccumulatorIterator measurement_accumulator_end) { // Check the concept of the observator BOOST_CONCEPT_ASSERT((Concepts::ObservatorConcept<Observator,ConfigurationType>)); // Check the concept of the observable BOOST_CONCEPT_ASSERT((Concepts::ObservableConcept<typename Observator::observable_type>)); // Check the concept of the accumulator BOOST_CONCEPT_ASSERT((Concepts::AccumulatorConcept<typename std::iterator_traits<AccumulatorIterator>::value_type, typename Observator::observable_type>)); InverseTemperatureIterator beta_iterator = beta_begin; AccumulatorIterator measurement_accumulator_iterator = measurement_accumulator_begin; for (; beta_iterator != beta_end; ++beta_iterator, ++measurement_accumulator_iterator) { do_metropolis_simulation(*beta_iterator, *measurement_accumulator_iterator); if (this->is_terminating) break; } }
typename boost::enable_if_c< is_continuous_belief_state<BeliefState>::value && (belief_state_traits<BeliefState>::representation == belief_representation::gaussian) && (belief_state_traits<BeliefState>::distribution == belief_distribution::unimodal), void >::type invariant_kalman_update(const InvariantSystem& sys, const StateSpaceType& state_space, BeliefState& b_x, const InputBelief& b_u, const MeasurementBelief& b_z, typename discrete_sss_traits<InvariantSystem>::time_type t = 0) { //here the requirement is that the system models a linear system which is at worse a linearized system // - if the system is LTI or LTV, then this will result in a basic Kalman Filter (KF) update // - if the system is linearized, then this will result in an Extended Kalman Filter (EKF) update BOOST_CONCEPT_ASSERT((pp::TopologyConcept< StateSpaceType >)); BOOST_CONCEPT_ASSERT((InvariantDiscreteSystemConcept<InvariantSystem, StateSpaceType>)); BOOST_CONCEPT_ASSERT((ContinuousBeliefStateConcept<BeliefState>)); BOOST_CONCEPT_ASSERT((ContinuousBeliefStateConcept<InputBelief>)); BOOST_CONCEPT_ASSERT((ContinuousBeliefStateConcept<MeasurementBelief>)); typedef typename discrete_sss_traits<InvariantSystem>::point_type StateType; typedef typename discrete_sss_traits<InvariantSystem>::output_type OutputType; typedef typename continuous_belief_state_traits<BeliefState>::covariance_type CovType; typedef typename covariance_mat_traits< CovType >::matrix_type MatType; typedef typename mat_traits<MatType>::value_type ValueType; typedef typename invariant_system_traits<InvariantSystem>::invariant_frame_type InvarFrame; typedef typename invariant_system_traits<InvariantSystem>::invariant_error_type InvarErr; typedef typename invariant_system_traits<InvariantSystem>::invariant_correction_type InvarCorr; typename discrete_linear_sss_traits<InvariantSystem>::matrixC_type C; typename discrete_linear_sss_traits<InvariantSystem>::matrixD_type D; StateType x = b_x.get_mean_state(); MatType P = b_x.get_covariance().get_matrix(); sys.get_output_function_blocks(C, D, state_space, t, x, b_u.get_mean_state()); vect_n<ValueType> e = to_vect<ValueType>(sys.get_invariant_error(state_space, x, b_u.get_mean_state(), b_z.get_mean_state(), t + sys.get_time_step())); mat< ValueType, mat_structure::rectangular, mat_alignment::column_major > CP = C * P; mat< ValueType, mat_structure::symmetric > S(CP * transpose_view(C) + b_z.get_covariance().get_matrix()); linsolve_Cholesky(S,CP); mat< ValueType, mat_structure::rectangular, mat_alignment::row_major > K(transpose_view(CP)); b_x.set_mean_state( sys.apply_correction(state_space, x, from_vect<InvarCorr>(K * e), b_u.get_mean_state(), t + sys.get_time_step()) ); InvarFrame W = sys.get_invariant_posterior_frame(state_space, x, b_x.get_mean_state(), b_u.get_mean_state(), t + sys.get_time_step()); b_x.set_covariance( CovType( MatType( W * ((mat< ValueType, mat_structure::identity>(K.get_row_count()) - K * C) * P) * transpose_view(W) ) ) ); };
static inline calculation_type apply(Point1 const& p1, Point2 const& p2) { BOOST_CONCEPT_ASSERT( (concept::ConstPoint<Point1>) ); BOOST_CONCEPT_ASSERT( (concept::ConstPoint<Point2>) ); // Calculate distance using Pythagoras // (Leave comment above for Doxygen) assert_dimension_equal<Point1, Point2>(); return detail::compute_pythagoras < Point1, Point2, dimension<Point1>::value, calculation_type >::apply(p1, p2); }
// this checks whether the requirements of TransformConcept are satisfied for all transforms. // if you add a new transform type, include it here! void check_transforms() { #ifdef BOOST_CONCEPT_ASSERT BOOST_CONCEPT_ASSERT((TransformConcept<Translate>)); BOOST_CONCEPT_ASSERT((TransformConcept<Scale>)); BOOST_CONCEPT_ASSERT((TransformConcept<Rotate>)); BOOST_CONCEPT_ASSERT((TransformConcept<HShear>)); BOOST_CONCEPT_ASSERT((TransformConcept<VShear>)); BOOST_CONCEPT_ASSERT((TransformConcept<Zoom>)); BOOST_CONCEPT_ASSERT((TransformConcept<Affine>)); // Affine is also a transform #endif // check inter-transform multiplication Affine m; Translate t(Translate::identity()); Scale s(Scale::identity()); Rotate r(Rotate::identity()); HShear h(HShear::identity()); VShear v(VShear::identity()); Zoom z(Zoom::identity()); // notice that the first column is always the same and enumerates all transform types, // while the second one changes to each transform type in turn. m = t * t; m = t * s; m = t * r; m = t * h; m = t * v; m = t * z; m = s * t; m = s * s; m = s * r; m = s * h; m = s * v; m = s * z; m = r * t; m = r * s; m = r * r; m = r * h; m = r * v; m = r * z; m = h * t; m = h * s; m = h * r; m = h * h; m = h * v; m = h * z; m = v * t; m = v * s; m = v * r; m = v * h; m = v * v; m = v * z; m = z * t; m = z * s; m = z * r; m = z * h; m = z * v; m = z * z; }
inline return_type operator()(P1 const& p1, P2 const& p2) const { BOOST_CONCEPT_ASSERT( (concept::ConstPoint<P1>) ); BOOST_CONCEPT_ASSERT( (concept::ConstPoint<P2>) ); // Calculate distance using Pythagoras // (Leave comment above for Doxygen) assert_dimension_equal<P1, P2>(); return return_type(detail::compute_pythagoras < P1, P2, dimension<P1>::value, calculation_type >::apply(p1, p2)); }