Alexandria 2.32.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Example Class Reference
Inheritance diagram for Example:
Collaboration diagram for Example:

Public Member Functions

po::options_description defineSpecificProgramOptions () override
void generateGraphviz (Node< double > &node, int nparams)
std::map< int, std::pair< py::object, std::shared_ptr< Node< double > > > > getFunctions ()
std::pair< std::vector< double >, ArgumentscreateParameters (int n)
void runPython (boost::python::object func, const std::vector< double > &args)
void runCpp (const std::shared_ptr< Node< double > > &node, const Arguments &args)
std::vector< double > measure (std::function< void(void)> func)
void evalExamples ()
Elements::ExitCode mainMethod (std::map< std::string, po::variable_value > &args) override
Public Member Functions inherited from Elements::Program
 Program ()=default
virtual ~Program ()
virtual std::pair< OptionsDescription, PositionalOptionsDescriptiondefineProgramArguments ()
virtual ExitCode mainMethod (std::map< std::string, VariableValue > &args)=0

Private Attributes

int m_threads
int m_repeats
fs::path m_dot_file

Additional Inherited Members

Public Types inherited from Elements::Program
typedef boost::program_options::options_description options_description
typedef boost::program_options::positional_options_description positional_options_description
typedef boost::program_options::variable_value variable_value
typedef boost::program_options::variables_map variables_map
typedef options_description OptionsDescription
typedef positional_options_description PositionalOptionsDescription
typedef variable_value VariableValue
typedef variables_map VariablesMap
typedef Elements::ExitCode ExitCode
typedef Elements::Logging Logging

Detailed Description

Main program

Definition at line 60 of file Example.cpp.

Member Function Documentation

◆ createParameters()

std::pair< std::vector< double >, Arguments > Example::createParameters ( int n)
inline

Definition at line 135 of file Example.cpp.

Referenced by evalExamples().

◆ defineSpecificProgramOptions()

po::options_description Example::defineSpecificProgramOptions ( )
inlineoverridevirtual

Reimplemented from Elements::Program.

Definition at line 67 of file Example.cpp.

◆ evalExamples()

void Example::evalExamples ( )
inline

Definition at line 178 of file Example.cpp.

References createParameters(), std::endl(), std::fixed(), getFunctions(), logger, m_threads, measure(), runCpp(), runPython(), std::setprecision(), and std::setw().

Referenced by mainMethod().

Here is the call graph for this function:

◆ generateGraphviz()

void Example::generateGraphviz ( Node< double > & node,
int nparams )
inline

Definition at line 77 of file Example.cpp.

References logger, m_dot_file, Pyston::GraphvizGenerator::str(), std::to_string(), and Pyston::NodeBase::visit().

Referenced by getFunctions().

Here is the call graph for this function:

◆ getFunctions()

std::map< int, std::pair< py::object, std::shared_ptr< Node< double > > > > Example::getFunctions ( )
inline

Extract callables from Python, both Python and "compiled"

Definition at line 94 of file Example.cpp.

References generateGraphviz(), logger, std::make_pair(), and std::make_shared().

Referenced by evalExamples().

Here is the call graph for this function:

◆ mainMethod()

Elements::ExitCode Example::mainMethod ( std::map< std::string, po::variable_value > & args)
inlineoverride

◆ measure()

std::vector< double > Example::measure ( std::function< void(void)> func)
inline

Definition at line 158 of file Example.cpp.

References std::vector< T >::emplace_back(), m_repeats, and m_threads.

Referenced by evalExamples().

Here is the call graph for this function:

◆ runCpp()

void Example::runCpp ( const std::shared_ptr< Node< double > > & node,
const Arguments & args )
inline

Definition at line 152 of file Example.cpp.

References m_repeats.

Referenced by evalExamples().

◆ runPython()

void Example::runPython ( boost::python::object func,
const std::vector< double > & args )
inline

Definition at line 145 of file Example.cpp.

References m_repeats.

Referenced by evalExamples().

Member Data Documentation

◆ m_dot_file

fs::path Example::m_dot_file
private

Definition at line 64 of file Example.cpp.

Referenced by generateGraphviz(), and mainMethod().

◆ m_repeats

int Example::m_repeats
private

Definition at line 63 of file Example.cpp.

Referenced by mainMethod(), measure(), runCpp(), and runPython().

◆ m_threads

int Example::m_threads
private

Definition at line 63 of file Example.cpp.

Referenced by evalExamples(), mainMethod(), and measure().


The documentation for this class was generated from the following file: