LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
QuadExpr Class Reference

#include "QuadExpr.h"

Public Member Functions

 QuadExpr (double v)
 
double Quadratic () const
 
double Linear () const
 
double Constant () const
 
double Eval (double x) const
 
QuadExproperator+= (const QuadExpr &e)
 
QuadExproperator-= (const QuadExpr &e)
 
QuadExproperator*= (const QuadExpr &e)
 
QuadExpr operator+ (const QuadExpr &e) const
 
QuadExpr operator- (const QuadExpr &e) const
 
QuadExpr operator* (const QuadExpr &e) const
 
QuadExpr operator+ (double v) const
 
QuadExpr operator- (double v) const
 
QuadExpr operator* (double v) const
 

Static Public Member Functions

static QuadExpr X ()
 

Protected Attributes

double a
 
double b
 
double c
 

Detailed Description

Definition at line 8 of file QuadExpr.h.

Constructor & Destructor Documentation

QuadExpr::QuadExpr ( double  v)
inline

Definition at line 11 of file QuadExpr.h.

References X().

Referenced by operator*(), operator+(), operator-(), and operator-().

11 : a(0), b(0), c(v) {}
double a
Definition: QuadExpr.h:34
double c
Definition: QuadExpr.h:34
double b
Definition: QuadExpr.h:34

Member Function Documentation

double QuadExpr::Constant ( ) const
inline

Definition at line 17 of file QuadExpr.h.

References c, e, Eval(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), and x.

Referenced by operator<<().

17 {return c;}
double c
Definition: QuadExpr.h:34
double QuadExpr::Eval ( double  x) const

Definition at line 67 of file QuadExpr.cxx.

References a, b, and c.

Referenced by Constant(), and SolvePair().

68 {
69  return a*x*x + b*x + c;
70 }
Float_t x
Definition: compare.C:6
double a
Definition: QuadExpr.h:34
double c
Definition: QuadExpr.h:34
double b
Definition: QuadExpr.h:34
double QuadExpr::Linear ( ) const
inline

Definition at line 16 of file QuadExpr.h.

References b.

Referenced by operator<<(), and SolvePair().

16 {return b;}
double b
Definition: QuadExpr.h:34
QuadExpr QuadExpr::operator* ( const QuadExpr e) const

Definition at line 43 of file QuadExpr.cxx.

References a, b, and c.

Referenced by Constant().

44 {
45  if((b != 0 && e.a != 0) ||
46  (a != 0 && e.b != 0) ||
47  (a != 0 && e.a != 0)){
48  std::cout << "(" << *this << ") * (" << e << ")"
49  << " does not result in a quadratic expression." << std::endl;
50  abort();
51  }
52 
53  QuadExpr ret(0);
54  ret.c = c*e.c;
55  ret.b = c*e.b + b*e.c;
56  ret.a = c*e.a + a*e.c + b*e.b;
57 
58  return ret;
59 }
double a
Definition: QuadExpr.h:34
double c
Definition: QuadExpr.h:34
double b
Definition: QuadExpr.h:34
QuadExpr QuadExpr::operator* ( double  v) const
inline

Definition at line 31 of file QuadExpr.h.

References QuadExpr().

31 {return (*this)*QuadExpr(v);}
QuadExpr(double v)
Definition: QuadExpr.h:11
QuadExpr & QuadExpr::operator*= ( const QuadExpr e)

Definition at line 61 of file QuadExpr.cxx.

References e.

Referenced by Constant().

62 {
63  *this = *this * e;
64  return *this;
65 }
Float_t e
Definition: plot.C:34
QuadExpr QuadExpr::operator+ ( const QuadExpr e) const

Definition at line 21 of file QuadExpr.cxx.

References e.

Referenced by Constant().

22 {
23  QuadExpr ret = *this;
24  ret += e;
25  return ret;
26 }
Float_t e
Definition: plot.C:34
QuadExpr QuadExpr::operator+ ( double  v) const
inline

Definition at line 29 of file QuadExpr.h.

References QuadExpr().

29 {return (*this)+QuadExpr(v);}
QuadExpr(double v)
Definition: QuadExpr.h:11
QuadExpr & QuadExpr::operator+= ( const QuadExpr e)

Definition at line 13 of file QuadExpr.cxx.

References a, b, and c.

Referenced by Constant().

14 {
15  a += e.a;
16  b += e.b;
17  c += e.c;
18  return *this;
19 }
double a
Definition: QuadExpr.h:34
double c
Definition: QuadExpr.h:34
double b
Definition: QuadExpr.h:34
QuadExpr QuadExpr::operator- ( const QuadExpr e) const

Definition at line 36 of file QuadExpr.cxx.

References e.

Referenced by Constant().

37 {
38  QuadExpr ret = *this;
39  ret -= e;
40  return ret;
41 }
Float_t e
Definition: plot.C:34
QuadExpr QuadExpr::operator- ( double  v) const
inline

Definition at line 30 of file QuadExpr.h.

References QuadExpr().

30 {return (*this)-QuadExpr(v);}
QuadExpr(double v)
Definition: QuadExpr.h:11
QuadExpr & QuadExpr::operator-= ( const QuadExpr e)

Definition at line 28 of file QuadExpr.cxx.

References a, b, and c.

Referenced by Constant().

29 {
30  a -= e.a;
31  b -= e.b;
32  c -= e.c;
33  return *this;
34 }
double a
Definition: QuadExpr.h:34
double c
Definition: QuadExpr.h:34
double b
Definition: QuadExpr.h:34
double QuadExpr::Quadratic ( ) const
inline

Definition at line 15 of file QuadExpr.h.

References a.

Referenced by operator<<(), and SolvePair().

15 {return a;}
double a
Definition: QuadExpr.h:34
QuadExpr QuadExpr::X ( )
static

Definition at line 6 of file QuadExpr.cxx.

References b.

Referenced by Metric(), and QuadExpr().

7 {
8  QuadExpr ret(0);
9  ret.b = 1;
10  return ret;
11 }

Member Data Documentation

double QuadExpr::a
protected

Definition at line 34 of file QuadExpr.h.

Referenced by Eval(), operator*(), operator+=(), operator-=(), and Quadratic().

double QuadExpr::b
protected

Definition at line 34 of file QuadExpr.h.

Referenced by Eval(), Linear(), operator*(), operator+=(), operator-=(), and X().

double QuadExpr::c
protected

Definition at line 34 of file QuadExpr.h.

Referenced by Constant(), Eval(), operator*(), operator+=(), and operator-=().


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