rivet is hosted by Hepforge, IPPP Durham
 The Rivet MC analysis system  2.5.2
Matrix3 Class Reference

Specialisation of MatrixN to aid 3 dimensional rotations. More...

`#include <Matrix3.hh>`

Inheritance diagram for Matrix3:
Collaboration diagram for Matrix3:

List of all members.

## Public Member Functions

Matrix3 ()
Matrix3 (const Matrix< 3 > &m3)
Matrix3 (const Vector3 &axis, const double angle)
Matrix3 (const Vector3 &from, const Vector3 &to)
Matrix3setAsRotation (const Vector3 &from, const Vector3 &to)
Matrixset (const size_t i, const size_t j, const double value)
double get (const size_t i, const size_t j) const
Vector< N > getRow (const size_t row) const
Matrix< N > & setRow (const size_t row, const Vector< N > &r)
Vector< N > getColumn (const size_t col) const
Matrix< N > & setColumn (const size_t col, const Vector< N > &c)
Matrix< N > transpose () const
Matrix< N > inverse () const
Calculate inverse.
double det () const
Calculate determinant.
double trace () const
Calculate trace.
Matrix< N > operator- () const
Negate.
size_t size () const
Get dimensionality.
bool isZero (double tolerance=1E-5) const
Index-wise check for nullness, allowing for numerical precision.
bool isEqual (Matrix< N > other) const
Check for index-wise equality, allowing for numerical precision.
bool isSymm () const
Check for symmetry under transposition.
bool isDiag () const
Check that all off-diagonal elements are zero, allowing for numerical precision.
bool operator== (const Matrix< N > &a) const
bool operator!= (const Matrix< N > &a) const
bool operator< (const Matrix< N > &a) const
bool operator<= (const Matrix< N > &a) const
bool operator> (const Matrix< N > &a) const
bool operator>= (const Matrix< N > &a) const
Matrix< N > & operator*= (const Matrix< N > &m)
Matrix< N > & operator*= (const double a)
Matrix< N > & operator/= (const double a)
Matrix< N > & operator+= (const Matrix< N > &m)
Matrix< N > & operator-= (const Matrix< N > &m)

## Static Public Member Functions

static Matrix3 mkXRotation (const double angle)
static Matrix3 mkYRotation (const double angle)
static Matrix3 mkZRotation (const double angle)
static Matrix< N > mkZero ()
static Matrix< N > mkDiag (Vector< N > diag)
static Matrix< N > mkIdentity ()

## Protected Types

typedef Eigen::Matrix< double, N > EMatrix

EMatrix _matrix

## Detailed Description

Specialisation of MatrixN to aid 3 dimensional rotations.

Definition at line 13 of file Matrix3.hh.

## Member Typedef Documentation

 typedef Eigen::Matrix EMatrix` [protected, inherited]`

Definition at line 254 of file MatrixN.hh.

## Constructor & Destructor Documentation

 Matrix3 ( ) ` [inline]`

Definition at line 15 of file Matrix3.hh.

Referenced by Matrix3::mkXRotation(), Matrix3::mkYRotation(), and Matrix3::mkZRotation().

```{ }
```
 Matrix3 ( const Matrix< 3 > & m3 ) ` [inline]`

Definition at line 17 of file Matrix3.hh.

```:  Matrix<3>::Matrix(m3) { }
```
 Matrix3 ( const Vector3 & axis, const double angle ) ` [inline]`

Definition at line 19 of file Matrix3.hh.

References Matrix< 3 >::_matrix, Vector< N >::_vec, and Vector3::unit().

```                                                     {
const Vector3 normaxis = axis.unit();
}
```
 Matrix3 ( const Vector3 & from, const Vector3 & to ) ` [inline]`

Definition at line 24 of file Matrix3.hh.

References Matrix3::setAsRotation().

```                                                    {
setAsRotation(from, to);
}
```

## Member Function Documentation

 double det ( ) const` [inline, inherited]`

Calculate determinant.

Definition at line 141 of file MatrixN.hh.

```                        {
return _matrix.determinant();
}
```
 double get ( const size_t i, const size_t j ) const` [inline, inherited]`

Definition at line 84 of file MatrixN.hh.

```                                                     {
if (i < N && j < N) {
return _matrix(i, j);
} else {
throw std::runtime_error("Attempted get access outside matrix bounds.");
}
}
```
 Vector getColumn ( const size_t col ) const` [inline, inherited]`

Definition at line 107 of file MatrixN.hh.

```                                                {
Vector<N> rtn;
for (size_t i = 0; i < N; ++i) {
rtn.set(i, _matrix(i,col));
}
return rtn;
}
```
 Vector getRow ( const size_t row ) const` [inline, inherited]`

Definition at line 92 of file MatrixN.hh.

```                                             {
Vector<N> rtn;
for (size_t i = 0; i < N; ++i) {
rtn.set(i, _matrix(row,i));
}
return rtn;
}
```
 Matrix inverse ( ) const` [inline, inherited]`

Calculate inverse.

Definition at line 134 of file MatrixN.hh.

```                              {
Matrix<N> tmp;
tmp._matrix = _matrix.inverse();
return tmp;
}
```
 bool isDiag ( ) const` [inline, inherited]`

Check that all off-diagonal elements are zero, allowing for numerical precision.

Definition at line 193 of file MatrixN.hh.

```                        {
for (size_t i=0; i < N; ++i) {
for (size_t j=0; j < N; ++j) {
if (i == j) continue;
if (! Rivet::isZero(_matrix(i,j)) ) return false;
}
}
return true;
}
```
 bool isEqual ( Matrix< N > other ) const` [inline, inherited]`

Check for index-wise equality, allowing for numerical precision.

Definition at line 178 of file MatrixN.hh.

```                                        {
for (size_t i=0; i < N; ++i) {
for (size_t j=i; j < N; ++j) {
if (! Rivet::isZero(_matrix(i,j) - other._matrix(i,j)) ) return false;
}
}
return true;
}
```
 bool isSymm ( ) const` [inline, inherited]`

Check for symmetry under transposition.

Definition at line 188 of file MatrixN.hh.

```                        {
return isEqual(this->transpose());
}
```
 bool isZero ( double tolerance = `1E-5` ) const` [inline, inherited]`

Index-wise check for nullness, allowing for numerical precision.

Definition at line 168 of file MatrixN.hh.

```                                             {
for (size_t i=0; i < N; ++i) {
for (size_t j=0; j < N; ++j) {
if (! Rivet::isZero(_matrix(i,j), tolerance) ) return false;
}
}
return true;
}
```
 static Matrix mkDiag ( Vector< N > diag ) ` [inline, static, inherited]`

Definition at line 48 of file MatrixN.hh.

```                                            {
Matrix<N> rtn;
for (size_t i = 0; i < N; ++i) {
rtn.set(i, i, diag[i]);
}
return rtn;
}
```
 static Matrix mkIdentity ( ) ` [inline, static, inherited]`

Definition at line 56 of file MatrixN.hh.

```                                  {
Matrix<N> rtn;
for (size_t i = 0; i < N; ++i) {
rtn.set(i, i, 1);
}
return rtn;
}
```
 static Matrix3 mkXRotation ( const double angle ) ` [inline, static]`

Definition at line 28 of file Matrix3.hh.

References Matrix3::Matrix3().

```                                                   {
return Matrix3(Vector3(1,0,0), angle);
}
```
 static Matrix3 mkYRotation ( const double angle ) ` [inline, static]`

Definition at line 32 of file Matrix3.hh.

References Matrix3::Matrix3().

```                                                   {
return Matrix3(Vector3(0,1,0), angle);
}
```
 static Matrix mkZero ( ) ` [inline, static, inherited]`

Definition at line 43 of file MatrixN.hh.

```                              {
Matrix<N> rtn;
return rtn;
}
```
 static Matrix3 mkZRotation ( const double angle ) ` [inline, static]`

Definition at line 36 of file Matrix3.hh.

References Matrix3::Matrix3().

```                                                   {
return Matrix3(Vector3(0,0,1), angle);
}
```
 bool operator!= ( const Matrix< N > & a ) const` [inline, inherited]`

Definition at line 207 of file MatrixN.hh.

```                                                {
return _matrix != a._matrix;
}
```
 Matrix& operator*= ( const Matrix< N > & m ) ` [inline, inherited]`

Definition at line 227 of file MatrixN.hh.

