00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef ApproxMVBB_Diameter_Utils_util_hpp
00011 #define ApproxMVBB_Diameter_Utils_util_hpp
00012
00013
00014 #include <cmath>
00015
00016 #include "ApproxMVBB/Config/Config.hpp"
00017 #include ApproxMVBB_TypeDefs_INCLUDE_FILE
00018
00019
00020 #include "ApproxMVBB/Diameter/TypeSegment.hpp"
00021 #include "ApproxMVBB/Diameter/Utils/alloc.hpp"
00022
00023 namespace ApproxMVBB{
00024 namespace Diameter{
00025
00026 APPROXMVBB_EXPORT int _LastPointOutsideSphereWithDiameter( TypeSegment *theSeg,
00027 double constsquareDiameter,
00028 double const**theList,
00029 const int first,
00030 int *last,
00031 const int dim,
00032 const int _reduction_mode_ );
00033
00034 APPROXMVBB_EXPORT int _LastPointOutsideSphereAndBoundWithDiameter( TypeSegment *theSeg,
00035 double constsquareDiameter,
00036 double const**theList,
00037 const int first,
00038 int *last,
00039 const int dim,
00040 const int _reduction_mode_,
00041 double *bound );
00042
00043 APPROXMVBB_EXPORT int _FarthestPointFromSphere( TypeSegment *theSeg,
00044 double const**theList,
00045 const int first,
00046 int *last,
00047 const int dim,
00048 const int _reduction_mode_ );
00049
00050
00051
00052
00053 APPROXMVBB_EXPORT void _CountPointsInSpheres( TypeSegment *theSeg,
00054 double constsquareDiameter,
00055 double const**theList,
00056 const int first,
00057 const int last,
00058 const int dim );
00059
00060
00061
00062
00063 APPROXMVBB_EXPORT double _MaximalSegmentInTwoLists( TypeSegment *theSeg,
00064 const int index1,
00065 double const**theList1,
00066 int *first1,
00067 int *last1,
00068 double const**theList2,
00069 int *first2,
00070 int *last2,
00071 int dim );
00072
00073 APPROXMVBB_EXPORT double _MaximalSegmentInOneList( TypeSegment *theSeg,
00074 const int index,
00075 double const**theList,
00076 int *first,
00077 int *last,
00078 const int dim );
00079
00080 APPROXMVBB_EXPORT double _MaximalDistanceFromPoint( int *index,
00081 double const*ref,
00082 double const**theList,
00083 const int first,
00084 const int last,
00085 const int dim );
00086
00087
00088
00089
00090
00091
00092
00093 APPROXMVBB_EXPORT double _QuadraticDiameterInOneList( TypeSegment *theDiam,
00094 double const**theList,
00095 const int first,
00096 const int last,
00097 const int dim );
00098
00099 APPROXMVBB_EXPORT double _QuadraticDiameterInTwoLists( TypeSegment *theDiam,
00100 int *index1,
00101 int *index2,
00102 double const**theList1,
00103 const int first1,
00104 const int last1,
00105 double const**theList2,
00106 const int first2,
00107 const int last2,
00108 const int dim );
00109
00110
00111 APPROXMVBB_EXPORT void _SwapPoints( double const**theList, const int i, const int j );
00112
00113 struct TypeCounter{
00114 int c1;
00115 int c2;
00116 } ;
00117
00118 APPROXMVBB_EXPORT void _InitCounter( TypeCounter *c );
00119 APPROXMVBB_EXPORT void _AddToCounter( TypeCounter *c, const int i );
00120 APPROXMVBB_EXPORT double _GetCounterAverage( TypeCounter *c, const int i );
00121
00122 #ifdef _STATS_
00123 APPROXMVBB_EXPORT void _InitScalarProductCounter();
00124 APPROXMVBB_EXPORT double _GetScalarProductAverage( int n );
00125 #endif
00126
00127
00128
00129 APPROXMVBB_EXPORT double _SquareDistance( double const*a, double const*b, const int dim );
00130 APPROXMVBB_EXPORT double _SquareDistance3D( double const*a, double const*b );
00131 APPROXMVBB_EXPORT double _SquareDistance2D( double const*a, double const*b );
00132
00133
00134
00135
00136 APPROXMVBB_EXPORT double _ScalarProduct( double const*a, double const*b, double const*c, double const*d, const int dim );
00137 APPROXMVBB_EXPORT double _ScalarProduct3D( double const*a, double const*b, double const*c, double const*d );
00138 APPROXMVBB_EXPORT double _ScalarProduct2D( double const*a, double const*b, double const*c, double const*d );
00139
00140
00141 APPROXMVBB_EXPORT int _FindPointInList( double const**theList,
00142 const int first,
00143 const int last,
00144 double x0,
00145 double x1 );
00146
00147
00148 }
00149 }
00150
00151 #endif
00152
00153