cepgen is hosted by Hepforge, IPPP Durham
CepGen N/A
Central exclusive processes event generator

A \(n\times m\) matrix object. More...

#include <include/CepGen/Utils/Algebra.h>

+ Inheritance diagram for Matrix:

Public Types

using Indices = std::pair<size_t, size_t>
 

Public Member Functions

 Matrix (size_t num_rows, size_t num_cols)
 Object constructor.
 
 Matrix (const std::initializer_list< Vector > &vectors)
 Object constructor (from vectors)
 
 Matrix (const Matrix &)
 Copy constructor.
 
Matrixoperator= (const Matrix &)
 Assignment operator.
 
 operator Vector () const
 Implicit conversion to vector.
 
size_t numColumns () const
 Number of (vertical) columns.
 
size_t numRows () const
 Number of (horizontal) rows.
 
bool operator== (const Matrix &) const
 Equality operator.
 
bool operator!= (const Matrix &oth) const
 Inequality operator.
 
Matrix subset (size_t min_y, size_t min_x, size_t max_y=0ull, size_t max_x=0ull) const
 Extract a subset of the matrix as a new object.
 
Matrixoperator*= (double)
 Multiplication by a scalar operator.
 
Matrixoperator*= (const Vector &)
 Multiplication by a vector operator.
 
Matrixoperator*= (const Matrix &)
 Multiplication by a matrix operator.
 
Matrixoperator/= (double)
 Division by a scalar operator.
 
Matrix operator- () const
 Unary inverse operator.
 
Matrixoperator+= (const Matrix &)
 Addition of another matrix.
 
Matrixoperator-= (const Matrix &)
 Subtraction of another matrix.
 
double & operator() (size_t, size_t)
 Component access operator.
 
double operator() (size_t, size_t) const
 Component retrieval operator.
 
Vector operator% (const Vector &) const
 Solving operator (from LU decomposition)
 
Indices imin () const
 Index (row, column) of the minimum matrix element.
 
Indices imax () const
 Index (row, column) of the maximum matrix element.
 
double min () const
 Minimum matrix element.
 
double max () const
 Maximum matrix element.
 
bool null () const
 Is the matrix uniformly null?
 
bool positive () const
 Is the matrix positive-defined?
 
bool negative () const
 Is the matrix negative-defined?
 
bool nonNegative () const
 Is the matrix non-negative-defined?
 
Matrixtruncate (double min=1.e-14)
 Truncate (specify minimum non-zero value) for all matrix components.
 
Matrixtranspose ()
 Transpose the matrix.
 
Matrix transposed () const
 Return a transposition of this matrix.
 
Matrixinvert ()
 Invert the matrix.
 
Matrix inverted () const
 Return the inverse of this matrix (LU decomposition)
 
VectorRef column (size_t)
 Return whole column of the matrix.
 
Vector column (size_t) const
 Return whole column of the matrix.
 
VectorRef row (size_t)
 Return whole row of the matrix.
 
Vector row (size_t) const
 Return whole row of the matrix.
 
VectorRef diagonal ()
 Return the diagonal components of the matrix.
 
Vector diagonal () const
 Return the diagonal components of the matrix.
 

Static Public Member Functions

static Matrix zero (size_t num_rows, size_t num_cols=0ull)
 Build a zeroed matrix.
 
static Matrix uniform (size_t num_rows, size_t num_cols, double value=1.)
 Build a uniform matrix.
 
static Matrix identity (size_t)
 Build a (square) identity matrix.
 
static Matrix diagonal (const Vector &)
 Build a (square) diagonal matrix from its diagonal vector.
 

Friends

Matrix operator* (double, const Matrix &)
 Multiplication of a matrix by a scalar.
 
Matrix operator* (const Matrix &, double)
 Multiplication of a matrix by a scalar.
 
Vector operator* (const Matrix &, const Vector &)
 Multiplication of a matrix by a vector.
 
Matrix operator* (const Matrix &, const Matrix &)
 Multiplication of a matrix by another matrix.
 
Matrix operator/ (const Matrix &, double)
 Division of a matrix by a scalar.
 
Matrix operator+ (const Matrix &, const Matrix &)
 Addition of two matrices.
 
Matrix operator- (const Matrix &, const Matrix &)
 Subtraction of two matrices.
 
std::ostream & operator<< (std::ostream &, const Matrix &)
 Printout of matrix components.
 

Detailed Description

Definition at line 31 of file Algebra.h.

Member Typedef Documentation

◆ Indices

using Indices = std::pair<size_t, size_t>

