CGAL 4.7 - Monotone and Sorted Matrix Search
|
#include <CGAL/Dynamic_matrix.h>
The class Dynamic_matrix
is an adaptor for an arbitrary matrix class M
to provide the dynamic operations needed for monotone matrix search.
M
is a model for 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... | |
CGAL::Dynamic_matrix< M >::Dynamic_matrix | ( | const M & | m) |
initializes the dynamic matrix to m
.
m
is not copied, we only store a reference.
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.).
number_of_rows()
\( > 0\). Entry CGAL::Dynamic_matrix< M >::operator() | ( | int | row, |
int | column | ||
) | const |
returns the entry at position (row
, column
).
row
\( <\) number_of_rows()
, and \( 0 \le\) column
\( <\) number_of_columns()
. void CGAL::Dynamic_matrix< M >::replace_column | ( | int | old, |
int | new | ||
) |
replace column old
with column number new
.
old
, new
\( <\) number_of_columns()
. void CGAL::Dynamic_matrix< M >::shrink_to_quadratic_size | ( | ) |
deletes the rightmost columns, such that the dynamic matrix becomes quadratic.
number_of_columns()
\( \ge\) number_of_rows()
.number_of_rows()
\( ==\) number_of_columns()
.