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

FortranVector is a wrapper template for EigenVactor and EigenComplexVector to simplify porting fortran programs to C++. More...

#include <EigenFortranVector.h>

Inheritance diagram for Mantid::CurveFitting::FortranVector< VectorClass >:

Public Member Functions

void allocate (int firstIndex, int lastIndex)
 Resize the vector. More...
 
void allocate (int newSize)
 Resize the vector with base 1. More...
 
 FortranVector ()
 Constructor. More...
 
 FortranVector (const int iFrom, const int iTo)
 Constructor. More...
 
 FortranVector (const int n)
 Constructor. More...
 
int len () const
 Get the length of the vector as an int. More...
 
VectorClass moveToBaseVector ()
 Move the data of this vector to a newly created vector of the bas class. More...
 
ElementRefType operator() (int i)
 Get the reference to the data element. More...
 
ElementConstType operator() (int i) const
 The "index" operator. More...
 
ElementRefType operator[] (int i)
 Get the reference to the data element. More...
 
ElementConstType operator[] (int i) const
 The "index" operator. More...
 

Private Types

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

Static Private Member Functions

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

Private Attributes

int m_base
 Base for the index. More...
 

Detailed Description

template<class VectorClass>
class Mantid::CurveFitting::FortranVector< VectorClass >

FortranVector is a wrapper template for EigenVactor and EigenComplexVector to simplify porting fortran programs to C++.

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

Definition at line 20 of file EigenFortranVector.h.

Member Typedef Documentation

◆ ElementConstType

template<class VectorClass >
using Mantid::CurveFitting::FortranVector< VectorClass >::ElementConstType = decltype(std::declval<const VectorClass>()[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 25 of file EigenFortranVector.h.

◆ ElementRefType

template<class VectorClass >
using Mantid::CurveFitting::FortranVector< VectorClass >::ElementRefType = decltype(std::declval<VectorClass>()[0])
private

Definition at line 26 of file EigenFortranVector.h.

Constructor & Destructor Documentation

◆ FortranVector() [1/3]

template<class VectorClass >
Mantid::CurveFitting::FortranVector< VectorClass >::FortranVector

Constructor.

Definition at line 63 of file EigenFortranVector.h.

◆ FortranVector() [2/3]

template<class VectorClass >
Mantid::CurveFitting::FortranVector< VectorClass >::FortranVector ( const int  n)
explicit

Constructor.

Definition at line 67 of file EigenFortranVector.h.

◆ FortranVector() [3/3]

template<class VectorClass >
Mantid::CurveFitting::FortranVector< VectorClass >::FortranVector ( const int  iFirst,
const int  iLast 
)

Constructor.

Construct a FortranVector that has arbitrary index bases.

For example FortranVector(-2,2) creates a vector of length 5. When accessing elements through operator(i) the index must be in the range -2 <= j <= 2. The index ranges defined by this constructor apply only to operators () and [] but not to methods get() and set().

Parameters
iFirst:: Lowest value for the index
iLast:: Highest value for the index

Definition at line 78 of file EigenFortranVector.h.

Member Function Documentation

◆ allocate() [1/2]

template<class VectorClass >
void Mantid::CurveFitting::FortranVector< VectorClass >::allocate ( int  iFirst,
int  iLast 
)

◆ allocate() [2/2]

template<class VectorClass >
void Mantid::CurveFitting::FortranVector< VectorClass >::allocate ( int  newSize)

Resize the vector with base 1.

Resize the vector.

Named this way to mimic the fortran style and to avoid confusion with resize() method of the base class.

Parameters
newSize:: The new size of the vector. Index base is set to 1.

Definition at line 93 of file EigenFortranVector.h.

◆ len()

template<class VectorClass >
int Mantid::CurveFitting::FortranVector< VectorClass >::len

◆ makeSize()

template<class VectorClass >
size_t Mantid::CurveFitting::FortranVector< VectorClass >::makeSize ( int  firstIndex,
int  lastIndex 
)
staticprivate

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

Calculate the size of a vector.

Definition at line 55 of file EigenFortranVector.h.

◆ moveToBaseVector()

template<class VectorClass >
VectorClass Mantid::CurveFitting::FortranVector< VectorClass >::moveToBaseVector

Move the data of this vector to a newly created vector of the bas class.

Do not use this vector after calling this method. The intension of it is to keep fortran-style calculations separate from C++-style.

Definition at line 125 of file EigenFortranVector.h.

◆ operator()() [1/2]

template<class VectorClass >
FortranVector< VectorClass >::ElementRefType Mantid::CurveFitting::FortranVector< VectorClass >::operator() ( int  i)

Get the reference to the data element.

Definition at line 106 of file EigenFortranVector.h.

◆ operator()() [2/2]

template<class VectorClass >
FortranVector< VectorClass >::ElementConstType Mantid::CurveFitting::FortranVector< VectorClass >::operator() ( int  i) const

The "index" operator.

Definition at line 100 of file EigenFortranVector.h.

◆ operator[]() [1/2]

template<class VectorClass >
FortranVector< VectorClass >::ElementRefType Mantid::CurveFitting::FortranVector< VectorClass >::operator[] ( int  i)

Get the reference to the data element.

Definition at line 118 of file EigenFortranVector.h.

◆ operator[]() [2/2]

template<class VectorClass >
FortranVector< VectorClass >::ElementConstType Mantid::CurveFitting::FortranVector< VectorClass >::operator[] ( int  i) const

The "index" operator.

Definition at line 112 of file EigenFortranVector.h.

Member Data Documentation

◆ m_base

template<class VectorClass >
int Mantid::CurveFitting::FortranVector< VectorClass >::m_base
private

Base for the index.

Definition at line 22 of file EigenFortranVector.h.


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