Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | List of all members
Mantid::CurveFitting::FortranMatrix< MatrixClass > Class Template Reference

FortranMatrix is a wrapper template for EigenMatrix and EigenComplexMatrix to simplify porting fortran programs to C++. More...

#include <EigenFortranMatrix.h>

Inheritance diagram for Mantid::CurveFitting::FortranMatrix< MatrixClass >:

Public Member Functions

void allocate (const int iFrom, const int iTo, const int jFrom, const int jTo)
 Resize the matrix. More...
 
void allocate (const int nx, const int ny)
 Resize the matrix. More...
 
 FortranMatrix ()
 Constructor. More...
 
 FortranMatrix (const int iFrom, const int iTo, const int jFrom, const int jTo)
 Constructor. More...
 
 FortranMatrix (const int nx, const int ny)
 Constructor. More...
 
int len1 () const
 Get the size along the first dimension as an int. More...
 
int len2 () const
 Get the size along the second dimension as an int. More...
 
MatrixClass moveToBaseMatrix ()
 Move the data to a new matrix of MatrixClass. More...
 
ElementRefType operator() (const int i, const int j)
 Get the reference to the data element. More...
 
ElementConstType operator() (const int i, const int j) const
 Index operator. More...
 
FortranMatrix< MatrixClass > & operator= (const MatrixClass &m)
 Assignment operator - Matrix Class. More...
 
FortranMatrix< MatrixClass > transpose () const
 copy and transpose the matrix More...
 

Private Types

using ElementConstType = decltype(std::declval< const MatrixClass >().operator()(0, 0))
 Typedef the types returned by the base class's operators []. More...
 
using ElementRefType = decltype(std::declval< MatrixClass >().operator()(0, 0))
 

Static Private Member Functions

static size_t makeSize (const int firstIndex, const int lastIndex)
 Calculate the size (1D) of a matrix First. More...
 

Private Attributes

int m_base1
 Base for the first index. More...
 
int m_base2
 Base for the second index. More...
 

Detailed Description

template<class MatrixClass>
class Mantid::CurveFitting::FortranMatrix< MatrixClass >

FortranMatrix is a wrapper template for EigenMatrix and EigenComplexMatrix to simplify porting fortran programs to C++.

This matrix allows to use arbitrary index bases as they do in fortran. Indexing can begin with any integer number including negative.

Definition at line 21 of file EigenFortranMatrix.h.

Member Typedef Documentation

◆ ElementConstType

template<class MatrixClass >
using Mantid::CurveFitting::FortranMatrix< MatrixClass >::ElementConstType = decltype(std::declval<const MatrixClass>().operator()(0, 0))
private

Typedef the types returned by the base class's operators [].

They aren't necessarily the same as the stored type (double or complex).

Definition at line 28 of file EigenFortranMatrix.h.

◆ ElementRefType

template<class MatrixClass >
using Mantid::CurveFitting::FortranMatrix< MatrixClass >::ElementRefType = decltype(std::declval<MatrixClass>().operator()(0, 0))
private

Definition at line 29 of file EigenFortranMatrix.h.

Constructor & Destructor Documentation

◆ FortranMatrix() [1/3]

template<class MatrixClass >
Mantid::CurveFitting::FortranMatrix< MatrixClass >::FortranMatrix

Constructor.

Definition at line 74 of file EigenFortranMatrix.h.

◆ FortranMatrix() [2/3]

template<class MatrixClass >
Mantid::CurveFitting::FortranMatrix< MatrixClass >::FortranMatrix ( const int  nx,
const int  ny 
)

Constructor.

Definition at line 79 of file EigenFortranMatrix.h.

◆ FortranMatrix() [3/3]

template<class MatrixClass >
Mantid::CurveFitting::FortranMatrix< MatrixClass >::FortranMatrix ( const int  iFirst,
const int  iLast,
const int  jFirst,
const int  jLast 
)

Constructor.

Construct a FortranMatrix that has arbitrary index bases.

For example FortranMatrix(1,5, -2,2) creates a 5 x 5 matrix. When accessing elements through operator(i,j) the first index must be in the range 1 <= i <= 5 and the second in the range -2 <= j <= 2. The index ranges defined by this constructor apply only to operator () but not to methods get() and set().

Parameters
iFirst:: Lowest value for the first index
iLast:: Highest value for the first index
jFirst:: Lowest value for the second index
jLast:: Highest value for the second index

Definition at line 94 of file EigenFortranMatrix.h.

Member Function Documentation

◆ allocate() [1/2]

template<class MatrixClass >
void Mantid::CurveFitting::FortranMatrix< MatrixClass >::allocate ( const int  iFirst,
const int  iLast,
const int  jFirst,
const int  jLast 
)

◆ allocate() [2/2]

template<class MatrixClass >
void Mantid::CurveFitting::FortranMatrix< MatrixClass >::allocate ( const int  nx,
const int  ny 
)

Resize the matrix.

The index bases are 1.

Parameters
nx:: New size along the first index.
ny:: New size along the second index.

Definition at line 112 of file EigenFortranMatrix.h.

◆ len1()

template<class MatrixClass >
int Mantid::CurveFitting::FortranMatrix< MatrixClass >::len1

◆ len2()

template<class MatrixClass >
int Mantid::CurveFitting::FortranMatrix< MatrixClass >::len2

◆ makeSize()

template<class MatrixClass >
size_t Mantid::CurveFitting::FortranMatrix< MatrixClass >::makeSize ( const int  firstIndex,
const int  lastIndex 
)
staticprivate

Calculate the size (1D) of a matrix First.

Definition at line 65 of file EigenFortranMatrix.h.

◆ moveToBaseMatrix()

template<class MatrixClass >
MatrixClass Mantid::CurveFitting::FortranMatrix< MatrixClass >::moveToBaseMatrix

Move the data to a new matrix of MatrixClass.

Definition at line 132 of file EigenFortranMatrix.h.

◆ operator()() [1/2]

template<class MatrixClass >
FortranMatrix< MatrixClass >::ElementRefType Mantid::CurveFitting::FortranMatrix< MatrixClass >::operator() ( const int  i,
const int  j 
)

Get the reference to the data element.

Definition at line 127 of file EigenFortranMatrix.h.

◆ operator()() [2/2]

template<class MatrixClass >
FortranMatrix< MatrixClass >::ElementConstType Mantid::CurveFitting::FortranMatrix< MatrixClass >::operator() ( const int  i,
const int  j 
) const

Index operator.

The "index" operator.

Definition at line 120 of file EigenFortranMatrix.h.

◆ operator=()

template<class MatrixClass >
FortranMatrix< MatrixClass > & Mantid::CurveFitting::FortranMatrix< MatrixClass >::operator= ( const MatrixClass &  m)

Assignment operator - Matrix Class.

Definition at line 150 of file EigenFortranMatrix.h.

References Mantid::Geometry::m.

◆ transpose()

template<class MatrixClass >
FortranMatrix< MatrixClass > Mantid::CurveFitting::FortranMatrix< MatrixClass >::transpose

copy and transpose the matrix

Copy matrix, transpose, then return transposed copy.

Definition at line 143 of file EigenFortranMatrix.h.

Member Data Documentation

◆ m_base1

template<class MatrixClass >
int Mantid::CurveFitting::FortranMatrix< MatrixClass >::m_base1
private

Base for the first index.

Definition at line 23 of file EigenFortranMatrix.h.

◆ m_base2

template<class MatrixClass >
int Mantid::CurveFitting::FortranMatrix< MatrixClass >::m_base2
private

Base for the second index.

Definition at line 25 of file EigenFortranMatrix.h.


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