Jpp  18.0.0-rc.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
JMATH::JAverage< JQuaternion3D > Struct Template Reference

Template spacialisation for averaging quaternions. More...

#include <JEigen3D.hh>

Public Member Functions

 JAverage ()
 Default constructor. More...
 
template<class T >
 JAverage (T __begin, T __end)
 Constructor. More...
 
void reset ()
 Reset. More...
 
 operator JQuaternion3D () const
 Type conversion operator. More...
 
void put (const JQuaternion3D &Q, const double w=1.0)
 Put quaternion. More...
 

Static Public Attributes

static double MINIMAL_EIGEN_VALUE = 1.0e-8
 Numerical precision for eigen value evaluation. More...
 

Private Attributes

TMatrixDSym A
 
double W
 

Detailed Description

template<>
struct JMATH::JAverage< JQuaternion3D >

Template spacialisation for averaging quaternions.

Definition at line 98 of file JEigen3D.hh.

Constructor & Destructor Documentation

Default constructor.

Definition at line 108 of file JEigen3D.hh.

108  :
109  A(4),
110  W(0.0)
111  {}
template<class T >
JMATH::JAverage< JQuaternion3D >::JAverage ( T  __begin,
T  __end 
)
inline

Constructor.

Parameters
__beginbegin of data
__endend of data

Definition at line 121 of file JEigen3D.hh.

121  :
122  A(4),
123  W(0.0)
124  {
125  for (T i = __begin; i != __end; ++i) {
126  this->put(*i);
127  }
128  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
void put(const JQuaternion3D &Q, const double w=1.0)
Put quaternion.
Definition: JEigen3D.hh:180

Member Function Documentation

void JMATH::JAverage< JQuaternion3D >::reset ( )
inline

Reset.

Definition at line 134 of file JEigen3D.hh.

135  {
136  A = 0.0;
137  W = 0.0;
138  }
JMATH::JAverage< JQuaternion3D >::operator JQuaternion3D ( ) const
inline

Type conversion operator.

Returns
quaternion

Definition at line 146 of file JEigen3D.hh.

147  {
149 
150  const TMatrixDSymEigen result(A);
151 
152  const TVectorD& u = result.GetEigenValues();
153  const TMatrixD& V = result.GetEigenVectors();
154 
155  if (u.GetNoElements() != 0 && fabs(u[0]) > MINIMAL_EIGEN_VALUE) {
156 
157  Q = JQuaternion3D(V(0,0), V(1,0), V(2,0), V(3,0));
158 
159  if (Q.getA() < 0.0) {
160  Q.negate();
161  }
162 
163  Q.pow(u[0] / W);
164 
165  } else {
166 
167  //THROW(JDivisionByZero, "Invalid eigen value.");
168  }
169 
170  return Q;
171  }
JQuaternion3D & pow(const double y)
Raise quaternion to given power.
Q(UTCMax_s-UTCMin_s)-livetime_s
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Data structure for unit quaternion in three dimensions.
double getA() const
Get a value.
static double MINIMAL_EIGEN_VALUE
Numerical precision for eigen value evaluation.
Definition: JEigen3D.hh:103
double u[N+1]
Definition: JPolint.hh:776
JQuaternion3D & negate()
Negate quaternion.
void JMATH::JAverage< JQuaternion3D >::put ( const JQuaternion3D Q,
const double  w = 1.0 
)
inline

Put quaternion.

Parameters
Qquaternion
wweight

Definition at line 180 of file JEigen3D.hh.

181  {
182  TMatrixDSym a(4);
183 
184  a(0,0) = Q.getA()*Q.getA(); a(0,1) = Q.getA()*Q.getB(); a(0,2) = Q.getA()*Q.getC(); a(0,3) = Q.getA()*Q.getD();
185  a(1,0) = a(0,1); a(1,1) = Q.getB()*Q.getB(); a(1,2) = Q.getB()*Q.getC(); a(1,3) = Q.getB()*Q.getD();
186  a(2,0) = a(0,2); a(2,1) = a(1,2); a(2,2) = Q.getC()*Q.getC(); a(2,3) = Q.getC()*Q.getD();
187  a(3,0) = a(0,3); a(3,1) = a(1,3); a(3,2) = a(2,3); a(3,3) = Q.getD()*Q.getD();
188 
189  a *= w;
190  A += a;
191  W += w*w;
192  }
data_type w[N+1][M+1]
Definition: JPolint.hh:778
double getB() const
Get b value.
then JCalibrateToT a
Definition: JTuneHV.sh:116
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.

Member Data Documentation

double JMATH::JAverage< JQuaternion3D >::MINIMAL_EIGEN_VALUE = 1.0e-8
static

Numerical precision for eigen value evaluation.

Definition at line 103 of file JEigen3D.hh.

TMatrixDSym JMATH::JAverage< JQuaternion3D >::A
private

Definition at line 195 of file JEigen3D.hh.

double JMATH::JAverage< JQuaternion3D >::W
private

Definition at line 196 of file JEigen3D.hh.


The documentation for this struct was generated from the following file: