CGAL 5.1.2 - Monotone and Sorted Matrix Search
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

◆ Dynamic_matrix()

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

◆ extract_all_even_rows()

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\).

◆ operator()()

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().

◆ replace_column()

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().

◆ shrink_to_quadratic_size()

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().