CGAL 5.1 - dD Geometry Kernel

#include <Concepts/Matrix.h>

Definition

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. More...
 
typedef unspecified_type iterator
 bidirectional iterator for accessing all components row-wise. More...
 
typedef unspecified_type const_iterator
 bidirectional iterator for accessing all components row-wise. More...
 
typedef unspecified_type row_iterator
 random access iterator for accessing row entries. More...
 
typedef unspecified_type const_row_iterator
 random access iterator for accessing row entries. More...
 
typedef unspecified_type column_iterator
 random access iterator for accessing column entries. More...
 
typedef unspecified_type const_column_iterator
 random access iterator for accessing column entries. More...
 
typedef unspecified_type Identity
 a tag class for identity initialization More...
 
typedef unspecified_type Vector
 the vector type used. More...
 

Creation

 Matrix ()
 creates an instance M of type Matrix. More...
 
 Matrix (int n)
 creates an instance M of type Matrix of dimension \( n \times n\) initialized to the zero matrix. More...
 
 Matrix (int m, int n)
 creates an instance M of type Matrix of dimension \( m \times n\) initialized to the zero matrix. More...
 
 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. More...
 
 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). More...
 
 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. More...
 
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. More...
 
int column_dimension ()
 returns \( m\), the number of columns of M. More...
 
std::pair< int, int > dimension ()
 returns \( (m,n)\), the dimension pair of M. More...
 
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...
 
NToperator() (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\). More...
 
terator end ()
 an iterator pointing beyond the last entry of \( M\). More...
 
const_iterator begin () const
 an iterator pointing to the first entry of \( M\). More...
 
const_terator end () const
 an iterator pointing beyond the last entry of \( M\). More...
 
bool operator== (const Matrix &M1)
 Test for equality. More...
 
bool operator!= (const Matrix &M1)
 Test for inequality. More...
 

Arithmetic Operators

Matrix operator+ (const Matrix &M1)
 Addition. More...
 
Matrix operator- (const Matrix &M1)
 Subtraction. More...
 
Matrix operator- ()
 Negation. More...
 
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. More...
 
Matrix operator* (const Matrix &M, const NT &x)
 Multiplication of every entry with x. More...
 

Member Typedef Documentation

◆ column_iterator

typedef unspecified_type Matrix::column_iterator

random access iterator for accessing column entries.

◆ const_column_iterator

typedef unspecified_type Matrix::const_column_iterator

random access iterator for accessing column entries.

◆ const_iterator

typedef unspecified_type Matrix::const_iterator

bidirectional iterator for accessing all components row-wise.

◆ const_row_iterator

typedef unspecified_type Matrix::const_row_iterator

random access iterator for accessing row entries.

◆ Identity

typedef unspecified_type Matrix::Identity

a tag class for identity initialization

◆ iterator

typedef unspecified_type Matrix::iterator

bidirectional iterator for accessing all components row-wise.

◆ NT

typedef unspecified_type Matrix::NT

the ring type of the components.

◆ row_iterator

typedef unspecified_type Matrix::row_iterator

random access iterator for accessing row entries.

◆ Vector

typedef unspecified_type Matrix::Vector

the vector type used.

Constructor & Destructor Documentation

◆ Matrix() [1/8]

Matrix::Matrix ( )

creates an instance M of type Matrix.

◆ Matrix() [2/8]

Matrix::Matrix ( int  n)

creates an instance M of type Matrix of dimension \( n \times n\) initialized to the zero matrix.

◆ Matrix() [3/8]

Matrix::Matrix ( int  m,
int  n 
)

creates an instance M of type Matrix of dimension \( m \times n\) initialized to the zero matrix.

◆ Matrix() [4/8]

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() [5/8]

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() [6/8]

Matrix::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.

◆ Matrix() [7/8]

template<class Forward_iterator >
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\).

Precondition
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() [8/8]

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

Member Function Documentation

◆ begin() [1/2]

iterator Matrix::begin ( )

an iterator pointing to the first entry of \( M\).

◆ begin() [2/2]

const_iterator Matrix::begin ( ) const

an iterator pointing to the first entry of \( M\).

◆ column()

Vector Matrix::column ( int  i)

returns the \( i\)-th column of M (an \( n\) - vector).

Precondition
\( 0 \le i \le n - 1\).

