static constexpr auto apply(F f, Xss ...tuples) { auto go = [=](auto index, auto ...nothing) { return always(f)(nothing...)(at(index, tuples)...); }; auto zip_length = minimum(sandbox::lambda_tuple(length(tuples)...)); return unpack(range(size_t<0>, zip_length), on(sandbox::lambda_tuple, go) ); }
namespace boost { namespace hana { namespace test { template <typename F> auto laws<Functor, F> = [] { static_assert(models<Functor(F)>{}, ""); auto f = injection([]{}); auto g = injection([]{}); auto v = injection([]{})(); auto pred = always(true_); for_each(objects<F>, [=](auto xs) { BOOST_HANA_CHECK( equal(transform(xs, id), xs) ); BOOST_HANA_CHECK(equal( transform(xs, compose(f, g)), transform(transform(xs, g), f) )); BOOST_HANA_CHECK(equal( adjust(xs, pred, f), transform(xs, [=](auto x) { return eval_if(pred(x), [=](auto _) { return _(f)(x); }, [=](auto) { return x; } ); }) )); BOOST_HANA_CHECK(equal( replace(xs, pred, v), adjust(xs, pred, always(v)) )); BOOST_HANA_CHECK(equal( fill(xs, v), replace(xs, always(true_), v) )); }); }; }}} // end namespace boost::hana::test
static void check_info(int info, S* err) { if (info < 0) if (!*err) *err = always(info == -7) ? "wsfull" : "qml_assert"; }
// ============================================================================ /// finalize the algorithm // ============================================================================ StatusCode Aida2Root::finalize() { always() << "Get the native ROOT representation of histograms!" << endmsg ; { // loop over all 1D-histograms for ( List::const_iterator ipath = m_1Ds.begin() ; m_1Ds.end() != ipath ; ++ipath ) { /// retrieve the historam by full path: AIDA::IHistogram1D* aida = 0 ; StatusCode sc = histoSvc()->retrieveObject( *ipath , aida ) ; if ( sc.isFailure() || 0 == aida ) { return Error ( "Unable to retrieve 1D-histogram '" + (*ipath) + "'" ) ; } /// convert it to ROOT TH1D* root = Gaudi::Utils::Aida2ROOT::aida2root ( aida ) ; if ( 0 == root ) { return Error ( "Unable to convert to ROOT the 1D-histogram '"+(*ipath)+"'") ; } /// use the native printout from ROOT info() << "The native ROOT printout for 1D-histogram '" << (*ipath) << "':" << endmsg ; root->Print() ; info () << " | Compare | AIDA/HistoStats | ROOT/TH1 | Delta | " << endmsg ; const std::string format = " | %1$-14.14s | %2$ 15.8g | %3$- 15.8g | %4$= 15.8g | " ; info () << print ( Gaudi::Utils::HistoStats::mean ( aida ) , root->GetMean () , "'mean'" , format ) << endmsg ; info () << print ( Gaudi::Utils::HistoStats::meanErr ( aida ) , root->GetMeanError () , "'meanErr'" , format ) << endmsg ; info () << print ( Gaudi::Utils::HistoStats::rms ( aida ) , root->GetRMS () , "'rms'" , format ) << endmsg ; info () << print ( Gaudi::Utils::HistoStats::rmsErr ( aida ) , root->GetRMSError () , "'rmsErr'" , format ) << endmsg ; info () << print ( Gaudi::Utils::HistoStats::skewness ( aida ) , root->GetSkewness () , "'skewness'" , format ) << endmsg ; info () << print ( Gaudi::Utils::HistoStats::skewnessErr ( aida ) , root->GetSkewness ( 11 ) , "'skewnessErr'" , format ) << endmsg ; info () << print ( Gaudi::Utils::HistoStats::kurtosis ( aida ) , root->GetKurtosis () , "'kurtosis'" , format ) << endmsg ; info () << print ( Gaudi::Utils::HistoStats::kurtosisErr ( aida ) , root->GetKurtosis ( 11 ) , "'kurtosisErr'" , format ) << endmsg ; } } { // loop over all 2D-histograms for ( List::const_iterator ipath = m_2Ds.begin() ; m_2Ds.end() != ipath ; ++ipath ) { /// retrieve the historam by full path: AIDA::IHistogram2D* aida = 0 ; StatusCode sc = histoSvc()->retrieveObject( *ipath , aida ) ; if ( sc.isFailure() || 0 == aida ) { return Error ( "Unable to retrieve 2D-histogram '" + (*ipath) + "'" ) ; } /// convert it to ROOT TH2D* root = Gaudi::Utils::Aida2ROOT::aida2root ( aida ) ; if ( 0 == root ) { return Error ( "Unable to convert to ROOT the 2D-histogram '"+(*ipath)+"'") ; } /// use the native printout from ROOT info() << "The native ROOT printout for 2D-histogram '" << (*ipath) << "':" << endmsg ; root->Print() ; } } { // loop over all 3D-histograms for ( List::const_iterator ipath = m_3Ds.begin() ; m_3Ds.end() != ipath ; ++ipath ) { /// retrieve the historam by full path: AIDA::IHistogram3D* aida = 0 ; StatusCode sc = histoSvc()->retrieveObject( *ipath , aida ) ; if ( sc.isFailure() || 0 == aida ) { return Error ( "Unable to retrieve 3D-histogram '" + (*ipath) + "'" ) ; } /// convert it to ROOT TH3D* root = Gaudi::Utils::Aida2ROOT::aida2root ( aida ) ; if ( 0 == root ) { return Error ( "Unable to convert to ROOT the 3D-histogram '"+(*ipath)+"'") ; } /// use the native printout from ROOT info() << "The native ROOT printout for 3D-histogram '" << (*ipath) << "':" << endmsg ; root->Print() ; } } { // loop over all 1D-profiles for ( List::const_iterator ipath = m_1Ps.begin() ; m_1Ps.end() != ipath ; ++ipath ) { /// retrieve the historam by full path: AIDA::IProfile1D* aida = 0 ; StatusCode sc = histoSvc()->retrieveObject( *ipath , aida ) ; if ( sc.isFailure() || 0 == aida ) { return Error ( "Unable to retrieve 1D-profile '" + (*ipath) + "'" ) ; } /// convert it to ROOT TProfile* root = Gaudi::Utils::Aida2ROOT::aida2root ( aida ) ; if ( 0 == root ) { return Error ( "Unable to convert to ROOT the 1D-profile '"+(*ipath)+"'") ; } /// use the native printout from ROOT info() << "The native ROOT printout for 1D-profile '" << (*ipath) << "':" << endmsg ; root->Print() ; } } { // loop over all 2D-profiles for ( List::const_iterator ipath = m_2Ps.begin() ; m_2Ps.end() != ipath ; ++ipath ) { /// retrieve the historam by full path: AIDA::IProfile2D* aida = 0 ; StatusCode sc = histoSvc()->retrieveObject( *ipath , aida ) ; if ( sc.isFailure() || 0 == aida ) { Error ( "Unable to retrieve 2D-profile '" + (*ipath) + "'" ) ; } /// convert it to ROOT TProfile2D* root = Gaudi::Utils::Aida2ROOT::aida2root ( aida ) ; if ( 0 == root ) { Error ( "Unable to convert to ROOT the 2D-profile '"+(*ipath)+"'") ; } /// use the native printout from ROOT info() << "The native ROOT printout for 2D-profile '" << (*ipath) << "':" << endmsg ; root->Print() ; } } return GaudiHistoAlg::finalize() ; }
// These transformations should never increase the size of the DAG. ASTNode STP::sizeReducing(ASTNode inputToSat, BVSolver* bvSolver, PropagateEqualities* pe) { inputToSat = pe->topLevel(inputToSat, arrayTransformer); if (simp->hasUnappliedSubstitutions()) { inputToSat = simp->applySubstitutionMap(inputToSat); simp->haveAppliedSubstitutionMap(); bm->ASTNodeStats(pe_message.c_str(), inputToSat); } if (bm->UserFlags.isSet("enable-unconstrained", "1")) { // Remove unconstrained. RemoveUnconstrained r1(*bm); inputToSat = r1.topLevel(inputToSat, simp); bm->ASTNodeStats(uc_message.c_str(), inputToSat); } if (bm->UserFlags.isSet("use-intervals", "1")) { EstablishIntervals intervals(*bm); inputToSat = intervals.topLevel_unsignedIntervals(inputToSat); bm->ASTNodeStats(int_message.c_str(), inputToSat); } if (bm->UserFlags.bitConstantProp_flag) { bm->GetRunTimes()->start(RunTimes::ConstantBitPropagation); simplifier::constantBitP::ConstantBitPropagation cb( simp, bm->defaultNodeFactory, inputToSat); inputToSat = cb.topLevelBothWays(inputToSat, true, false); bm->GetRunTimes()->stop(RunTimes::ConstantBitPropagation); if (cb.isUnsatisfiable()) inputToSat = bm->ASTFalse; if (simp->hasUnappliedSubstitutions()) { inputToSat = simp->applySubstitutionMap(inputToSat); simp->haveAppliedSubstitutionMap(); } bm->ASTNodeStats(cb_message.c_str(), inputToSat); } // Find pure literals. if (bm->UserFlags.isSet("pure-literals", "1")) { FindPureLiterals fpl; bool changed = fpl.topLevel(inputToSat, simp, bm); if (changed) { inputToSat = simp->applySubstitutionMap(inputToSat); simp->haveAppliedSubstitutionMap(); bm->ASTNodeStats(pl_message.c_str(), inputToSat); } } if (bm->UserFlags.isSet("always-true", "0")) { AlwaysTrue always(simp, bm, bm->defaultNodeFactory); inputToSat = always.topLevel(inputToSat); bm->ASTNodeStats("After removing always true: ", inputToSat); } if (bm->UserFlags.wordlevel_solve_flag && bm->UserFlags.optimize_flag) { inputToSat = bvSolver->TopLevelBVSolve(inputToSat, false); bm->ASTNodeStats(bitvec_message.c_str(), inputToSat); } return inputToSat; }