Matrix Class Reference

#include <ql/Math/matrix.hpp>

List of all members.


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.


Public Types

typedef Realiterator
typedef const Realconst_iterator
typedef Realrow_iterator
typedef const Realconst_row_iterator
typedef stepping_iterator<
Real * > 
column_iterator
typedef stepping_iterator<
const Real * > 
const_column_iterator

Public Member Functions

typedef QL_REVERSE_ITERATOR (iterator, Real) reverse_iterator
typedef QL_REVERSE_ITERATOR (const_iterator, Real) const _reverse_iterator
typedef QL_REVERSE_ITERATOR (row_iterator, Real) reverse_row_iterator
typedef QL_REVERSE_ITERATOR (const_row_iterator, Real) const _reverse_row_iterator
typedef QL_REVERSE_ITERATOR (column_iterator, Real) reverse_column_iterator
typedef QL_REVERSE_ITERATOR (const_column_iterator, Real) const _reverse_column_iterator
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

 Matrix (const Matrix &)
 Matrix (const Disposable< Matrix > &)
Matrixoperator= (const Matrix &)
Matrixoperator= (const Disposable< Matrix > &)
Algebraic operators
const Matrixoperator+= (const Matrix &)
const Matrixoperator-= (const Matrix &)
const Matrixoperator *= (Real)
const Matrixoperator/= (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
row_iterator operator[] (Size)
Disposable< Arraydiagonal (void) const
Inspectors
Size rows () const
Size columns () const
Utilities
void swap (Matrix &)

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &, const Matrix &)
const Disposable< MatrixCholeskyDecomposition (const Matrix &m, bool flexible=false)
const Disposable< Matrixoperator+ (const Matrix &, const Matrix &)
const Disposable< Matrixoperator- (const Matrix &, const Matrix &)
const Disposable< Matrixoperator * (const Matrix &, Real)
const Disposable< Matrixoperator * (Real, const Matrix &)
const Disposable< Matrixoperator/ (const Matrix &, Real)
const Disposable< Arrayoperator * (const Array &, const Matrix &)
const Disposable< Arrayoperator * (const Matrix &, const Array &)
const Disposable< Matrixoperator * (const Matrix &, const Matrix &)
const Disposable< Matrixtranspose (const Matrix &)
const Disposable< MatrixouterProduct (const Array &v1, const Array &v2)
template<class Iterator1, class Iterator2> const Disposable< MatrixouterProduct (Iterator1 v1begin, Iterator1 v1end, Iterator2 v2begin, Iterator2 v2end)
const Disposable< MatrixpseudoSqrt (const Matrix &, SalvagingAlgorithm::Type)
 Returns the pseudo square root of a real symmetric matrix.

const Disposable< MatrixrankReducedSqrt (const Matrix &, Size maxRank, Real componentRetainedPercentage, SalvagingAlgorithm::Type)


Member Function Documentation

const Matrix & operator+= const Matrix  ) 
 

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


Friends And Related Function Documentation

const Disposable< Matrix > pseudoSqrt const Matrix ,
SalvagingAlgorithm::Type 
[related]
 

Returns the pseudo square root of a real symmetric matrix.

Given a matrix $ M $, the result $ S $ is defined as the matrix such that $ S S^T = M. $ If the matrix is not positive semi definite, it can return an approximation of the pseudo square root using a (user selected) salvaging algorithm.

For more information see: "The most general methodology to create a valid correlation matrix for risk management and option pricing purposes", by R. Rebonato and P. Jäckel. The Journal of Risk, 2(2), Winter 1999/2000 http://www.rebonato.com/correlationmatrix.pdf

Revised and extended in "Monte Carlo Methods in Finance", by Peter Jäckel, Chapter 6.

Precondition:
the given matrix must be symmetric.

Todo:
implement Hypersphere decomposition: 1) Jäckel "Monte Carlo Methods in Finance", Chapter 6 2) Brigo "A Note on Correlation and Rank Reduction" 3) Rapisarda, Brigo, Mercurio "Parameterizing correlations: a geometric interpretation"

implement Higham algorithm: Higham "Computing the nearest correlation matrix"

const Disposable< Matrix > rankReducedSqrt const Matrix ,
Size  maxRank,
Real  componentRetainedPercentage,
SalvagingAlgorithm::Type 
[related]
 

Precondition:
the given matrix must be symmetric.


QuantLib.org
QuantLib
Hosted by
SourceForge.net Logo
Documentation generated by
doxygen