diff --git a/Packages/Matrix_search/demo/Matrix_search/README b/Packages/Matrix_search/demo/Matrix_search/README index c9e6d67d895..178b4a02be7 100644 --- a/Packages/Matrix_search/demo/Matrix_search/README +++ b/Packages/Matrix_search/demo/Matrix_search/README @@ -1,4 +1,4 @@ -demo/Matrix_search/README +demo/${PACKAGE}/README --------------------------- Interactive demo programs of some optimisation algorithms in CGAL. diff --git a/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C b/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C index 38b48cde097..6a25b931cf7 100644 --- a/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C +++ b/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C @@ -24,17 +24,42 @@ // Demo program: All Furthest Neighbors for a Convex Polygon // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_POLYGON_2_H #include +#endif // CGAL_POLYGON_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RANDOM_CONVEX_SET_2_H #include +#endif // CGAL_RANDOM_CONVEX_SET_2_H +#ifndef CGAL_ALL_FURTHEST_NEIGHBORS_2_H #include +#endif // CGAL_ALL_FURTHEST_NEIGHBORS_2_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H +#ifndef CGAL_SQUARED_DISTANCE_2_H #include +#endif // CGAL_SQUARED_DISTANCE_2_H +#ifndef CGAL_IO_WINDOW_STREAM_H #include +#endif // CGAL_IO_WINDOW_STREAM_H +#ifndef CGAL_PROTECT_LEDA_POINT_SET_H #include +#define CGAL_PROTECT_LEDA_POINT_SET_H +#endif // CGAL_PROTECT_LEDA_POINT_SET_H +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H typedef double FT; typedef CGAL_Cartesian< FT > R; diff --git a/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C b/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C index b00c0ea43c8..4a9f0eb06a6 100644 --- a/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C +++ b/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C @@ -24,21 +24,55 @@ // Demo program: Compute extremal polygons of a convex polygon // ============================================================================ +#ifndef CGAL_PROTECT_STDLIB_H #include +#define CGAL_PROTECT_STDLIB_H +#endif // CGAL_PROTECT_STDLIB_H +#ifndef CGAL_PROTECT_STDIO_H #include +#define CGAL_PROTECT_STDIO_H +#endif // CGAL_PROTECT_STDIO_H +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_SEGMENT_2_H #include +#endif // CGAL_SEGMENT_2_H +#ifndef CGAL_SQUARED_DISTANCE_2_H #include +#endif // CGAL_SQUARED_DISTANCE_2_H +#ifndef CGAL_CONVEX_HULL_2_H #include +#endif // CGAL_CONVEX_HULL_2_H +#ifndef CGAL_CIRCULATOR_H #include +#endif // CGAL_CIRCULATOR_H +#ifndef CGAL_COPY_N_H #include +#endif // CGAL_COPY_N_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RANDOM_CONVEX_SET_2_H #include +#endif // CGAL_RANDOM_CONVEX_SET_2_H +#ifndef CGAL_EXTREMAL_POLYGON_2_H #include +#endif // CGAL_EXTREMAL_POLYGON_2_H +#ifndef CGAL_IO_LEDA_WINDOW_H #include +#endif // CGAL_IO_LEDA_WINDOW_H +#ifndef CGAL_PROTECT_LEDA_POINT_SET_H #include +#define CGAL_PROTECT_LEDA_POINT_SET_H +#endif // CGAL_PROTECT_LEDA_POINT_SET_H +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H typedef double FT; typedef CGAL_Cartesian< FT > RepClass; diff --git a/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C b/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C index 2dfd3f19c0b..afe78dc75ed 100644 --- a/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C +++ b/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C @@ -24,21 +24,56 @@ // 2-4-Centering Axis-Parallel 2D-Rectangles - demo program // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_ISO_RECTANGLE_2_H #include +#endif // CGAL_ISO_RECTANGLE_2_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_IO_LEDA_WINDOW_H #include +#endif // CGAL_IO_LEDA_WINDOW_H +#ifndef CGAL_IO_OSTREAM_ITERATOR_H #include +#endif // CGAL_IO_OSTREAM_ITERATOR_H +#ifndef CGAL_IO_ISTREAM_ITERATOR_H #include +#endif // CGAL_IO_ISTREAM_ITERATOR_H +#ifndef CGAL_RECTANGULAR_P_CENTER_2_H #include +#endif // CGAL_RECTANGULAR_P_CENTER_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_COPY_N_H #include +#endif // CGAL_COPY_N_H +#ifndef CGAL_LEDA_REAL_H #include +#endif // CGAL_LEDA_REAL_H +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H +#ifndef CGAL_PROTECT_ALGO_H #include +#define CGAL_PROTECT_ALGO_H +#endif // CGAL_PROTECT_ALGO_H +#ifndef CGAL_PROTECT_FUNCTION_H #include +#define CGAL_PROTECT_FUNCTION_H +#endif // CGAL_PROTECT_FUNCTION_H +#ifndef CGAL_PROTECT_STDLIB_H #include +#define CGAL_PROTECT_STDLIB_H +#endif // CGAL_PROTECT_STDLIB_H typedef double FT; // typedef leda_real FT; @@ -59,7 +94,10 @@ typedef ostream_iterator< Square_2 > Ostream_iterator_square; typedef CGAL_Istream_iterator< Point_2, leda_window> Istream_iterator_point; +#ifndef CGAL_PROTECT_TIME_H #include +#define CGAL_PROTECT_TIME_H +#endif // CGAL_PROTECT_TIME_H static time_t Measure; static long long int measure; #define MEASURE(comm) \ diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex index b668d3d3db2..ad98855ec00 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex @@ -16,7 +16,7 @@ for the vertices of a convex polygon. \ccHtmlNoClassToc \begin{ccHtmlClassFile}{all_furthest_neighbors.html} - {Definition of function CGAL_all_furthest_neighbors} + {Definition of function \ccc{CGAL_all_furthest_neighbors}} \ccTexHtml{}{

