SG++-Doxygen-Documentation
sgpp::optimization::Printer Class Reference

Singleton class to facilitate debugging output. More...

#include <Printer.hpp>

Public Member Functions

void disableStatusPrinting ()
 Disable the printStatus... More...
 
void enableStatusPrinting ()
 Enable the printStatus... More...
 
double getLastDurationSecs () const
 
size_t getLineLengthLimit ()
 
MutexTypegetMutex ()
 
std::ostream * getStream () const
 
int getVerbosity () const
 
bool isStatusPrintingEnabled ()
 
void printIterativeGridGenerator (const IterativeGridGenerator &gridGen) const
 Print a grid (grid points and function values). More...
 
void printSLE (SLE &system) const
 Print a system of linear equations. More...
 
void printStatusBegin (const std::string &msg)
 Call at the beginning of a time-consuming operation. More...
 
void printStatusEnd (const std::string &msg="")
 Call at the end of a time-consuming operation. More...
 
void printStatusIdentation ()
 Internal function printing the indentation. More...
 
void printStatusNewLine ()
 End the last status update and place the cursor in a newline. More...
 
void printStatusUpdate (const std::string &msg)
 Call for printing status updates on the operation. More...
 
void setLineLengthLimit (size_t lineLengthLimit)
 
void setStream (std::ostream *stream)
 
void setVerbosity (int level)
 

Static Public Member Functions

static PrintergetInstance ()
 

Static Public Attributes

static const int DEFAULT_VERBOSITY = 0
 default verbosity More...
 

Protected Attributes

