Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::CurveFitting::EigenVector Class Reference

A wrapper around Eigen::Vector. More...

#include <EigenVector.h>

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

Public Member Functions

vec_map_type copy_view () const
 Get a copy of the eigen vector. More...
 
double dot (const EigenVector &v) const
 Calculate the dot product. More...
 
 EigenVector ()
 Constructor. More...
 
 EigenVector (const Eigen::VectorXd *v)
 Copy from a eigen::vector. More...
 
 EigenVector (const EigenVector &v)
 Copy constructor. More...
 
 EigenVector (const size_t n)
 Constructor. More...
 
 EigenVector (EigenVector &&v) noexcept
 Move constructor. More...
 
 EigenVector (std::initializer_list< double > ilist)
 Construct from an initialisation list. More...
 
 EigenVector (std::vector< double > v)
 Construct from a std vector. More...
 
double get (const size_t i) const
 Get an element. More...
 
size_t indexOfMaxElement () const
 Get index of the maximum element. More...
 
size_t indexOfMinElement () const
 Get index of the minimum element. More...
 
std::pair< size_t, size_t > indicesOfMinMaxElements () const
 Get indices of both the minimum and maximum elements. More...
 
const vec_map_type inspector () const
 Get the const map of the eigen vector. More...
 
vec_map_typemutator ()
 Get the map of the eigen vector. More...
 
double norm () const
 Get vector norm (length) More...
 
double norm2 () const
 Get vector norm squared. More...
 
void normalize ()
 Normalise this vector. More...
 
EigenVectoroperator*= (const double d)
 Multiply by a number. More...
 
EigenVectoroperator*= (const EigenVector &v)
 Multiply by a vector (per element) More...
 
EigenVectoroperator+= (const double d)
 Add a number. More...
 
EigenVectoroperator+= (const EigenVector &v)
 Add a vector. More...
 
EigenVectoroperator-= (const EigenVector &v)
 Subtract a vector. More...
 
EigenVectoroperator= (const Eigen::VectorXd v)
 Assignment operator - Eigen::VectorXd. More...
 
EigenVectoroperator= (const EigenVector &v)
 Copy assignment operator. More...
 
EigenVectoroperator= (const std::vector< double > &v)
 Assignment operator. More...
 
double & operator[] (const size_t i)
 Get a reference to an element. More...
 
const double & operator[] (const size_t i) const
 Get a const reference to an element. More...
 
void resize (const size_t n)
 Resize the vector. More...
 
void set (const size_t i, const double value)
 Set an element. More...
 
size_t size () const
 Size of the vector. More...
 
void sort (const std::vector< size_t > &indices)
 Sort this vector in order defined by an index array. More...
 
std::vector< size_t > sortIndices (bool ascending=true) const
 Create an index array that would sort this vector. More...
 
std::vector< double > & StdVectorRef ()
 Return a reference to m_data. More...
 
std::vector< double > toStdVector () const
 Copy the values to an std vector of doubles. More...
 
void zero ()
 

Private Attributes

std::vector< double > m_data
 Default element storage. More...
 
EigenVector_View m_view
 The map to the Eigen vector. More...
 

Detailed Description

A wrapper around Eigen::Vector.

Author
Roman Tolchenov, Tessella plc
Date
24/02/2012

Definition at line 27 of file EigenVector.h.

Constructor & Destructor Documentation

◆ EigenVector() [1/7]

Mantid::CurveFitting::EigenVector::EigenVector ( )

Constructor.

Definition at line 24 of file EigenVector.cpp.

◆ EigenVector() [2/7]

Mantid::CurveFitting::EigenVector::EigenVector ( const size_t  n)
explicit

Constructor.

Parameters
n:: The length of the vector.

Definition at line 28 of file EigenVector.cpp.

◆ EigenVector() [3/7]

Mantid::CurveFitting::EigenVector::EigenVector ( std::vector< double >  v)
explicit

Construct from a std vector.

Parameters
v:: A std vector.

Definition at line 32 of file EigenVector.cpp.

◆ EigenVector() [4/7]

Mantid::CurveFitting::EigenVector::EigenVector ( const Eigen::VectorXd *  v)
explicit

Copy from a eigen::vector.

Copy from an Eigen::Vector.

Parameters
v:: A vector to copy from.

Definition at line 51 of file EigenVector.cpp.

References m_data.

◆ EigenVector() [5/7]

Mantid::CurveFitting::EigenVector::EigenVector ( std::initializer_list< double >  ilist)

Construct from an initialisation list.

Parameters
ilist:: A list of doubles: {V0, V1, V2, ...}

Definition at line 37 of file EigenVector.cpp.

References set().

◆ EigenVector() [6/7]

Mantid::CurveFitting::EigenVector::EigenVector ( const EigenVector v)

Copy constructor.

Parameters
v:: The other vector

Definition at line 46 of file EigenVector.cpp.

◆ EigenVector() [7/7]

Mantid::CurveFitting::EigenVector::EigenVector ( EigenVector &&  v)
noexcept

Move constructor.

Definition at line 58 of file EigenVector.cpp.

Member Function Documentation

◆ copy_view()

vec_map_type Mantid::CurveFitting::EigenVector::copy_view ( ) const
inline

Get a copy of the eigen vector.

Definition at line 55 of file EigenVector.h.

◆ dot()

double Mantid::CurveFitting::EigenVector::dot ( const EigenVector v) const

Calculate the dot product.

Parameters
v:: The other vector.

Definition at line 199 of file EigenVector.cpp.

References dot(), inspector(), and size().

Referenced by dot().

◆ get()

double Mantid::CurveFitting::EigenVector::get ( const size_t  i) const

◆ indexOfMaxElement()

size_t Mantid::CurveFitting::EigenVector::indexOfMaxElement ( ) const

Get index of the maximum element.

Definition at line 222 of file EigenVector.cpp.

References m_data.

◆ indexOfMinElement()

size_t Mantid::CurveFitting::EigenVector::indexOfMinElement ( ) const

Get index of the minimum element.

Definition at line 209 of file EigenVector.cpp.

References m_data.

◆ indicesOfMinMaxElements()

std::pair< size_t, size_t > Mantid::CurveFitting::EigenVector::indicesOfMinMaxElements ( ) const

Get indices of both the minimum and maximum elements.

Definition at line 235 of file EigenVector.cpp.

References m_data.

◆ inspector()

const vec_map_type Mantid::CurveFitting::EigenVector::inspector ( ) const
inline

◆ mutator()

vec_map_type & Mantid::CurveFitting::EigenVector::mutator ( )
inline

◆ norm()

double Mantid::CurveFitting::EigenVector::norm ( ) const

Get vector norm (length)

Definition at line 189 of file EigenVector.cpp.

References norm2().

Referenced by Mantid::CurveFitting::NLLS::norm2(), and normalize().

◆ norm2()

double Mantid::CurveFitting::EigenVector::norm2 ( ) const

Get vector norm squared.

Get vector's norm squared.

Definition at line 192 of file EigenVector.cpp.

References m_data.

Referenced by norm().

◆ normalize()

void Mantid::CurveFitting::EigenVector::normalize ( )

Normalise this vector.

Definition at line 180 of file EigenVector.cpp.

References norm().

◆ operator*=() [1/2]

EigenVector & Mantid::CurveFitting::EigenVector::operator*= ( const double  d)

Multiply by a number.

Parameters
d:: The number

Definition at line 167 of file EigenVector.cpp.

References Mantid::Geometry::d, m_data, and Mantid::Geometry::x.

◆ operator*=() [2/2]

EigenVector & Mantid::CurveFitting::EigenVector::operator*= ( const EigenVector v)

Multiply by a vector (per element)

Definition at line 157 of file EigenVector.cpp.

References inspector(), mutator(), and size().

◆ operator+=() [1/2]

EigenVector & Mantid::CurveFitting::EigenVector::operator+= ( const double  d)

