CGAL 6.2 - CGAL and Solvers: SparseLinearAlgebraTraits_d::Matrix Concept Reference

CGAL 6.2 - CGAL and Solvers

Loading...
Searching...
No Matches
List of all members
SparseLinearAlgebraTraits_d::Matrix Concept Reference

## Definition

`SparseLinearAlgebraTraits_d::Matrix` is a concept of a sparse matrix class.

Refines
  `Assignable`
  `DefaultConstructible`

Has models
  `CGAL::Eigen_sparse_matrix<T>`
  `CGAL::Eigen_sparse_symmetric_matrix<T>`

See also
  `SparseLinearAlgebraTraits_d`
  `SparseLinearAlgebraTraits_d::Vector`

## Types
typedef unspecified_type | Index
| Index type.
typedef unspecified_type | NT

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

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

## 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()`

## ◆ 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()`

## ◆ 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()`