MINT2
HyperPoint.h
Go to the documentation of this file.
1 
10 #ifndef HYPERPOINT_HH
11 #define HYPERPOINT_HH
12 
13 // HyperPlot includes
14 #include "Mint/MessageService.h"
15 #include "Mint/Weights.h"
16 
17 // Root includes
18 #include "TMatrixD.h"
19 #include "TRandom.h"
20 
21 // std includes
22 #include <sstream>
23 #include <iomanip>
24 
25 
26 class HyperPoint : public Weights {
27 
28  protected:
29 
30  std::vector<double> _coords;
33  public:
34 
35  HyperPoint(int dimension);
36  HyperPoint(int dimension, double val);
37  HyperPoint(std::vector<double> coords);
38 
39  //some constuctors for a set number of dimensions
40  HyperPoint(double x1);
41  HyperPoint(double x1, double x2);
42  HyperPoint(double x1, double x2, double x3);
43  HyperPoint(double x1, double x2, double x3, double x4);
44  HyperPoint(double x1, double x2, double x3, double x4, double x5);
45  HyperPoint(double x1, double x2, double x3, double x4, double x5, double x6);
46  HyperPoint(double x1, double x2, double x3, double x4, double x5, double x6, double x7);
47 
48  const std::vector<double>& getVector(){return _coords;}
50  HyperPoint linearTransformation( const TMatrixD& matrix );
51 
52  virtual void print(std::ostream& os=std::cout, int endline=1) const;
53 
54  //std::vector compatibility
55  const double& at(int i) const;
56  double& at(int i);
57 
58  HyperPoint & operator= (const HyperPoint & other);
59  HyperPoint operator+ (const HyperPoint & other) const;
60  HyperPoint operator- (const HyperPoint & other) const;
61 
62  HyperPoint operator- (const double & other) const;
63  HyperPoint operator+ (const double & other) const;
64  HyperPoint operator/ (const double & other) const;
65  HyperPoint operator* (const double & other) const;
66 
67  bool operator <(const HyperPoint& other) const;
68  bool operator >(const HyperPoint& other) const;
69  bool operator <=(const HyperPoint& other) const;
70  bool operator >=(const HyperPoint& other) const;
71  bool operator ==(const HyperPoint& other) const;
72  bool operator !=(const HyperPoint& other) const;
73 
74  bool allLT (const HyperPoint& other) const;
75  bool allGT (const HyperPoint& other) const;
76  bool allLTOE(const HyperPoint& other) const;
77  bool allGTOE(const HyperPoint& other) const;
78 
79  bool operator <(const double& other) const;
80  bool operator >(const double& other) const;
81  bool operator <=(const double& other) const;
82  bool operator >=(const double& other) const;
83  bool operator ==(const double& other) const;
84 
85  double multiplyElements() const;
86 
87 
88  double dotProduct(const HyperPoint & other) const;
89  void fillRandom(double min = -1.0, double max = 1.0);
90  HyperPoint project(const HyperPoint & other) const;
91 
92 
93  double distanceTo(const HyperPoint & other) const;
94  double norm() const;
95  double norm2() const;
96  int size() const {return (int)_coords.size();}
99  int getDimension() const{return size();}
102  bool compatible(const HyperPoint& other, bool printError = true) const;
103 
104  friend std::ostream& operator<<(std::ostream& os, const HyperPoint& point);
105 
106 
107  ~HyperPoint();
108 
109 };
110 
111 
112 
113 #endif
114 
void fillRandom(double min=-1.0, double max=1.0)
Definition: HyperPoint.cpp:157
bool allLTOE(const HyperPoint &other) const
Definition: HyperPoint.cpp:358
bool allGT(const HyperPoint &other) const
Definition: HyperPoint.cpp:347
HyperPoint(int dimension)
Definition: HyperPoint.cpp:6
int size() const
Definition: HyperPoint.h:96
const std::vector< double > & getVector()
Definition: HyperPoint.h:48
virtual void print(std::ostream &os=std::cout, int endline=1) const
Definition: HyperPoint.cpp:453
double dotProduct(const HyperPoint &other) const
Definition: HyperPoint.cpp:147
HyperPoint operator *(const double &other) const
Definition: HyperPoint.cpp:253
bool allLT(const HyperPoint &other) const
Definition: HyperPoint.cpp:336
bool operator >(const HyperPoint &other) const
Definition: HyperPoint.cpp:298
HyperPoint & operator=(const HyperPoint &other)
Definition: HyperPoint.cpp:178
bool operator==(const HyperPoint &other) const
Definition: HyperPoint.cpp:380
bool operator !=(const HyperPoint &other) const
Definition: HyperPoint.cpp:389
friend std::ostream & operator<<(std::ostream &os, const HyperPoint &point)
Definition: HyperPoint.cpp:471
HyperPoint operator-(const HyperPoint &other) const
Definition: HyperPoint.cpp:203
std::vector< double > _coords
Definition: HyperPoint.h:30
bool compatible(const HyperPoint &other, bool printError=true) const
Definition: HyperPoint.cpp:111
double multiplyElements() const
Definition: HyperPoint.cpp:103
HyperPoint operator+(const HyperPoint &other) const
Definition: HyperPoint.cpp:189
bool operator >=(const HyperPoint &other) const
Definition: HyperPoint.cpp:324
const double & at(int i) const
Definition: HyperPoint.cpp:433
bool operator<=(const HyperPoint &other) const
Definition: HyperPoint.cpp:311
HyperPoint project(const HyperPoint &other) const
Definition: HyperPoint.cpp:164
double norm2() const
Definition: HyperPoint.cpp:139
bool operator<(const HyperPoint &other) const
Definition: HyperPoint.cpp:285
HyperPoint operator/(const double &other) const
Definition: HyperPoint.cpp:241
int getDimension() const
Definition: HyperPoint.h:99
double distanceTo(const HyperPoint &other) const
Definition: HyperPoint.cpp:123
HyperPoint linearTransformation(const TMatrixD &matrix)
Definition: HyperPoint.cpp:266
bool allGTOE(const HyperPoint &other) const
Definition: HyperPoint.cpp:369
double norm() const
Definition: HyperPoint.cpp:131