Jpp
JVectorND.hh
Go to the documentation of this file.
1 #ifndef __JMATH__JVECTORND__
2 #define __JMATH__JVECTORND__
3 
4 #include <vector>
5 
6 namespace JMATH {}
7 namespace JPP { using namespace JMATH; }
8 
9 namespace JMATH {
10 
11  /**
12  * Nx1 matrix.
13  */
14  struct JVectorND :
15  public std::vector<double>
16  {
17  /**
18  * Default constructor.
19  */
21  std::vector<double>()
22  {}
23 
24 
25  /**
26  * Constructor.
27  *
28  * \param size size
29  */
30  JVectorND(size_t size) :
31  std::vector<double>(size, 0.0)
32  {}
33 
34 
35  /**
36  * Get dot product.
37  *
38  * \param vector vector
39  * \return dot product
40  */
41  double getDot(const JVectorND& vector) const
42  {
43  double dot = 0.0;
44 
45  const double* p = this-> data();
46  const double* q = vector.data();
47 
48  for (size_t i = this->size(); i != 0; --i, ++p, ++q) {
49  dot += (*p) * (*q);
50  }
51 
52  return dot;
53  }
54  };
55 }
56 
57 #endif
JMATH::JVectorND::getDot
double getDot(const JVectorND &vector) const
Get dot product.
Definition: JVectorND.hh:41
JMATH::JVectorND::JVectorND
JVectorND(size_t size)
Constructor.
Definition: JVectorND.hh:30
std::vector
Definition: JSTDTypes.hh:12
JMATH::JVectorND::JVectorND
JVectorND()
Default constructor.
Definition: JVectorND.hh:20
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JMATH::JVectorND
Nx1 matrix.
Definition: JVectorND.hh:14
JMATH
Auxiliary classes and methods for mathematical operations.
Definition: JCalculator.hh:9
std
Definition: jaanetDictionary.h:36