CGAL 5.5.3 - dD Geometry Kernel
|
An instance of data type Matrix
is a matrix of variables of number type NT
. The types Matrix
and Vector
together realize many functions of basic linear algebra.
Types | |
typedef unspecified_type | NT |
the ring type of the components. | |
typedef unspecified_type | iterator |
bidirectional iterator for accessing all components row-wise. | |
typedef unspecified_type | const_iterator |
bidirectional iterator for accessing all components row-wise. | |
typedef unspecified_type | row_iterator |
random access iterator for accessing row entries. | |
typedef unspecified_type | const_row_iterator |
random access iterator for accessing row entries. | |
typedef unspecified_type | column_iterator |
random access iterator for accessing column entries. | |
typedef unspecified_type | const_column_iterator |
random access iterator for accessing column entries. | |
typedef unspecified_type | Identity |
a tag class for identity initialization | |
typedef unspecified_type | Vector |
the vector type used. | |
Creation | |
Matrix () | |
creates an instance M of type Matrix . | |
Matrix (int n) | |
creates an instance M of type Matrix of dimension \( n \times n\) initialized to the zero matrix. | |
Matrix (int m, int n) | |
creates an instance M of type Matrix of dimension \( m \times n\) initialized to the zero matrix. | |
Matrix (std::pair< int, int > p) | |
creates an instance M of type Matrix of dimension p.first \( \times\)p.second initialized to the zero matrix. | |
Matrix (int n, Identity, NT x=NT(1)) | |
creates an instance M of type Matrix of dimension \( n \times n\) initialized to the identity matrix (times x ). | |
Matrix (int m, int n, NT x) | |
creates an instance M of type Matrix of dimension \( m \times n\) initialized to the matrix with x entries. | |
template<class Forward_iterator > | |
Matrix (Forward_iterator first, Forward_iterator last) | |
creates an instance M of type Matrix . More... | |
Matrix (std::vector< Vector > A) | |
creates an instance M of type Matrix . More... | |
Operations | |
int | row_dimension () |
returns \( n\), the number of rows of M . | |
int | column_dimension () |
returns \( m\), the number of columns of M . | |
std::pair< int, int > | dimension () |
returns \( (m,n)\), the dimension pair of M . | |
Vector | row (int i) |
returns the \( i\)-th row of M (an \( m\) - vector). More... | |
Vector | column (int i) |
returns the \( i\)-th column of M (an \( n\) - vector). More... | |
NT & | operator() (int i, int j) |
returns \( M_{i,j}\). More... | |
void | swap_rows (int i, int j) |
swaps rows \( i\) and \( j\). More... | |
void | swap_columns (int i, int j) |
swaps columns \( i\) and \( j\). More... | |
row_iterator | row_begin (int i) |
an iterator pointing to the first entry of the \( i\)th row. More... | |
row_iterator | row_end (int i) |
an iterator pointing beyond the last entry of the \( i\)th row. More... | |
const_row_iterator | row_begin (int i) const |
an iterator pointing to the first entry of the \( i\)th row. More... | |
const_row_iterator | row_end (int i) const |
an iterator pointing beyond the last entry of the \( i\)th row. More... | |
column_iterator | column_begin (int i) |
an iterator pointing to the first entry of the \( i\)th column. More... | |
column_iterator | column_end (int i) |
an iterator pointing beyond the last entry of the \( i\)th column. More... | |
const_column_iterator | column_begin (int i) const |
an iterator pointing to the first entry of the \( i\)th column. More... | |
const_column_iterator | column_end (int i) const |
an iterator pointing beyond the last entry of the \( i\)th column. More... | |
iterator | begin () |
an iterator pointing to the first entry of \( M\). | |
terator | end () |
an iterator pointing beyond the last entry of \( M\). | |
const_iterator | begin () const |
an iterator pointing to the first entry of \( M\). | |
const_terator | end () const |
an iterator pointing beyond the last entry of \( M\). | |
bool | operator== (const Matrix &M1) |
Test for equality. | |
bool | operator!= (const Matrix &M1) |
Test for inequality. | |
Arithmetic Operators | |
Matrix | operator+ (const Matrix &M1) |
Addition. More... | |
Matrix | operator- (const Matrix &M1) |
Subtraction. More... | |
Matrix | operator- () |
Negation. | |
Matrix | operator* (const Matrix &M1) |
Multiplication. More... | |
Vector | operator* (const Vector &vec) |
Multiplication with vector. More... | |
Matrix | operator* (const NT &x, const Matrix &M) |
Multiplication of every entry with x . | |
Matrix | operator* (const Matrix &M, const NT &x) |
Multiplication of every entry with x . | |
Matrix::Matrix | ( | Forward_iterator | first, |
Forward_iterator | last | ||
) |
creates an instance M
of type Matrix
.
Let \( S\) be the ordered set of \( n\) column-vectors of common dimension \( m\) as given by the iterator range [first,last)
. M
is initialized to an \( m \times n\) matrix with the columns as specified by \( S\).
Forward_iterator
has a value type V
from which we require to provide a iterator type V::const_iterator
, to have V::value_type == NT
.Note that Vector
or std::vector<NT>
fulfill these requirements.
Matrix::Matrix | ( | std::vector< Vector > | A | ) |
creates an instance M
of type Matrix
.
Let \( A\) be an array of \( n\) column-vectors of common dimension \( m\). M
is initialized to an \( m \times n\) matrix with the columns as specified by \( A\).
Vector Matrix::column | ( | int | i | ) |
returns the \( i\)-th column of M
(an \( n\) - vector).
column_iterator Matrix::column_begin | ( | int | i | ) |
an iterator pointing to the first entry of the \( i\)th column.
const_column_iterator Matrix::column_begin | ( | int | i | ) | const |
an iterator pointing to the first entry of the \( i\)th column.
column_iterator Matrix::column_end | ( | int | i | ) |
an iterator pointing beyond the last entry of the \( i\)th column.
const_column_iterator Matrix::column_end | ( | int | i | ) | const |
an iterator pointing beyond the last entry of the \( i\)th column.
NT& Matrix::operator() | ( | int | i, |
int | j | ||
) |
returns \( M_{i,j}\).
Multiplication.
M.column_dimension() = M1.row_dimension()
Multiplication with vector.
M.column_dimension() = vec.dimension()
Addition.
M.row_dimension() == M1.row_dimension()
M.column_dimension() == M1.column_dimension()
Subtraction.
M.row_dimension() == M1.row_dimension()
M.column_dimension() == M1.column_dimension()
Vector Matrix::row | ( | int | i | ) |
returns the \( i\)-th row of M
(an \( m\) - vector).
row_iterator Matrix::row_begin | ( | int | i | ) |
an iterator pointing to the first entry of the \( i\)th row.
const_row_iterator Matrix::row_begin | ( | int | i | ) | const |
an iterator pointing to the first entry of the \( i\)th row.
row_iterator Matrix::row_end | ( | int | i | ) |
an iterator pointing beyond the last entry of the \( i\)th row.
const_row_iterator Matrix::row_end | ( | int | i | ) | const |
an iterator pointing beyond the last entry of the \( i\)th row.
void Matrix::swap_columns | ( | int | i, |
int | j | ||
) |
swaps columns \( i\) and \( j\).
void Matrix::swap_rows | ( | int | i, |
int | j | ||
) |
swaps rows \( i\) and \( j\).