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

List of all members.

Public Member Functions

 RealExpanderEstimator (const MappedFobj &f, cxsc::real tol)
 Constructor.
cxsc::real 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(
        "RealExpanderEstimator::RealExpanderEstimator(MappedFobj&, cxsc::real) : tol < cxsc::MinReal");
  }

Member Function Documentation

cxsc::real subpavings::RealExpanderEstimator::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 real image under the function to be estimated by this of the mid-point of the box associated with the node pointed to by spn.

Parameters:
spna pointer to a SPnode to be visited.
Returns:
the real image under the function to be estimated by this of the mid-point of the box associated with the node pointed to by spn.

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

    {
    #ifdef MYDEBUG
      std::cout << "in RealExpanderEstimator::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
    
    real thisMidImage = fobj.imageMid(box);
      
    #ifdef MYDEBUG
      std::cout << "this midImage is " << thisMidImage << std::endl;
    #endif
    
    interval thisRange = fobj(box);
      
    #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 thisMidImage;
    }

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