Mantid
|
FortranVector is a wrapper template for EigenVactor and EigenComplexVector to simplify porting fortran programs to C++. More...
#include <EigenFortranVector.h>
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... | |
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.
|
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.
|
private |
Definition at line 26 of file EigenFortranVector.h.
Mantid::CurveFitting::FortranVector< VectorClass >::FortranVector |
Constructor.
Definition at line 63 of file EigenFortranVector.h.
|
explicit |
Constructor.
Definition at line 67 of file EigenFortranVector.h.
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().
iFirst | :: Lowest value for the index |
iLast | :: Highest value for the index |
Definition at line 78 of file EigenFortranVector.h.
void Mantid::CurveFitting::FortranVector< VectorClass >::allocate | ( | int | iFirst, |
int | iLast | ||
) |
Resize the vector.
Named this way to mimic the fortran style and to avoid confusion with resize() method of the base class.
iFirst | :: Lowest value for the index |
iLast | :: Highest value for the index |
Definition at line 85 of file EigenFortranVector.h.
Referenced by Mantid::CurveFitting::NLLS::applyScaling(), Mantid::CurveFitting::Functions::calculateExcitations(), Mantid::CurveFitting::Functions::calculateMagneticMoment(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::calculateStep(), Mantid::CurveFitting::Functions::deg_on(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::evalF(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::initialize(), Mantid::CurveFitting::NLLS::NLLS_workspace::initialize(), Mantid::CurveFitting::NLLS::multJ(), and Mantid::CurveFitting::NLLS::multJt().
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.
newSize | :: The new size of the vector. Index base is set to 1. |
Definition at line 93 of file EigenFortranVector.h.
int Mantid::CurveFitting::FortranVector< VectorClass >::len |
Get the length of the vector as an int.
Definition at line 130 of file EigenFortranVector.h.
Referenced by Mantid::CurveFitting::NLLS::applyScaling(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::calculateStep(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::evalF(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::iterate(), Mantid::CurveFitting::NLLS::multJ(), and Mantid::CurveFitting::NLLS::multJt().
|
staticprivate |
Calculate the size (1D) of a matrix First.
Calculate the size of a vector.
Definition at line 55 of file EigenFortranVector.h.
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.
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.
FortranVector< VectorClass >::ElementConstType Mantid::CurveFitting::FortranVector< VectorClass >::operator() | ( | int | i | ) | const |
The "index" operator.
Definition at line 100 of file EigenFortranVector.h.
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.
FortranVector< VectorClass >::ElementConstType Mantid::CurveFitting::FortranVector< VectorClass >::operator[] | ( | int | i | ) | const |
The "index" operator.
Definition at line 112 of file EigenFortranVector.h.
|
private |
Base for the index.
Definition at line 22 of file EigenFortranVector.h.