All Furthest Neighbors

diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex index c91a21c9b27..edd2ed4f007 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex @@ -22,7 +22,7 @@ two predefined traits classes to compute a maximum area (see section \ccHtmlNoClassToc \begin{ccHtmlClassFile}{computing_maximum_area_inscribed_k_gon.html} - {Function Declaration of CGAL_maximum_area_inscribed_k_gon} + {Function Declaration of \ccc{CGAL_maximum_area_inscribed_k_gon}} \ccHtmlNoClassIndex\ccHtmlNoClassLinks %% class wrapper to keep the font at a uniform size: \begin{ccClass}{dummy} @@ -86,7 +86,7 @@ two predefined traits classes to compute a maximum area (see section \ccHtmlNoClassToc \begin{ccHtmlClassFile}{computing_maximum_perimeter_inscribed_k_gon.html} - {Function Declaration of CGAL_maximum_perimeter_inscribed_k_gon} + {Function Declaration of \ccc{CGAL_maximum_perimeter_inscribed_k_gon}} \ccHtmlNoClassIndex\ccHtmlNoClassLinks %% class wrapper to keep the font at a uniform size: \begin{ccClass}{dummy} @@ -155,7 +155,7 @@ two predefined traits classes to compute a maximum area (see section \begin{ccAdvanced} \ccHtmlNoClassToc \begin{ccHtmlClassFile}{computing_general_extremal_polygons.html} - {Function Declaration of CGAL_extremal_polygon} + {Function Declaration of \ccc{CGAL_extremal_polygon}} \ccHtmlNoClassIndex\ccHtmlNoClassLinks %% class wrapper to keep the font at a uniform size: \begin{ccClass}{dummy} diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex index 937f67ce994..ed910b65021 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex @@ -16,7 +16,7 @@ \ccHtmlNoClassToc \begin{ccHtmlClassFile}{monotone_matrix_search.html} - {Function Declaration of CGAL_monotone_matrix_search} + {Function Declaration of \ccc{CGAL_monotone_matrix_search}} \ccTexHtml{}{

Monotone Matrix Search

diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex index 0a306104bfe..13972a60c01 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex @@ -17,7 +17,7 @@ minimal distance between both sets is minimized. \ccHtmlNoClassToc \begin{ccHtmlClassFile}{rectangular_p_centers.html} - {Definition of function CGAL_rectangular_p_center_2} + {Definition of function \ccc{CGAL_rectangular_p_center_2}} \ccTexHtml{}{

Rectangular p-Centers

@@ -28,30 +28,30 @@ minimal distance between both sets is minimized. More formally the problem can be defined as follows. - \ccTexHtml{Given a finite set ${\cal P}$ of points, compute a point - set ${\cal C}$ with $|{\cal C}| \le p$ such that the $p$-radius of - ${\cal P}$, + \ccTexHtml{Given a finite set $\mathcal{P}$ of points, compute a + point set $\mathcal{C}$ with $|\mathcal{C}| \le p$ such that the + $p$-radius of $\mathcal{P}$, $$ - rad_p({\cal P}) := \max_{P \in {\cal P}} \min_{Q \in {\cal C}} || P - - Q ||_\infty + rad_p(\mathcal{P}) := \max_{P \in \mathcal{P}} \min_{Q \in + \mathcal{C}} || P - Q ||_\infty $$ - is minimized. We can interpret ${\cal C}$ as the best - approximation (with respect to the given metric) for ${\cal P}$ + is minimized. We can interpret $\mathcal{C}$ as the best + approximation (with respect to the given metric) for $\mathcal{P}$ with at most $p$ points.}{Given a finite set tex2html_wrap_inline17 of points, compute a point set tex2html_wrap_inline19 with tex2html_wrap_inline21 such that the p-radius of + SRC="./MatrixSearch_pcenter3.gif" > such that the p-radius + of tex2html_wrap_inline17 , +

displaymath27

is minimized. We can + interpret tex2html_wrap_inline19 + as the best approximation (with respect to the given metric) for tex2html_wrap_inline17 ,

displaymath27 -

is minimized. We can interpret tex2html_wrap_inline19 as the best approximation (with - respect to the given metric) for tex2html_wrap_inline17 with at most p points.} \ccInclude{CGAL/rectangular_p_center_2.h} @@ -94,8 +94,8 @@ minimal distance between both sets is minimized. \ccImplementation The implementation uses sorted matrix search (see section \ref{secSortedMatrixSearch}) and fast algorithms for piercing rectangles\cite{sw-rpppp-96} which leads to a runtime - complexity of ${\cal O}(n \cdot \log n)$ where $n$ is the number of - input points. + complexity of $\mathcal{O}(n \cdot \log n)$ where $n$ is the number + of input points. \ccExample The following code generates a random set of ten points and computes its two-centers. diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex index 0447152aa0e..d3f39cf0709 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex @@ -15,7 +15,7 @@ entry in a set of sorted matrices that fulfills a certain criterion. \ccHtmlNoClassToc\begin{ccHtmlClassFile}{sorted_matrix_search.html} - {Function Declaration of CGAL_sorted_matrix_search} + {Function Declaration of \ccc{CGAL_sorted_matrix_search}} \ccTexHtml{}{

Sorted Matrix Search

@@ -31,9 +31,9 @@ \forall \, 1 \le i < r,\; 1 \le j \le l\; :\; m_{i j} \le m_{(i+1) j} \;\;. \end{eqnarray*} - - Now let ${\cal M}$ be a set of $n$ sorted matrices over $S$ and $f$ be - a monotone predicate on $S$, i.e. + + Now let $\mathcal{M}$ be a set of $n$ sorted matrices over $S$ + and $f$ be a monotone predicate on $S$, i.e. $$ f\: :\: S \longrightarrow\, \textit{bool} \quad{\rm with}\quad f(r) \;\Longrightarrow\; \forall\, t \in S\,,\: t > r \; :\; f(t)\;. @@ -47,12 +47,12 @@ matrices over S and f be a monotone predicate on S, i.e.

displaymath32


} - - If we assume there is any feasible element in one of the matrices in - \ccTexHtml{${\cal M}$}{tex2html_wrap_inline21}, there - certainly is a smallest such element. This is the one we are - searching for. + + If we assume there is any feasible element in one of the matrices + in \ccTexHtml{$\mathcal{M}$}{tex2html_wrap_inline21}, there certainly is a smallest such element. This is the one + we are searching for. The feasibility test as well as some other parameters can (and have to) be customized through a traits class. The requirements for this @@ -85,10 +85,10 @@ \ccImplementation The implementation uses an algorithm by Frederickson and Johnson\cite{fj-fkppc-83},\cite{fj-gsrsm-84} and - runs in ${\cal O}(n \cdot k + f \cdot \log (n \cdot k))$, where $n$ - is the number of input matrices, $k$ denotes the maximal dimension - of any input matrix and $f$ the time needed for one feasibility - test. + runs in $\mathcal{O}(n \cdot k + f \cdot \log (n \cdot k))$, where + $n$ is the number of input matrices, $k$ denotes the maximal + dimension of any input matrix and $f$ the time needed for one + feasibility test. \ccExample In the following program we build a random vector $a = (a_i)_{i = 1,\,\ldots,\,5}$ (elements drawn uniformly from $\{ diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex index b668d3d3db2..ad98855ec00 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex @@ -16,7 +16,7 @@ for the vertices of a convex polygon. \ccHtmlNoClassToc \begin{ccHtmlClassFile}{all_furthest_neighbors.html} - {Definition of function CGAL_all_furthest_neighbors} + {Definition of function \ccc{CGAL_all_furthest_neighbors}} \ccTexHtml{}{

All Furthest Neighbors

diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex index c91a21c9b27..edd2ed4f007 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex @@ -22,7 +22,7 @@ two predefined traits classes to compute a maximum area (see section \ccHtmlNoClassToc \begin{ccHtmlClassFile}{computing_maximum_area_inscribed_k_gon.html} - {Function Declaration of CGAL_maximum_area_inscribed_k_gon} + {Function Declaration of \ccc{CGAL_maximum_area_inscribed_k_gon}} \ccHtmlNoClassIndex\ccHtmlNoClassLinks %% class wrapper to keep the font at a uniform size: \begin{ccClass}{dummy} @@ -86,7 +86,7 @@ two predefined traits classes to compute a maximum area (see section \ccHtmlNoClassToc \begin{ccHtmlClassFile}{computing_maximum_perimeter_inscribed_k_gon.html} - {Function Declaration of CGAL_maximum_perimeter_inscribed_k_gon} + {Function Declaration of \ccc{CGAL_maximum_perimeter_inscribed_k_gon}} \ccHtmlNoClassIndex\ccHtmlNoClassLinks %% class wrapper to keep the font at a uniform size: \begin{ccClass}{dummy} @@ -155,7 +155,7 @@ two predefined traits classes to compute a maximum area (see section \begin{ccAdvanced} \ccHtmlNoClassToc \begin{ccHtmlClassFile}{computing_general_extremal_polygons.html} - {Function Declaration of CGAL_extremal_polygon} + {Function Declaration of \ccc{CGAL_extremal_polygon}} \ccHtmlNoClassIndex\ccHtmlNoClassLinks %% class wrapper to keep the font at a uniform size: \begin{ccClass}{dummy} diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex index 937f67ce994..ed910b65021 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_monotone_matrix_search.tex @@ -16,7 +16,7 @@ \ccHtmlNoClassToc \begin{ccHtmlClassFile}{monotone_matrix_search.html} - {Function Declaration of CGAL_monotone_matrix_search} + {Function Declaration of \ccc{CGAL_monotone_matrix_search}} \ccTexHtml{}{

Monotone Matrix Search

diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex index 0a306104bfe..13972a60c01 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex @@ -17,7 +17,7 @@ minimal distance between both sets is minimized. \ccHtmlNoClassToc \begin{ccHtmlClassFile}{rectangular_p_centers.html} - {Definition of function CGAL_rectangular_p_center_2} + {Definition of function \ccc{CGAL_rectangular_p_center_2}} \ccTexHtml{}{

Rectangular p-Centers

@@ -28,30 +28,30 @@ minimal distance between both sets is minimized. More formally the problem can be defined as follows. - \ccTexHtml{Given a finite set ${\cal P}$ of points, compute a point - set ${\cal C}$ with $|{\cal C}| \le p$ such that the $p$-radius of - ${\cal P}$, + \ccTexHtml{Given a finite set $\mathcal{P}$ of points, compute a + point set $\mathcal{C}$ with $|\mathcal{C}| \le p$ such that the + $p$-radius of $\mathcal{P}$, $$ - rad_p({\cal P}) := \max_{P \in {\cal P}} \min_{Q \in {\cal C}} || P - - Q ||_\infty + rad_p(\mathcal{P}) := \max_{P \in \mathcal{P}} \min_{Q \in + \mathcal{C}} || P - Q ||_\infty $$ - is minimized. We can interpret ${\cal C}$ as the best - approximation (with respect to the given metric) for ${\cal P}$ + is minimized. We can interpret $\mathcal{C}$ as the best + approximation (with respect to the given metric) for $\mathcal{P}$ with at most $p$ points.}{Given a finite set tex2html_wrap_inline17 of points, compute a point set tex2html_wrap_inline19 with tex2html_wrap_inline21 such that the p-radius of + SRC="./MatrixSearch_pcenter3.gif" > such that the p-radius + of tex2html_wrap_inline17 , +

displaymath27

is minimized. We can + interpret tex2html_wrap_inline19 + as the best approximation (with respect to the given metric) for tex2html_wrap_inline17 ,

displaymath27 -

is minimized. We can interpret tex2html_wrap_inline19 as the best approximation (with - respect to the given metric) for tex2html_wrap_inline17 with at most p points.} \ccInclude{CGAL/rectangular_p_center_2.h} @@ -94,8 +94,8 @@ minimal distance between both sets is minimized. \ccImplementation The implementation uses sorted matrix search (see section \ref{secSortedMatrixSearch}) and fast algorithms for piercing rectangles\cite{sw-rpppp-96} which leads to a runtime - complexity of ${\cal O}(n \cdot \log n)$ where $n$ is the number of - input points. + complexity of $\mathcal{O}(n \cdot \log n)$ where $n$ is the number + of input points. \ccExample The following code generates a random set of ten points and computes its two-centers. diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex index 0447152aa0e..d3f39cf0709 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex @@ -15,7 +15,7 @@ entry in a set of sorted matrices that fulfills a certain criterion. \ccHtmlNoClassToc\begin{ccHtmlClassFile}{sorted_matrix_search.html} - {Function Declaration of CGAL_sorted_matrix_search} + {Function Declaration of \ccc{CGAL_sorted_matrix_search}} \ccTexHtml{}{

Sorted Matrix Search

@@ -31,9 +31,9 @@ \forall \, 1 \le i < r,\; 1 \le j \le l\; :\; m_{i j} \le m_{(i+1) j} \;\;. \end{eqnarray*} - - Now let ${\cal M}$ be a set of $n$ sorted matrices over $S$ and $f$ be - a monotone predicate on $S$, i.e. + + Now let $\mathcal{M}$ be a set of $n$ sorted matrices over $S$ + and $f$ be a monotone predicate on $S$, i.e. $$ f\: :\: S \longrightarrow\, \textit{bool} \quad{\rm with}\quad f(r) \;\Longrightarrow\; \forall\, t \in S\,,\: t > r \; :\; f(t)\;. @@ -47,12 +47,12 @@ matrices over S and f be a monotone predicate on S, i.e.

displaymath32


} - - If we assume there is any feasible element in one of the matrices in - \ccTexHtml{${\cal M}$}{tex2html_wrap_inline21}, there - certainly is a smallest such element. This is the one we are - searching for. + + If we assume there is any feasible element in one of the matrices + in \ccTexHtml{$\mathcal{M}$}{tex2html_wrap_inline21}, there certainly is a smallest such element. This is the one + we are searching for. The feasibility test as well as some other parameters can (and have to) be customized through a traits class. The requirements for this @@ -85,10 +85,10 @@ \ccImplementation The implementation uses an algorithm by Frederickson and Johnson\cite{fj-fkppc-83},\cite{fj-gsrsm-84} and - runs in ${\cal O}(n \cdot k + f \cdot \log (n \cdot k))$, where $n$ - is the number of input matrices, $k$ denotes the maximal dimension - of any input matrix and $f$ the time needed for one feasibility - test. + runs in $\mathcal{O}(n \cdot k + f \cdot \log (n \cdot k))$, where + $n$ is the number of input matrices, $k$ denotes the maximal + dimension of any input matrix and $f$ the time needed for one + feasibility test. \ccExample In the following program we build a random vector $a = (a_i)_{i = 1,\,\ldots,\,5}$ (elements drawn uniformly from $\{ diff --git a/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C b/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C index 4e8720af997..ee61e063174 100644 --- a/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C @@ -24,15 +24,35 @@ // Example program: All Furthest Neighbors for a Convex Polygon // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_POLYGON_2_H #include +#endif // CGAL_POLYGON_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RANDOM_CONVEX_SET_2_H #include +#endif // CGAL_RANDOM_CONVEX_SET_2_H +#ifndef CGAL_ALL_FURTHEST_NEIGHBORS_2_H #include +#endif // CGAL_ALL_FURTHEST_NEIGHBORS_2_H +#ifndef CGAL_IO_OSTREAM_ITERATOR_H #include +#endif // CGAL_IO_OSTREAM_ITERATOR_H +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H typedef double FT; typedef CGAL_Cartesian< FT > R; diff --git a/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C b/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C index 6a603a64822..b1ac85110ff 100644 --- a/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C @@ -24,14 +24,32 @@ // Example program: Compute extremal polygons of a convex polygon // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_POLYGON_2_H #include +#endif // CGAL_POLYGON_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RANDOM_CONVEX_SET_2_H #include +#endif // CGAL_RANDOM_CONVEX_SET_2_H +#ifndef CGAL_EXTREMAL_POLYGON_2_H #include +#endif // CGAL_EXTREMAL_POLYGON_2_H +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H int main() { diff --git a/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C b/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C index df3913305c5..c8dbb870606 100644 --- a/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C @@ -24,14 +24,32 @@ // 2-4-Centering Axis-Parallel 2D-Rectangles - example program // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RECTANGULAR_P_CENTER_2_H #include +#endif // CGAL_RECTANGULAR_P_CENTER_2_H +#ifndef CGAL_COPY_N_H #include +#endif // CGAL_COPY_N_H +#ifndef CGAL_IO_OSTREAM_ITERATOR_H #include +#endif // CGAL_IO_OSTREAM_ITERATOR_H +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H typedef double FT; typedef CGAL_Cartesian< FT > R; diff --git a/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C b/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C index 4f6220a35ce..b75ec93522f 100644 --- a/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C @@ -24,11 +24,22 @@ // Sorted matrix search: Example Program // ============================================================================ +#ifndef CGAL_RANDOM_H #include +#endif // CGAL_RANDOM_H +#ifndef CGAL_FUNCTION_OBJECTS_H #include +#endif // CGAL_FUNCTION_OBJECTS_H +#ifndef CGAL_CARTESIAN_MATRIX_H #include +#endif // CGAL_CARTESIAN_MATRIX_H +#ifndef CGAL_SORTED_MATRIX_SEARCH_H #include +#endif // CGAL_SORTED_MATRIX_SEARCH_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H int main() { diff --git a/Packages/Matrix_search/include/CGAL/Dynamic_matrix.h b/Packages/Matrix_search/include/CGAL/Dynamic_matrix.h index 8f98a3079bc..168eff5fc83 100644 --- a/Packages/Matrix_search/include/CGAL/Dynamic_matrix.h +++ b/Packages/Matrix_search/include/CGAL/Dynamic_matrix.h @@ -38,10 +38,9 @@ class CGAL_Dynamic_matrix // and extraction of all even rows in linear time { public: - typedef vector< int > CoordContainer; - typedef CGAL_Dynamic_matrix< Matrix > - ThisMatrixClass; - typedef typename Matrix::Value Value; + typedef vector< int > CoordContainer; + typedef CGAL_Dynamic_matrix< Matrix > ThisMatrixClass; + typedef typename Matrix::Value Value; CGAL_Dynamic_matrix( const Matrix& m, int r_p = 0) @@ -50,7 +49,7 @@ public: row_power( r_p), row_offset( (1 << r_p) - 1) { - for ( int i( 0); i < column_indices.size(); ++i) + for ( unsigned int i( 0); i < column_indices.size(); ++i) column_indices[i] = i; } diff --git a/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h b/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h index 4065cdd8470..f4182d1cf1c 100644 --- a/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h +++ b/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h @@ -968,14 +968,18 @@ CGAL_three_pierce_rectangles( OutputIterator o, bool& ok) { - int number_of_points( CGAL_iterator_distance( f, l)); +#ifdef CGAL_CFG_NO_ITERATOR_TRAITS + typedef ptrdiff_t difference_type; +#else // CGAL_CFG_NO_ITERATOR_TRAITS // + typedef typename iterator_traits< RandomAccessIC >::difference_type + difference_type; +#endif // CGAL_CFG_NO_ITERATOR_TRAITS // + difference_type number_of_points( CGAL_iterator_distance( f, l)); CGAL_optimisation_precondition( number_of_points > 0); // typedefs: - typedef typename Traits::Point_2 - Point_2; - typedef typename Traits::Iso_rectangle_2 - Iso_rectangle_2; + typedef typename Traits::Point_2 Point_2; + typedef typename Traits::Iso_rectangle_2 Iso_rectangle_2; typedef CGAL_Has_on_unbounded_side< Iso_rectangle_2, Point_2 > Has_on_unbounded_side; @@ -1451,9 +1455,6 @@ CGAL_four_pierce_rectangles( - // one-piercing intervall of s[LR]: - Intervall I_LR; - // one-piercing intervall of s[BT]: Intervall I_BT; diff --git a/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C b/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C index 0cb4c989a07..54facba5913 100644 --- a/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C +++ b/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C @@ -24,13 +24,28 @@ // Test program: All Furthest Neighbors for a Convex Polygon // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_POLYGON_2_H #include +#endif // CGAL_POLYGON_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RANDOM_CONVEX_SET_2_H #include +#endif // CGAL_RANDOM_CONVEX_SET_2_H +#ifndef CGAL_ALL_FURTHEST_NEIGHBORS_2_H #include +#endif // CGAL_ALL_FURTHEST_NEIGHBORS_2_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H typedef double FT; typedef CGAL_Cartesian< FT > R; @@ -44,9 +59,16 @@ typedef CGAL_Random_points_in_square_2< CGAL_Creator_uniform_2< FT, Point_2 > > Point_generator; +#ifndef CGAL_SQUARED_DISTANCE_2_H #include +#endif // CGAL_SQUARED_DISTANCE_2_H +#ifndef CGAL_CIRCULATOR_H #include +#endif // CGAL_CIRCULATOR_H +#ifndef CGAL_PROTECT_ALGO_H #include +#define CGAL_PROTECT_ALGO_H +#endif // CGAL_PROTECT_ALGO_H template < class RandomAccessIC, class OutputIterator > diff --git a/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C b/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C index 1ce5f354132..643fe5a93c1 100644 --- a/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C +++ b/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C @@ -24,19 +24,43 @@ // Test program: Compute extremal polygons of a convex polygon // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RANDOM_CONVEX_SET_2_H #include +#endif // CGAL_RANDOM_CONVEX_SET_2_H +#ifndef CGAL_EXTREMAL_POLYGON_2_H #include +#endif // CGAL_EXTREMAL_POLYGON_2_H +#ifndef CGAL_PROTECT_FUNCTION_H #include +#define CGAL_PROTECT_FUNCTION_H +#endif // CGAL_PROTECT_FUNCTION_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H +#ifndef CGAL_PROTECT_DEQUE_H #include +#define CGAL_PROTECT_DEQUE_H +#endif // CGAL_PROTECT_DEQUE_H /* +#ifndef CGAL_LEDA_REAL_H #include +#endif // CGAL_LEDA_REAL_H +#ifndef CGAL_PROTECT_ALGO_H #include +#define CGAL_PROTECT_ALGO_H +#endif // CGAL_PROTECT_ALGO_H */ // typedefs: diff --git a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C index 1c255e5b4ad..29a1a3638cb 100644 --- a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C +++ b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C @@ -24,21 +24,52 @@ // 2-4-Centering Axis-Parallel 2D-Rectangles - test program // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_VECTOR_2_H #include +#endif // CGAL_VECTOR_2_H +#ifndef CGAL_ISO_RECTANGLE_2_H #include +#endif // CGAL_ISO_RECTANGLE_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RECTANGULAR_P_CENTER_2_H #include +#endif // CGAL_RECTANGULAR_P_CENTER_2_H +#ifndef CGAL_COPY_N_H #include +#endif // CGAL_COPY_N_H +#ifndef CGAL_RANDOM_H #include +#endif // CGAL_RANDOM_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H +#ifndef CGAL_PROTECT_FUNCTION_H #include +#define CGAL_PROTECT_FUNCTION_H +#endif // CGAL_PROTECT_FUNCTION_H +#ifndef CGAL_PROTECT_ALGO_H #include +#define CGAL_PROTECT_ALGO_H +#endif // CGAL_PROTECT_ALGO_H #ifdef OUTPUT +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H #endif +#ifndef CGAL_PROTECT_STDLIB_H #include +#define CGAL_PROTECT_STDLIB_H +#endif // CGAL_PROTECT_STDLIB_H // function class to construct a box // around a point p with radius r diff --git a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C index aeecb116d9b..ec65c551371 100644 --- a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C +++ b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C @@ -24,21 +24,52 @@ // 2-4-Centering Axis-Parallel 2D-Rectangles - test program // ============================================================================ +#ifndef CGAL_CARTESIAN_H #include +#endif // CGAL_CARTESIAN_H +#ifndef CGAL_POINT_2_H #include +#endif // CGAL_POINT_2_H +#ifndef CGAL_VECTOR_2_H #include +#endif // CGAL_VECTOR_2_H +#ifndef CGAL_ISO_RECTANGLE_2_H #include +#endif // CGAL_ISO_RECTANGLE_2_H +#ifndef CGAL_POINT_GENERATORS_2_H #include +#endif // CGAL_POINT_GENERATORS_2_H +#ifndef CGAL_RECTANGULAR_P_CENTER_2_H #include +#endif // CGAL_RECTANGULAR_P_CENTER_2_H +#ifndef CGAL_COPY_N_H #include +#endif // CGAL_COPY_N_H +#ifndef CGAL_RANDOM_H #include +#endif // CGAL_RANDOM_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H +#ifndef CGAL_PROTECT_FUNCTION_H #include +#define CGAL_PROTECT_FUNCTION_H +#endif // CGAL_PROTECT_FUNCTION_H +#ifndef CGAL_PROTECT_ALGO_H #include +#define CGAL_PROTECT_ALGO_H +#endif // CGAL_PROTECT_ALGO_H #ifdef OUTPUT +#ifndef CGAL_PROTECT_IOSTREAM_H #include +#define CGAL_PROTECT_IOSTREAM_H +#endif // CGAL_PROTECT_IOSTREAM_H #endif +#ifndef CGAL_PROTECT_STDLIB_H #include +#define CGAL_PROTECT_STDLIB_H +#endif // CGAL_PROTECT_STDLIB_H // function class to construct a box // around a point p with radius r diff --git a/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C b/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C index 197c9167116..38fe52c513e 100644 --- a/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C +++ b/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C @@ -24,11 +24,22 @@ // Sorted matrix search: Test Program // ============================================================================ +#ifndef CGAL_RANDOM_H #include +#endif // CGAL_RANDOM_H +#ifndef CGAL_FUNCTION_OBJECTS_H #include +#endif // CGAL_FUNCTION_OBJECTS_H +#ifndef CGAL_CARTESIAN_MATRIX_H #include +#endif // CGAL_CARTESIAN_MATRIX_H +#ifndef CGAL_SORTED_MATRIX_SEARCH_H #include +#endif // CGAL_SORTED_MATRIX_SEARCH_H +#ifndef CGAL_PROTECT_VECTOR_H #include +#define CGAL_PROTECT_VECTOR_H +#endif // CGAL_PROTECT_VECTOR_H template < class Matrix_iterator, class Value > Value compute_upper_bound( Matrix_iterator f,