BICO 1.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Pages
point.h
Go to the documentation of this file.
1 #ifndef POINT_H
2 #define POINT_H
3
4 #include <iostream>
5 #include <vector>
6
7 #include "../base/weightedobject.h"
8
9 namespace CluE
10 {
11
17 class Point : public WeightedObject
18 {
19 public:
23 Point(size_t dimension = 0, double pointWeight = 1.0):coordinates(std::vector<double>(dimension)),weight(pointWeight)
24 {
25 }
26
30 Point(std::vector<double> coords, double pointWeight = 1.0):coordinates(coords),weight(pointWeight)
31 {
32 }
33
38 Point(std::vector<Point*> const&);
39
43 Point(Point const& p):coordinates(p.coordinates),weight(p.weight)
44 {
45 }
46
47 virtual ~Point()
48 {
49 }
50
54 Point& operator+=(Point const & x);
55
59 Point& operator-=(Point const & x);
60
64 Point operator+(Point const & x) const;
65
69 Point operator-(Point const & x) const;
70
74 double& operator[](size_t index)
75 {
76 return this->coordinates[index];
77 }
78
82 double operator[](size_t index) const
83 {
84 return this->coordinates[index];
85 }
86
87 size_t dimension() const
88 {
89 return this->coordinates.size();
90 }
91
92 virtual double getWeight() const
93 {
94 return this->weight;
95 }
96
97 virtual void setWeight(double w)
98 {
99 this->weight = w;
100 }
101
105 double squaredL1distance(Point const&) const;
106
110 double l1distance(Point const&) const;
111
115 double squaredL2distance(Point const&) const;
116
120 double l2distance(Point const&) const;
121
125 double lpdistance(Point const&, double p) const;
126
130 double squaredLpDistance(Point const&, double p) const;
131
136 double kullbackleibler(Point const&) const;
137
138 private:
139 std::vector<double> coordinates;
140 double weight;
141 };
142
143 std::ostream& operator<<(std::ostream&, Point const&);
144
145 Point operator*(double scalar, Point const & vec);
146
150 double operator*(Point const & vec1, Point const & vec2);
151
152 }
153
154 #endif
CluE::WeightedObject
Abstract base class for weighted objects.
Definition: weightedobject.h:10
CluE::Point::l2distance
double l2distance(Point const &) const
Definition: point.cpp:119
CluE::Point::Point
Point(std::vector< double > coords, double pointWeight=1.0)
Constructs a weighted point.
Definition: point.h:30
CluE::Point::dimension
size_t dimension() const
Definition: point.h:87
CluE::Point::operator+=
Point & operator+=(Point const &x)
Definition: point.cpp:48
CluE::Point::operator-=
Point & operator-=(Point const &x)
Definition: point.cpp:61
CluE::Point::squaredLpDistance
double squaredLpDistance(Point const &, double p) const
Definition: point.cpp:142
CluE::Point::Point
Point(Point const &p)
Copy constructor.
Definition: point.h:43
CluE::Point::weight
double weight
Definition: point.h:140
CluE::Point::coordinates
std::vector< double > coordinates
Definition: point.h:139
CluE::Point::~Point
virtual ~Point()
Definition: point.h:47
CluE::Point::squaredL2distance
double squaredL2distance(Point const &) const
Definition: point.cpp:103
CluE::Point::lpdistance
double lpdistance(Point const &, double p) const
Definition: point.cpp:124
CluE::Point::Point
Point(size_t dimension=0, double pointWeight=1.0)
Constructs a weighted point.
Definition: point.h:23
CluE::Point::kullbackleibler
double kullbackleibler(Point const &) const
Definition: point.cpp:147
CluE::Point::operator+
Point operator+(Point const &x) const
Definition: point.cpp:74
CluE::Point::squaredL1distance
double squaredL1distance(Point const &) const
Definition: point.cpp:97
CluE::Point::operator[]
double & operator[](size_t index)
Definition: point.h:74
CluE::operator*
Point operator*(double scalar, Point const &vec)
Definition: point.cpp:201
CluE::Point
Weighted point of arbitrary dimension.
Definition: point.h:17
CluE::Point::operator[]
double operator[](size_t index) const
Definition: point.h:82
CluE::Point::getWeight
virtual double getWeight() const
Definition: point.h:92
CluE::Point::operator-
Point operator-(Point const &x) const
Definition: point.cpp:79
CluE::Point::l1distance
double l1distance(Point const &) const
Definition: point.cpp:84
CluE::operator<<
std::ostream & operator<<(std::ostream &, Point const &)
Definition: point.cpp:187
CluE::Point::setWeight
virtual void setWeight(double w)
Definition: point.h:97