```                                                {
_matrix = _matrix * m._matrix;
return *this;
}
```
 Matrix& operator*= ( const double a ) ` [inline, inherited]`

Definition at line 232 of file MatrixN.hh.

```                                            {
_matrix *= a;
return *this;
}
```
 Matrix& operator+= ( const Matrix< N > & m ) ` [inline, inherited]`

Definition at line 242 of file MatrixN.hh.

```                                                {
_matrix += m._matrix;
return *this;
}
```
 Matrix operator- ( ) const` [inline, inherited]`

Negate.

Definition at line 156 of file MatrixN.hh.

```                                {
Matrix<N> rtn;
rtn._matrix = -_matrix;
return rtn;
}
```
 Matrix& operator-= ( const Matrix< N > & m ) ` [inline, inherited]`

Definition at line 247 of file MatrixN.hh.

```                                                {
_matrix -= m._matrix;
return *this;
}
```
 Matrix& operator/= ( const double a ) ` [inline, inherited]`

Definition at line 237 of file MatrixN.hh.

```                                            {
_matrix /= a;
return *this;
}
```
 bool operator< ( const Matrix< N > & a ) const` [inline, inherited]`

Definition at line 211 of file MatrixN.hh.

```                                               {
return _matrix < a._matrix;
}
```
 bool operator<= ( const Matrix< N > & a ) const` [inline, inherited]`

Definition at line 215 of file MatrixN.hh.

```                                                {
return _matrix <= a._matrix;
}
```
 bool operator== ( const Matrix< N > & a ) const` [inline, inherited]`

Definition at line 203 of file MatrixN.hh.

```                                                {
return _matrix == a._matrix;
}
```
 bool operator> ( const Matrix< N > & a ) const` [inline, inherited]`

Definition at line 219 of file MatrixN.hh.

```                                               {
return _matrix > a._matrix;
}
```
 bool operator>= ( const Matrix< N > & a ) const` [inline, inherited]`

Definition at line 223 of file MatrixN.hh.

```                                                {
return _matrix >= a._matrix;
}
```
 Matrix& set ( const size_t i, const size_t j, const double value ) ` [inline, inherited]`

Definition at line 75 of file MatrixN.hh.

```                                                                    {
if (i < N && j < N) {
_matrix(i, j) = value;
} else {
throw std::runtime_error("Attempted set access outside matrix bounds.");
}
return *this;
}
```
 Matrix3& setAsRotation ( const Vector3 & from, const Vector3 & to ) ` [inline]`

Definition at line 40 of file Matrix3.hh.

Referenced by Matrix3::Matrix3().

```                                                                   {
const double theta = angle(from, to);
if (Rivet::isZero(theta)) {
} else {
const Vector3 normaxis = cross(from, to).unit();
}
return *this;
}
```
 Matrix& setColumn ( const size_t col, const Vector< N > & c ) ` [inline, inherited]`

Definition at line 115 of file MatrixN.hh.

```                                                               {
for (size_t i = 0; i < N; ++i) {
_matrix(i,col) = c.get(i);
}
return *this;
}
```
 Matrix& setRow ( const size_t row, const Vector< N > & r ) ` [inline, inherited]`

Definition at line 100 of file MatrixN.hh.

```                                                            {
for (size_t i = 0; i < N; ++i) {
_matrix(row,i) = r.get(i);
}
return *this;
}
```
 size_t size ( ) const` [inline, inherited]`

Get dimensionality.

Definition at line 163 of file MatrixN.hh.

```                        {
return N;
}
```
 double trace ( ) const` [inline, inherited]`

Calculate trace.

Definition at line 146 of file MatrixN.hh.

```                         {
double tr = 0.0;
for (size_t i = 0; i < N; ++i) {
tr += _matrix(i,i);
}
return tr;
// return _matrix.trace();
}
```
 Matrix transpose ( ) const` [inline, inherited]`

Definition at line 122 of file MatrixN.hh.

```                                {
Matrix<N> tmp = *this;
return tmp;
}
```

## Member Data Documentation

 EMatrix _matrix` [protected, inherited]`

Definition at line 255 of file MatrixN.hh.

Referenced by Matrix3::Matrix3(), and Matrix3::setAsRotation().

The documentation for this class was generated from the following file: