\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.10.1 - Monotone and Sorted Matrix Search
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Dynamic_matrix< M > Class Template Reference

#include <CGAL/Dynamic_matrix.h>

Definition

The class Dynamic_matrix is an adaptor for an arbitrary matrix class M to provide the dynamic operations needed for monotone matrix search.

Template Parameters
<tt>M</tt>is a model of BasicMatrix.
Is Model Of:

MonotoneMatrixSearchTraits

BasicMatrix

See Also
CGAL::monotone_matrix_search()
MonotoneMatrixSearchTraits
BasicMatrix

Implementation

All operations take constant time except for extract_all_even_rows() which needs time linear in the number of rows.

Creation

 Dynamic_matrix (const M &m)
 initializes the dynamic matrix to m. More...
 

Operations

int number_of_columns () const
 returns the number of columns.
 
int number_of_rows () const
 returns the number of rows.
 
Entry operator() (int row, int column) const
 returns the entry at position (row, column). More...
 
void replace_column (int old, int new)
 replace column old with column number new. More...
 
Matrix * extract_all_even_rows () const
 returns a new matrix consisting of all rows of the dynmic matrix with even index, (i.e. first row is row \( 0\) of the dynamic matrix, second row is row \( 2\) of the dynamic matrix, etc.). More...
 
void shrink_to_quadratic_size ()
 deletes the rightmost columns, such that the dynamic matrix becomes quadratic. More...
 

Constructor & Destructor Documentation

template<typename M >
CGAL::Dynamic_matrix< M >::Dynamic_matrix ( const M &  m)

initializes the dynamic matrix to m.

m is not copied, we only store a reference.

Member Function Documentation

template<typename M >
Matrix* CGAL::Dynamic_matrix< M >::extract_all_even_rows ( ) const

returns a new matrix consisting of all rows of the dynmic matrix with even index, (i.e. first row is row \( 0\) of the dynamic matrix, second row is row \( 2\) of the dynamic matrix, etc.).

Precondition
number_of_rows() \( > 0\).
template<typename M >
Entry CGAL::Dynamic_matrix< M >::operator() ( int  row,
int  column 
) const

returns the entry at position (row, column).

Precondition
\( 0 \le\) row \( <\) number_of_rows(), and \( 0 \le\) column \( <\) number_of_columns().
template<typename M >
void CGAL::Dynamic_matrix< M >::replace_column ( int  old,
int  new 
)

replace column old with column number new.

Precondition
\( 0 \le\) old, new \( <\) number_of_columns().
template<typename M >
void CGAL::Dynamic_matrix< M >::shrink_to_quadratic_size ( )

deletes the rightmost columns, such that the dynamic matrix becomes quadratic.

Precondition
number_of_columns() \( \ge\) number_of_rows().
Postcondition
number_of_rows() \( ==\) number_of_columns().