bool cursorInClearLine
 is current line empty? (false if there's an old status update) More...
 
std::string indentation
 indentation More...
 
int indentationLevel
 current indentation level (can be less than statusLevel) More...
 
double lastDuration
 length of last operation in seconds More...
 
size_t lastMsgLength
 length of the last status message in characters More...
 
size_t lineLengthLimit
 maximum length of lines, 0 if unbounded More...
 
MutexType mutex
 internal mutex More...
 
int statusLevel
 current status level More...
 
bool statusPrintingEnabled
 whether status printing is enabled More...
 
std::ostream * stream
 stream used for printing (default std::cout) More...
 
int verbose
 verbosity level More...
 
std::stack< base::SGppStopwatchwatches
 stack of stop watches (started at time of printStatusBegin() calls) More...
 

Static Protected Attributes

static const char INDENTATION_CHAR = ' '
 
static const size_t INDENTATION_LENGTH = 4
 

Detailed Description

Singleton class to facilitate debugging output.

Use with the sgpp::printer instance.

The status printing functions won't print anything if

Member Function Documentation

◆ disableStatusPrinting()

void sgpp::optimization::Printer::disableStatusPrinting ( )

Disable the printStatus...

functions. (They're enabled by default.)

References sgpp::optimization::MutexType::lock().

Referenced by sgpp::datadriven::OperationInverseRosenblattTransformation1DBspline::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModBspline::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPoly::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyBoundary::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBsplineBoundary::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModPoly::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModPolyClenshawCurtis::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBsplineClenshawCurtis::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyClenshawCurtis::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModBsplineClenshawCurtis::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyClenshawCurtisBoundary::doTransformation1D(), sgpp::optimization::IterativeGridGeneratorLinearSurplus::generate(), sgpp::optimization::optimizer::MultiStart::optimize(), sgpp::optimization::optimizer::LevenbergMarquardt::optimize(), sgpp::optimization::optimizer::AdaptiveNewton::optimize(), sgpp::optimization::optimizer::Newton::optimize(), and sgpp::datadriven::BoHyperparameterOptimizer::run().

◆ enableStatusPrinting()

◆ getInstance()

Printer & sgpp::optimization::Printer::getInstance ( )
static
Returns
singleton instance

Referenced by BSplineCoefficientGridFunction(), BSplineTensorCoefficientGridFunction(), sgpp::combigrid::calculateInterpolationCoefficientsForConvertedExpUniformBoundaryCombigird(), sgpp::optimization::OperationMultipleHierarchisationFundamentalSpline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModFundamentalSpline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationFundamentalSpline::doHierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModFundamentalSpline::doHierarchisation(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModBspline::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModPoly::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBspline::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPoly::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBsplineBoundary::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyBoundary::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyClenshawCurtisBoundary::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBsplineClenshawCurtis::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModBsplineClenshawCurtis::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModPolyClenshawCurtis::doTransformation1D(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyClenshawCurtis::doTransformation1D(), sgpp::combigrid::FullGridPCESummationStrategy< V >::eval(), sgpp::optimization::IterativeGridGeneratorSOO::generate(), sgpp::optimization::IterativeGridGeneratorLinearSurplus::generate(), sgpp::optimization::IterativeGridGeneratorRitterNovak::generate(), sgpp::optimization::optimizer::CMAES::optimize(), sgpp::optimization::optimizer::Rprop::optimize(), sgpp::optimization::optimizer::AdaptiveGradientDescent::optimize(), sgpp::optimization::optimizer::BFGS::optimize(), sgpp::optimization::optimizer::GradientDescent::optimize(), sgpp::optimization::optimizer::NelderMead::optimize(), sgpp::optimization::optimizer::LogBarrier::optimize(), sgpp::optimization::optimizer::DifferentialEvolution::optimize(), sgpp::optimization::optimizer::NLCG::optimize(), sgpp::optimization::optimizer::MultiStart::optimize(), sgpp::optimization::optimizer::SquaredPenalty::optimize(), sgpp::optimization::optimizer::AugmentedLagrangian::optimize(), sgpp::optimization::optimizer::LevenbergMarquardt::optimize(), sgpp::optimization::optimizer::AdaptiveNewton::optimize(), sgpp::optimization::optimizer::Newton::optimize(), sgpp::datadriven::BoHyperparameterOptimizer::run(), sgpp::optimization::sle_solver::GaussianElimination::solve(), sgpp::optimization::sle_solver::Gmmpp::solve(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), sgpp::optimization::sle_solver::Auto::solve(), and sgpp::optimization::sle_solver::BiCGStab::solve().

◆ getLastDurationSecs()

double sgpp::optimization::Printer::getLastDurationSecs ( ) const
Returns
running-time of the last operation terminated by printStatusEnd()

Referenced by setVerbosity().

◆ getLineLengthLimit()

size_t sgpp::optimization::Printer::getLineLengthLimit ( )
Returns
maximum length of lines, 0 if unbounded

Referenced by setVerbosity().

◆ getMutex()

MutexType & sgpp::optimization::Printer::getMutex ( )
Returns
internal mutex

Referenced by sgpp::optimization::optimizer::MultiStart::optimize(), and setVerbosity().

◆ getStream()

std::ostream * sgpp::optimization::Printer::getStream ( ) const
Returns
stream used for printing (default std::cout)

Referenced by setVerbosity().

◆ getVerbosity()

int sgpp::optimization::Printer::getVerbosity ( ) const
inline
Returns
current verbosity level

References verbose.

◆ isStatusPrintingEnabled()

◆ printIterativeGridGenerator()

void sgpp::optimization::Printer::printIterativeGridGenerator ( const IterativeGridGenerator gridGen) const

◆ printSLE()

void sgpp::optimization::Printer::printSLE ( SLE system) const

Print a system of linear equations.

Parameters
systemsystem to be printed

References sgpp::optimization::SLE::getDimension(), sgpp::optimization::SLE::getMatrixEntry(), python.statsfileInfo::i, and python.utils.statsfile2gnuplot::j.

Referenced by setVerbosity().

◆ printStatusBegin()

void sgpp::optimization::Printer::printStatusBegin ( const std::string &  msg)

Call at the beginning of a time-consuming operation.

Locks and unlocks an OpenMP mutex.

Parameters
msgshort description of the operation

References sgpp::optimization::MutexType::lock().

Referenced by sgpp::optimization::OperationMultipleHierarchisationFundamentalSpline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModFundamentalSpline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationFundamentalSpline::doHierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModFundamentalSpline::doHierarchisation(), sgpp::optimization::IterativeGridGeneratorSOO::generate(), sgpp::optimization::IterativeGridGeneratorLinearSurplus::generate(), sgpp::optimization::IterativeGridGeneratorRitterNovak::generate(), sgpp::optimization::optimizer::CMAES::optimize(), sgpp::optimization::optimizer::Rprop::optimize(), sgpp::optimization::optimizer::AdaptiveGradientDescent::optimize(), sgpp::optimization::optimizer::BFGS::optimize(), sgpp::optimization::optimizer::GradientDescent::optimize(), sgpp::optimization::optimizer::NelderMead::optimize(), sgpp::optimization::optimizer::LogBarrier::optimize(), sgpp::optimization::optimizer::DifferentialEvolution::optimize(), sgpp::optimization::optimizer::NLCG::optimize(), sgpp::optimization::optimizer::MultiStart::optimize(), sgpp::optimization::optimizer::AugmentedLagrangian::optimize(), sgpp::optimization::optimizer::SquaredPenalty::optimize(), sgpp::optimization::optimizer::LevenbergMarquardt::optimize(), sgpp::optimization::optimizer::AdaptiveNewton::optimize(), sgpp::optimization::optimizer::Newton::optimize(), sgpp::optimization::sle_solver::GaussianElimination::solve(), sgpp::optimization::sle_solver::Gmmpp::solve(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), sgpp::optimization::sle_solver::Auto::solve(), and sgpp::optimization::sle_solver::BiCGStab::solve().

◆ printStatusEnd()

void sgpp::optimization::Printer::printStatusEnd ( const std::string &  msg = "")

Call at the end of a time-consuming operation.

Locks and unlocks an OpenMP mutex.

Retrieve the running time of the operation with getLastDurationSecs() (also works with nested calls of printStatusBegin()).

Parameters
msgshort description of the result, e.g. "success" or "error" (optional)

References sgpp::optimization::MutexType::lock(), and sgpp::base::SGppStopwatch::stop().

Referenced by sgpp::optimization::OperationMultipleHierarchisationFundamentalSpline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModFundamentalSpline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationFundamentalSpline::doHierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModFundamentalSpline::doHierarchisation(), sgpp::optimization::IterativeGridGeneratorSOO::generate(), sgpp::optimization::IterativeGridGeneratorLinearSurplus::generate(), sgpp::optimization::IterativeGridGeneratorRitterNovak::generate(), sgpp::optimization::optimizer::CMAES::optimize(), sgpp::optimization::optimizer::Rprop::optimize(), sgpp::optimization::optimizer::AdaptiveGradientDescent::optimize(), sgpp::optimization::optimizer::BFGS::optimize(), sgpp::optimization::optimizer::GradientDescent::optimize(), sgpp::optimization::optimizer::NelderMead::optimize(), sgpp::optimization::optimizer::LogBarrier::optimize(), sgpp::optimization::optimizer::DifferentialEvolution::optimize(), sgpp::optimization::optimizer::NLCG::optimize(), sgpp::optimization::optimizer::MultiStart::optimize(), sgpp::optimization::optimizer::AugmentedLagrangian::optimize(), sgpp::optimization::optimizer::SquaredPenalty::optimize(), sgpp::optimization::optimizer::LevenbergMarquardt::optimize(), sgpp::optimization::optimizer::AdaptiveNewton::optimize(), sgpp::optimization::optimizer::Newton::optimize(), sgpp::optimization::sle_solver::GaussianElimination::solve(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), sgpp::optimization::sle_solver::Auto::solve(), and sgpp::optimization::sle_solver::BiCGStab::solve().

◆ printStatusIdentation()

void sgpp::optimization::Printer::printStatusIdentation ( )

Internal function printing the indentation.

References python.statsfileInfo::i.

◆ printStatusNewLine()

◆ printStatusUpdate()

void sgpp::optimization::Printer::printStatusUpdate ( const std::string &  msg)

Call for printing status updates on the operation.

The last status is erased, if printStatusNewLine has not been called before. Locks and unlocks an OpenMP mutex.

Parameters
msgstatus message

References sgpp::optimization::MutexType::lock().

Referenced by sgpp::optimization::IterativeGridGeneratorSOO::generate(), sgpp::optimization::IterativeGridGeneratorLinearSurplus::generate(), sgpp::optimization::IterativeGridGeneratorRitterNovak::generate(), sgpp::optimization::optimizer::CMAES::optimize(), sgpp::optimization::optimizer::AdaptiveGradientDescent::optimize(), sgpp::optimization::optimizer::Rprop::optimize(), sgpp::optimization::optimizer::BFGS::optimize(), sgpp::optimization::optimizer::GradientDescent::optimize(), sgpp::optimization::optimizer::NelderMead::optimize(), sgpp::optimization::optimizer::LogBarrier::optimize(), sgpp::optimization::optimizer::DifferentialEvolution::optimize(), sgpp::optimization::optimizer::NLCG::optimize(), sgpp::optimization::optimizer::MultiStart::optimize(), sgpp::optimization::optimizer::AugmentedLagrangian::optimize(), sgpp::optimization::optimizer::SquaredPenalty::optimize(), sgpp::optimization::optimizer::LevenbergMarquardt::optimize(), sgpp::optimization::optimizer::AdaptiveNewton::optimize(), sgpp::optimization::optimizer::Newton::optimize(), sgpp::optimization::sle_solver::Gmmpp::solve(), sgpp::optimization::sle_solver::GaussianElimination::solve(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), sgpp::optimization::sle_solver::Auto::solve(), and sgpp::optimization::sle_solver::BiCGStab::solve().

◆ setLineLengthLimit()

void sgpp::optimization::Printer::setLineLengthLimit ( size_t  lineLengthLimit)
Parameters
lineLengthLimitmaximum length of lines, 0 if unbounded

Referenced by setVerbosity().

◆ setStream()

void sgpp::optimization::Printer::setStream ( std::ostream *  stream)
Parameters
streamstream used for printing (default std::cout)

Referenced by setVerbosity().

◆ setVerbosity()

Member Data Documentation

◆ cursorInClearLine

bool sgpp::optimization::Printer::cursorInClearLine
protected

is current line empty? (false if there's an old status update)

◆ DEFAULT_VERBOSITY

const int sgpp::optimization::Printer::DEFAULT_VERBOSITY = 0
static

default verbosity

◆ indentation

std::string sgpp::optimization::Printer::indentation
protected

indentation

◆ INDENTATION_CHAR

const char sgpp::optimization::Printer::INDENTATION_CHAR = ' '
staticprotected

◆ INDENTATION_LENGTH

const size_t sgpp::optimization::Printer::INDENTATION_LENGTH = 4
staticprotected

◆ indentationLevel

int sgpp::optimization::Printer::indentationLevel
protected

current indentation level (can be less than statusLevel)

◆ lastDuration

double sgpp::optimization::Printer::lastDuration
protected

length of last operation in seconds

◆ lastMsgLength

size_t sgpp::optimization::Printer::lastMsgLength
protected

length of the last status message in characters

◆ lineLengthLimit

size_t sgpp::optimization::Printer::lineLengthLimit
protected

maximum length of lines, 0 if unbounded

Referenced by setVerbosity().

◆ mutex

MutexType sgpp::optimization::Printer::mutex
protected

internal mutex

◆ statusLevel

int sgpp::optimization::Printer::statusLevel
protected

current status level

◆ statusPrintingEnabled

bool sgpp::optimization::Printer::statusPrintingEnabled
protected

whether status printing is enabled

◆ stream

std::ostream* sgpp::optimization::Printer::stream
protected

stream used for printing (default std::cout)

Referenced by setVerbosity().

◆ verbose

int sgpp::optimization::Printer::verbose
protected

◆ watches

std::stack<base::SGppStopwatch> sgpp::optimization::Printer::watches
protected

stack of stop watches (started at time of printStatusBegin() calls)


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