## CGAL::Dynamic_matrix<M>

| advanced |

### Definition

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

### Requirements

M is a model for BasicMatrix.

#include <CGAL/Dynamic_matrix.h>

### Is Model for the Concept

MonotoneMatrixSearchTraits
BasicMatrix

### Creation

Dynamic_matrix<M> d ( M m);
| initializes d to m. m is not copied, we only store a reference.

### Operations

int | d.number_of_columns ()
|  | returns the number of columns.
int | d.number_of_rows ()
|  | returns the number of rows.
Entry | d ( int row, int column)
|  | returns the entry at position (row, column). Precondition: 0 row < number_of_rows() and 0 column < number_of_columns().
void | d.replace_column ( int old, int new)
|  | replace column old with column number new. Precondition: 0 old, new < number_of_columns().
Matrix* | d.extract_all_even_rows ()
|  | returns a new Matrix consisting of all rows of d with even index, (i.e. first row is row 0 of d, second row is row 2 of d etc.). Precondition: number_of_rows() > 0.
void | d.shrink_to_quadratic_size ()
|  | deletes the rightmost columns, such that d becomes quadratic. Precondition: number_of_columns() number_of_rows(). Postcondition: number_of_rows() == number_of_columns().

### 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.

| advanced |