CGAL 5.1 - CGAL and Solvers
SparseLinearAlgebraTraits_d::Matrix Class Reference

#include <Concepts/SparseLinearAlgebraTraits_d.h>

Definition

Types

typedef unspecified_type Index
 Index type. More...
 
typedef unspecified_type NT
 

Creation

 Matrix (Index dimension)
 Create a square matrix initialized with zeros. More...
 
 Matrix (Index rows, Index columns)
 Create a rectangular matrix initialized with zeros. More...
 

Operations

Index row_dimension () const
 Return the matrix number of rows. More...
 
Index column_dimension () const
 Return the matrix number of columns. More...
 
NT get_coef (Index row, Index column) const
 Read access to a matrix coefficient. More...
 
void add_coef (Index row, Index column, NT value)
 Write access to a matrix coefficient: a_ij = a_ij + val. More...
 
void set_coef (Index row, Index column, NT value, bool new_coef=false)
 Write access to a matrix coefficient: a_ij = val. More...
 
void swap (Matrix &m)
 Swaps the content of *this and m. More...
 
Matrix operator* (const NT &c, const Matrix &M)
 Multiplication with a scalar. More...
 
Matrix operator+ (const Matrix &M0, const Matrix &M1)
 Sum of two matrices. More...
 

Member Typedef Documentation

◆ Index

typedef unspecified_type SparseLinearAlgebraTraits_d::Matrix::Index

Index type.

◆ NT

typedef unspecified_type SparseLinearAlgebraTraits_d::Matrix::NT

Constructor & Destructor Documentation

◆ Matrix() [1/2]

SparseLinearAlgebraTraits_d::Matrix::Matrix ( Index  dimension)

Create a square matrix initialized with zeros.

◆ Matrix() [2/2]

SparseLinearAlgebraTraits_d::Matrix::Matrix ( Index  rows,
Index  columns 
)

Create a rectangular matrix initialized with zeros.

Member Function Documentation

◆ add_coef()

void SparseLinearAlgebraTraits_d::Matrix::add_coef ( Index  row,
Index  column,
NT  value 
)

Write access to a matrix coefficient: a_ij = a_ij + val.

Precondition
0 <= row < row_dimension()
0 <= column < column_dimension()

◆ column_dimension()

Index SparseLinearAlgebraTraits_d::Matrix::column_dimension ( ) const

Return the matrix number of columns.

◆ get_coef()

NT SparseLinearAlgebraTraits_d::Matrix::get_coef ( Index  row,
Index  column 
) const

Read access to a matrix coefficient.

Precondition
0 <= row < row_dimension()
0 <= column < column_dimension()

◆ row_dimension()

Index SparseLinearAlgebraTraits_d::Matrix::row_dimension ( ) const

Return the matrix number of rows.

◆ set_coef()

void SparseLinearAlgebraTraits_d::Matrix::set_coef ( Index  row,
Index  column,
NT  value,
bool  new_coef = false 
)

Write access to a matrix coefficient: a_ij = val.

Optimization: Users can indicate that the coefficient does not already exist in the matrix by setting new_coef to true.

Precondition
0 <= i < row_dimension()
0 <= j < column_dimension()

◆ swap()

void SparseLinearAlgebraTraits_d::Matrix::swap ( Matrix m)

Swaps the content of *this and m.

Friends And Related Function Documentation

◆ operator*

Matrix operator* ( const NT c,
const Matrix M 
)
friend

Multiplication with a scalar.

◆ operator+

Matrix operator+ ( const Matrix M0,
const Matrix M1 
)
friend

Sum of two matrices.