◆ column_begin() [1/2]

column_iterator Matrix::column_begin ( int  i)

an iterator pointing to the first entry of the \( i\)th column.

Precondition
\( 0\le i\le n-1\).

◆ column_begin() [2/2]

const_column_iterator Matrix::column_begin ( int  i) const

an iterator pointing to the first entry of the \( i\)th column.

Precondition
\( 0\le i\le n-1\).

◆ column_dimension()

int Matrix::column_dimension ( )

returns \( m\), the number of columns of M.

◆ column_end() [1/2]

column_iterator Matrix::column_end ( int  i)

an iterator pointing beyond the last entry of the \( i\)th column.

Precondition
\( 0\le i\le n-1\).

◆ column_end() [2/2]

const_column_iterator Matrix::column_end ( int  i) const

an iterator pointing beyond the last entry of the \( i\)th column.

Precondition
\( 0\le i\le n-1\).

◆ dimension()

std::pair<int,int> Matrix::dimension ( )

returns \( (m,n)\), the dimension pair of M.

◆ end() [1/2]

terator Matrix::end ( )

an iterator pointing beyond the last entry of \( M\).

◆ end() [2/2]

const_terator Matrix::end ( ) const

an iterator pointing beyond the last entry of \( M\).

◆ operator!=()

bool Matrix::operator!= ( const Matrix M1)

Test for inequality.

◆ operator()()

NT& Matrix::operator() ( int  i,
int  j 
)

returns \( M_{i,j}\).

Precondition
\( 0\le i\le m-1\) and \( 0\le j\le n-1\).

◆ operator*() [1/4]

Matrix Matrix::operator* ( const Matrix M,
const NT x 
)

Multiplication of every entry with x.

◆ operator*() [2/4]

Matrix Matrix::operator* ( const Matrix M1)

Multiplication.

Precondition
M.column_dimension() = M1.row_dimension()

◆ operator*() [3/4]

Matrix Matrix::operator* ( const NT x,
const Matrix M 
)

Multiplication of every entry with x.

◆ operator*() [4/4]

Vector Matrix::operator* ( const Vector vec)

Multiplication with vector.

Precondition
M.column_dimension() = vec.dimension()

◆ operator+()

Matrix Matrix::operator+ ( const Matrix M1)

Addition.

Precondition
M.row_dimension() == M1.row_dimension()
M.column_dimension() == M1.column_dimension()

◆ operator-() [1/2]

Matrix Matrix::operator- ( )

Negation.

◆ operator-() [2/2]

Matrix Matrix::operator- ( const Matrix M1)

Subtraction.

Precondition
M.row_dimension() == M1.row_dimension()
M.column_dimension() == M1.column_dimension()

◆ operator==()

bool Matrix::operator== ( const Matrix M1)

Test for equality.

◆ row()

Vector Matrix::row ( int  i)

returns the \( i\)-th row of M (an \( m\) - vector).

Precondition
\( 0 \le i \le m - 1\).

◆ row_begin() [1/2]

row_iterator Matrix::row_begin ( int  i)

an iterator pointing to the first entry of the \( i\)th row.

Precondition
\( 0\le i\le m-1\).

◆ row_begin() [2/2]

const_row_iterator Matrix::row_begin ( int  i) const

an iterator pointing to the first entry of the \( i\)th row.

Precondition
\( 0\le i\le m-1\).

◆ row_dimension()

int Matrix::row_dimension ( )

returns \( n\), the number of rows of M.

◆ row_end() [1/2]

row_iterator Matrix::row_end ( int  i)

an iterator pointing beyond the last entry of the \( i\)th row.

Precondition
\( 0\le i\le m-1\).

◆ row_end() [2/2]

const_row_iterator Matrix::row_end ( int  i) const

an iterator pointing beyond the last entry of the \( i\)th row.

Precondition
\( 0\le i\le m-1\).

◆ swap_columns()

void Matrix::swap_columns ( int  i,
int  j 
)

swaps columns \( i\) and \( j\).

Precondition
\( 0\le i\le n-1\) and \( 0\le j\le n-1\).

◆ swap_rows()

void Matrix::swap_rows ( int  i,
int  j 
)

swaps rows \( i\) and \( j\).

Precondition
\( 0\le i\le m-1\) and \( 0\le j\le m-1\).