Definition at line 90 of file Algebra.h.

Constructor & Destructor Documentation

◆ Matrix() [1/3]

Matrix ( size_t num_rows,
size_t num_cols )
explicit
Parameters
[in]num_rowsnumber of (horizontal) rows for the matrix
[in]num_colsnumber of (vertical) columns for the matrix

◆ Matrix() [2/3]

Matrix ( const std::initializer_list< Vector > & vectors)
Parameters
[in]vectorsset of (vector) rows

◆ Matrix() [3/3]

Matrix ( const Matrix & )

Member Function Documentation

◆ column() [1/2]

VectorRef column ( size_t )

◆ column() [2/2]

Vector column ( size_t ) const

◆ diagonal() [1/3]

VectorRef diagonal ( )

◆ diagonal() [2/3]

Vector diagonal ( ) const

◆ diagonal() [3/3]

static Matrix diagonal ( const Vector & )
static

◆ identity()

static Matrix identity ( size_t )
static

◆ imax()

Indices imax ( ) const

◆ imin()

Indices imin ( ) const

◆ invert()

Matrix & invert ( )

◆ inverted()

Matrix inverted ( ) const

◆ max()

double max ( ) const

◆ min()

double min ( ) const

◆ negative()

bool negative ( ) const

◆ nonNegative()

bool nonNegative ( ) const

◆ null()

bool null ( ) const

◆ numColumns()

size_t numColumns ( ) const

◆ numRows()

size_t numRows ( ) const

◆ operator Vector()

operator Vector ( ) const

◆ operator!=()

bool operator!= ( const Matrix & oth) const

Definition at line 61 of file Algebra.h.

◆ operator%()

Vector operator% ( const Vector & ) const

◆ operator()() [1/2]

double & operator() ( size_t ,
size_t  )

◆ operator()() [2/2]

double operator() ( size_t ,
size_t  ) const

◆ operator*=() [1/3]

Matrix & operator*= ( const Matrix & )

◆ operator*=() [2/3]

Matrix & operator*= ( const Vector & )

◆ operator*=() [3/3]

Matrix & operator*= ( double )

◆ operator+=()

Matrix & operator+= ( const Matrix & )

◆ operator-()

Matrix operator- ( ) const

◆ operator-=()

Matrix & operator-= ( const Matrix & )

◆ operator/=()

Matrix & operator/= ( double )

◆ operator=()

Matrix & operator= ( const Matrix & )

◆ operator==()

bool operator== ( const Matrix & ) const

◆ positive()

bool positive ( ) const

◆ row() [1/2]

VectorRef row ( size_t )

◆ row() [2/2]

Vector row ( size_t ) const

◆ subset()

Matrix subset ( size_t min_y,
size_t min_x,
size_t max_y = 0ull,
size_t max_x = 0ull ) const
Parameters
[in]min_yfirst vertical index for the subset
[in]min_xfirst horizontal index for the subset
[in]max_ylast vertical index for the subset
[in]max_xlast horizontal index for the subset

◆ transpose()

Matrix & transpose ( )

◆ transposed()

Matrix transposed ( ) const

◆ truncate()

Matrix & truncate ( double min = 1.e-14)

◆ uniform()

static Matrix uniform ( size_t num_rows,
size_t num_cols,
double value = 1. )
static
Parameters
[in]num_rowsnumber of (horizontal) rows for the matrix
[in]num_colsnumber of (vertical) columns for the matrix
[in]valueuniform value for all the matrix components

◆ zero()

static Matrix zero ( size_t num_rows,
size_t num_cols = 0ull )
static
Parameters
[in]num_rowsnumber of (horizontal) rows for the matrix
[in]num_colsnumber of (vertical) columns for the matrix

Friends And Related Symbol Documentation

◆ operator* [1/4]

Matrix operator* ( const Matrix & ,
const Matrix &  )
friend

◆ operator* [2/4]

Vector operator* ( const Matrix & ,
const Vector &  )
friend

◆ operator* [3/4]

Matrix operator* ( const Matrix & ,
double  )
friend

◆ operator* [4/4]

Matrix operator* ( double ,
const Matrix &  )
friend

◆ operator+

Matrix operator+ ( const Matrix & ,
const Matrix &  )
friend

◆ operator-

Matrix operator- ( const Matrix & ,
const Matrix &  )
friend

◆ operator/

Matrix operator/ ( const Matrix & ,
double  )
friend

◆ operator<<

std::ostream & operator<< ( std::ostream & ,
const Matrix &  )
friend