CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
npstat::EquidistantInLogSpace Class Reference

#include <EquidistantSequence.h>

Inheritance diagram for npstat::EquidistantInLogSpace:

Public Member Functions

 EquidistantInLogSpace (double minScale, double maxScale, unsigned nScales)
 
 EquidistantInLogSpace ()=delete
 
virtual ~EquidistantInLogSpace ()
 

Detailed Description

A sequence of points equidistant in log space. Note that std::vector destructor is not virtual, so do not destroy this class by base pointer or reference.

Definition at line 35 of file EquidistantSequence.h.

Constructor & Destructor Documentation

npstat::EquidistantInLogSpace::EquidistantInLogSpace ( double  minScale,
double  maxScale,
unsigned  nScales 
)

Definition at line 32 of file EquidistantSequence.cc.

References funct::exp(), mps_fire::i, log, and mathSSE::sqrt().

33  : std::vector<double>() {
34  if (nScales)
35  if (!(minScale > 0.0 && maxScale > 0.0))
37  "In npstat::EquidistantInLogSpace constructor: "
38  "minimum and maximum scales must be positive");
39  switch (nScales) {
40  case 0:
41  break;
42 
43  case 1: {
44  this->reserve(nScales);
45  const double sc = (minScale == maxScale ? minScale : sqrt(minScale * maxScale));
46  push_back(sc);
47  } break;
48 
49  default: {
50  this->reserve(nScales);
51  const double logmax = log(maxScale);
52  const double logmin = log(minScale);
53  const double logstep = (logmax - logmin) / (nScales - 1);
54  push_back(minScale);
55  for (unsigned i = 1; i < nScales - 1; ++i)
56  push_back(exp(logmin + i * logstep));
57  push_back(maxScale);
58  } break;
59  }
60  }
static std::vector< std::string > checklist log
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
T sqrt(T t)
Definition: SSEVec.h:19
virtual npstat::EquidistantInLogSpace::~EquidistantInLogSpace ( )
inlinevirtual

Definition at line 38 of file EquidistantSequence.h.

38 {}
npstat::EquidistantInLogSpace::EquidistantInLogSpace ( )
delete