# QuantLib_Matrix man page

Matrix — Matrix used in linear algebra.

## Synopsis

`#include <ql/math/matrix.hpp>`

Inherited by Disposable< QuantLib::Matrix >.

### Public Types

typedef Real * iterator
typedef const Real * const_iterator
typedef boost::reverse_iterator< iterator > reverse_iterator
typedef boost::reverse_iterator< const_iterator > const_reverse_iterator
typedef Real * row_iterator
typedef const Real * const_row_iterator
typedef boost::reverse_iterator< row_iterator > reverse_row_iterator
typedef boost::reverse_iterator< const_row_iterator > const_reverse_row_iterator
typedef step_iterator< iterator > column_iterator
typedef step_iterator< const_iterator > const_column_iterator
typedef boost::reverse_iterator< column_iterator > reverse_column_iterator
typedef boost::reverse_iterator< const_column_iterator > const_reverse_column_iterator

### Public Member Functions

Constructors, destructor, and assignment

Matrix ()
creates a null matrix
Matrix (Size rows, Size columns)
creates a matrix with the given dimensions
Matrix (Size rows, Size columns, Real value)
creates the matrix and fills it with `value`
template<class Iterator > Matrix (Size rows, Size columns, Iterator begin, Iterator end)
creates the matrix and fills it with data from a range.
Matrix (const Matrix &)
Matrix (const Disposable< Matrix > &)
Matrix & operator= (const Matrix &)
Matrix & operator= (const Disposable< Matrix > &)

Algebraic operators

const Matrix & operator+= (const Matrix &)
const Matrix & operator-= (const Matrix &)
const Matrix & operator*= (Real)
const Matrix & operator/= (Real)

Iterator access

const_iterator begin () const
iterator begin ()
const_iterator end () const
iterator end ()
const_reverse_iterator rbegin () const
reverse_iterator rbegin ()
const_reverse_iterator rend () const
reverse_iterator rend ()
const_row_iterator row_begin (Size i) const
row_iterator row_begin (Size i)
const_row_iterator row_end (Size i) const
row_iterator row_end (Size i)
const_reverse_row_iterator row_rbegin (Size i) const
reverse_row_iterator row_rbegin (Size i)
const_reverse_row_iterator row_rend (Size i) const
reverse_row_iterator row_rend (Size i)
const_column_iterator column_begin (Size i) const
column_iterator column_begin (Size i)
const_column_iterator column_end (Size i) const
column_iterator column_end (Size i)
const_reverse_column_iterator column_rbegin (Size i) const
reverse_column_iterator column_rbegin (Size i)
const_reverse_column_iterator column_rend (Size i) const
reverse_column_iterator column_rend (Size i)

Element access

const_row_iterator operator[] (Size) const
const_row_iterator at (Size) const
row_iterator operator[] (Size)
row_iterator at (Size)
Disposable< Array > diagonal (void) const
Real & operator() (Size i, Size j) const

Inspectors

Size rows () const
Size columns () const
bool empty () const
Size size1 () const
Size size2 () const

Utilities

void swap (Matrix &)

## Detailed Description

Matrix used in linear algebra.

This class implements the concept of Matrix as used in linear algebra. As such, it is not meant to be used as a container.

## Constructor & Destructor Documentation

### Matrix (Size rows, Size columns, Iterator begin, Iterator end)

creates the matrix and fills it with data from a range.

Warning

if the range defined by [begin, end) is larger than the size of the matrix, a memory access violation might occur. It is up to the user to avoid this.

## Member Function Documentation

### const Matrix & operator+= (const Matrix & m)

Precondition:

all matrices involved in an algebraic expression must have the same size.

## Author

Generated automatically by Doxygen for QuantLib from the source code.

## Referenced By

The man pages CholeskyDecomposition(3), column_begin(3), column_end(3), column_iterator(3), column_rbegin(3), column_rend(3), columns(3), const_column_iterator(3), const_reverse_column_iterator(3), const_reverse_row_iterator(3), const_row_iterator(3), determinant(3), diagonal(3), inverse(3), Matrix(3), rankReducedSqrt(3), reverse_column_iterator(3), reverse_row_iterator(3), row_begin(3), row_end(3), row_iterator(3), row_rbegin(3), row_rend(3), rows(3), size1(3) and size2(3) are aliases of QuantLib_Matrix(3).

Wed Feb 7 2018 Version 1.10.1 QuantLib