MLPACK
1.0.7
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
mlpack
core
tree
ballbound.hpp
Go to the documentation of this file.
1
23
#ifndef __MLPACK_CORE_TREE_BALLBOUND_HPP
24
#define __MLPACK_CORE_TREE_BALLBOUND_HPP
25
26
#include <
mlpack/core.hpp
>
27
#include <
mlpack/core/metrics/lmetric.hpp
>
28
29
namespace
mlpack {
30
namespace
bound {
31
37
template
<
typename
VecType = arma::vec>
38
class
BallBound
39
{
40
public
:
41
typedef
VecType
Vec
;
42
43
private
:
44
double
radius
;
45
VecType
center
;
46
47
public
:
48
BallBound
() :
radius
(0) { }
49
55
BallBound
(
const
size_t
dimension) :
radius
(0),
center
(dimension) { }
56
63
BallBound
(
const
double
radius
,
const
VecType&
center
) :
64
radius(radius), center(center) { }
65
67
double
Radius
()
const
{
return
radius
; }
69
double
&
Radius
() {
return
radius
; }
70
72
const
VecType&
Center
()
const
{
return
center
; }
74
VecType&
Center
() {
return
center
; }
75
76
// Get the range in a certain dimension.
77
math::Range
operator[]
(
const
size_t
i)
const
;
78
82
bool
Contains
(
const
VecType& point)
const
;
83
91
void
CalculateMidpoint
(VecType& centroid)
const
;
92
96
double
MinDistance
(
const
VecType& point)
const
;
97
101
double
MinDistance
(
const
BallBound
& other)
const
;
102
106
double
MaxDistance
(
const
VecType& point)
const
;
107
111
double
MaxDistance
(
const
BallBound
& other)
const
;
112
116
math::Range
RangeDistance
(
const
VecType& other)
const
;
117
123
math::Range
RangeDistance
(
const
BallBound
& other)
const
;
124
128
const
BallBound
&
operator|=
(
const
BallBound
& other);
129
138
template
<
typename
MatType>
139
const
BallBound
&
operator|=
(
const
MatType& data);
140
144
std::string
ToString
()
const
;
145
146
};
147
148
};
// namespace bound
149
};
// namespace mlpack
150
151
#include "ballbound_impl.hpp"
152
153
#endif // __MLPACK_CORE_TREE_DBALLBOUND_HPP
Generated by
1.8.3.1