MRS  1.0
A C++ Class Library for Statistical Set Processing
subpavings::IntervalExpanderEstimator Class Reference
+ Inheritance diagram for subpavings::IntervalExpanderEstimator:
+ Collaboration diagram for subpavings::IntervalExpanderEstimator:

List of all members.

Public Member Functions

 IntervalExpanderEstimator (const MappedFobj &f, cxsc::real tol)
 Constructor.
cxsc::interval visit (SPnode *spn) const
 The visit operation.

Constructor & Destructor Documentation

Constructor.

Parameters:
fdescribes a function to be estimated.
toldescribes the tolerance to be used in making the estimate.
Precondition:
tol >= cxsc::MinReal.
                : fobj(f), tolerance(tol) 
  {
    if (tolerance < cxsc::MinReal) 
      throw std::invalid_argument(
        "IntervalExpanderEstimator::IntervalExpanderEstimator(MappedFobj&, cxsc::real) : tol < cxsc::MinReal");
  }

Member Function Documentation

cxsc::interval subpavings::IntervalExpanderEstimator::visit ( SPnode spn) const [virtual]

The visit operation.

Expands the node pointed to by spn if the interval image tolerance requirement is not met and returns the interval image under the function to be estimated by this of the box associated with the node pointed to by spn.

Parameters:
spna pointer to an SPnode to be visited.
Returns:
the interval image under the function to be estimated by this of the box associated with the node pointed to by spn.

Implements subpavings::SPExpandVisitor< cxsc::interval >.

    {
    #ifdef MYDEBUG
      std::cout << "in IntervalExpanderEstimator::visit, for " << spn->getNodeName() << std::endl;
    #endif
    
        // check if we need to split
        ivector box = spn->getBox();
    
    #ifdef MYDEBUG
      std::cout << "this box is " << box << std::endl;
        #endif
    
    interval thisRange = fobj(box);
    real thisMidImage = fobj.imageMid(box);
    
    #ifdef MYDEBUG
      std::cout << "this midImage is " << thisMidImage << std::endl;
    #endif
    
    #ifdef MYDEBUG
      std::cout << "this range is " << thisRange << std::endl;
    #endif
    
    #ifdef MYDEBUG
      std::cout << "this tolerance is " << tolerance << std::endl;
    #endif
    
    // split if so
    if (max(Sup(thisRange) - thisMidImage, thisMidImage - Inf(thisRange)) > tolerance) {
      spn->nodeExpand();

    }
    #ifdef MYDEBUG_MIN
    if (!(max(Sup(thisRange) - thisMidImage, thisMidImage - Inf(thisRange)) > tolerance)) {
    
      std::cout << "no need to expand further: interval image <= tolerance " << std::endl;
    }
    #endif
    
    return thisRange;
    }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends