CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
RealQuadEquation Struct Reference

#include <RealQuadEquation.h>

Public Member Functions

 RealQuadEquation (double A, double B, double C)
 

Public Attributes

double first
 
bool hasSolution
 
double second
 

Detailed Description

A numericaly stable and as fast as can be quadratic equation solver. The equation has the form A*x^2 + B*x + C = 0

Definition at line 12 of file RealQuadEquation.h.

Constructor & Destructor Documentation

RealQuadEquation::RealQuadEquation ( double  A,
double  B,
double  C 
)
inline

Definition at line 18 of file RealQuadEquation.h.

References funct::A, funct::C, first, lumiQueryAPI::q, edm::second(), and mathSSE::sqrt().

18  {
19  double D = B*B - 4*A*C;
20  if (D<0) hasSolution = false;
21  else {
22  hasSolution = true;
23  double q = -0.5*(B + (B>0 ? sqrt(D) : -sqrt(D)));
24  first = q/A;
25  second = C/q;
26  }
27  }
T sqrt(T t)
Definition: SSEVec.h:48
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150

Member Data Documentation

double RealQuadEquation::first
bool RealQuadEquation::hasSolution
double RealQuadEquation::second