Add a number.

Parameters
d:: The number

Definition at line 174 of file EigenVector.cpp.

References Mantid::Geometry::d, m_data, and Mantid::Geometry::x.

◆ operator+=() [2/2]

EigenVector & Mantid::CurveFitting::EigenVector::operator+= ( const EigenVector v)

Add a vector.

Parameters
v:: The other vector

Definition at line 138 of file EigenVector.cpp.

References inspector(), mutator(), and size().

◆ operator-=()

EigenVector & Mantid::CurveFitting::EigenVector::operator-= ( const EigenVector v)

Subtract a vector.

Parameters
v:: The other vector

Definition at line 148 of file EigenVector.cpp.

References inspector(), mutator(), and size().

◆ operator=() [1/3]

EigenVector & Mantid::CurveFitting::EigenVector::operator= ( const Eigen::VectorXd  v)

Assignment operator - Eigen::VectorXd.

Definition at line 81 of file EigenVector.cpp.

References m_data, and m_view.

◆ operator=() [2/3]

EigenVector & Mantid::CurveFitting::EigenVector::operator= ( const EigenVector v)

Copy assignment operator.

Parameters
v:: The other vector

Definition at line 63 of file EigenVector.cpp.

References m_data, and m_view.

◆ operator=() [3/3]

EigenVector & Mantid::CurveFitting::EigenVector::operator= ( const std::vector< double > &  v)

Assignment operator.

Definition at line 70 of file EigenVector.cpp.

References m_data, and m_view.

◆ operator[]() [1/2]

double & Mantid::CurveFitting::EigenVector::operator[] ( const size_t  i)
inline

Get a reference to an element.

Definition at line 69 of file EigenVector.h.

References m_data.

◆ operator[]() [2/2]

const double & Mantid::CurveFitting::EigenVector::operator[] ( const size_t  i) const
inline

Get a const reference to an element.

Definition at line 67 of file EigenVector.h.

References m_data.

◆ resize()

void Mantid::CurveFitting::EigenVector::resize ( const size_t  n)

◆ set()

void Mantid::CurveFitting::EigenVector::set ( const size_t  i,
const double  value 
)

◆ size()

size_t Mantid::CurveFitting::EigenVector::size ( ) const

◆ sort()

void Mantid::CurveFitting::EigenVector::sort ( const std::vector< size_t > &  indices)

Sort this vector in order defined by an index array.

Parameters
indices:: Indices defining the order of elements in sorted vector.

Definition at line 266 of file EigenVector.cpp.

References m_data, m_view, and size().

Referenced by Mantid::CurveFitting::Functions::calculateExcitations().

◆ sortIndices()

std::vector< size_t > Mantid::CurveFitting::EigenVector::sortIndices ( bool  ascending = true) const

Create an index array that would sort this vector.

Parameters
ascending:: If true sort in ascending order. Otherwise sort in descending order.

Definition at line 251 of file EigenVector.cpp.

References size().

Referenced by Mantid::CurveFitting::Functions::calculateExcitations().

◆ StdVectorRef()

std::vector< double > & Mantid::CurveFitting::EigenVector::StdVectorRef ( )

Return a reference to m_data.

return reference to m_data

Definition at line 279 of file EigenVector.cpp.

References m_data.

◆ toStdVector()

std::vector< double > Mantid::CurveFitting::EigenVector::toStdVector ( ) const

Copy the values to an std vector of doubles.

Definition at line 276 of file EigenVector.cpp.

References m_data.

Referenced by Mantid::CurveFitting::CrystalFieldEnergies::exec().

◆ zero()

void Mantid::CurveFitting::EigenVector::zero ( )

Member Data Documentation

◆ m_data

std::vector<double> Mantid::CurveFitting::EigenVector::m_data
private

◆ m_view

EigenVector_View Mantid::CurveFitting::EigenVector::m_view
private

The map to the Eigen vector.

Definition at line 110 of file EigenVector.h.

Referenced by operator=(), resize(), and sort().


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