Mantid
|
A wrapper around Eigen::Vector. More...
#include <EigenVector.h>
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_type & | mutator () |
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... | |
EigenVector & | operator*= (const double d) |
Multiply by a number. More... | |
EigenVector & | operator*= (const EigenVector &v) |
Multiply by a vector (per element) More... | |
EigenVector & | operator+= (const double d) |
Add a number. More... | |
EigenVector & | operator+= (const EigenVector &v) |
Add a vector. More... | |
EigenVector & | operator-= (const EigenVector &v) |
Subtract a vector. More... | |
EigenVector & | operator= (const Eigen::VectorXd v) |
Assignment operator - Eigen::VectorXd. More... | |
EigenVector & | operator= (const EigenVector &v) |
Copy assignment operator. More... | |
EigenVector & | operator= (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... | |
Mantid::CurveFitting::EigenVector::EigenVector | ( | ) |
Constructor.
Definition at line 24 of file EigenVector.cpp.
|
explicit |
Constructor.
n | :: The length of the vector. |
Definition at line 28 of file EigenVector.cpp.
|
explicit |
Construct from a std vector.
v | :: A std vector. |
Definition at line 32 of file EigenVector.cpp.
|
explicit |
Copy from a eigen::vector.
Copy from an Eigen::Vector.
v | :: A vector to copy from. |
Definition at line 51 of file EigenVector.cpp.
References m_data.
Mantid::CurveFitting::EigenVector::EigenVector | ( | std::initializer_list< double > | ilist | ) |
Construct from an initialisation list.
ilist | :: A list of doubles: {V0, V1, V2, ...} |
Definition at line 37 of file EigenVector.cpp.
References set().
Mantid::CurveFitting::EigenVector::EigenVector | ( | const EigenVector & | v | ) |
|
noexcept |
Move constructor.
Definition at line 58 of file EigenVector.cpp.
|
inline |
Get a copy of the eigen vector.
Definition at line 55 of file EigenVector.h.
double Mantid::CurveFitting::EigenVector::dot | ( | const EigenVector & | v | ) | const |
Calculate the dot product.
v | :: The other vector. |
Definition at line 199 of file EigenVector.cpp.
References dot(), inspector(), and size().
Referenced by dot().
double Mantid::CurveFitting::EigenVector::get | ( | const size_t | i | ) | const |
Get an element.
get an element
i | :: The element index |
Definition at line 124 of file EigenVector.cpp.
References m_data.
Referenced by Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares::addValDerivHessian(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::algorithmDisplacement(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::boundApplication(), Mantid::CurveFitting::Functions::CrystalFieldFunction::calcExcitations(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::calcExcitations(), Mantid::CurveFitting::CostFunctions::CostFuncPoisson::calculateDerivative(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::deriv(), Mantid::CurveFitting::Functions::BSpline::function1D(), Mantid::CurveFitting::Functions::CrystalFieldPeaks::functionGeneral(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMDMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::DampedGaussNewtonMinimizer::iterate(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::setParameters(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::valAndDeriv(), and Mantid::CurveFitting::CostFunctions::CostFuncFitting::valDerivHessian().
size_t Mantid::CurveFitting::EigenVector::indexOfMaxElement | ( | ) | const |
Get index of the maximum element.
Definition at line 222 of file EigenVector.cpp.
References m_data.
size_t Mantid::CurveFitting::EigenVector::indexOfMinElement | ( | ) | const |
Get index of the minimum element.
Definition at line 209 of file EigenVector.cpp.
References m_data.
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.
|
inline |
Get the const map of the eigen vector.
Definition at line 53 of file EigenVector.h.
Referenced by dot(), Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMDMinimizer::iterate(), Mantid::CurveFitting::EigenMatrix::multiplyByVector(), Mantid::CurveFitting::EigenMatrix::operator*(), operator*=(), operator+=(), and operator-=().
|
inline |
Get the map of the eigen vector.
Definition at line 51 of file EigenVector.h.
Referenced by Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMDMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::DampedGaussNewtonMinimizer::iterate(), Mantid::CurveFitting::NLLS::multJ(), Mantid::CurveFitting::NLLS::multJt(), operator*=(), operator+=(), operator-=(), and Mantid::CurveFitting::NLLS::rankOneUpdate().
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().
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().
void Mantid::CurveFitting::EigenVector::normalize | ( | ) |
EigenVector & Mantid::CurveFitting::EigenVector::operator*= | ( | const double | d | ) |
Multiply by a number.
d | :: The number |
Definition at line 167 of file EigenVector.cpp.
References Mantid::Geometry::d, m_data, and Mantid::Geometry::x.
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().
EigenVector & Mantid::CurveFitting::EigenVector::operator+= | ( | const double | d | ) |
Add a number.
d | :: The number |
Definition at line 174 of file EigenVector.cpp.
References Mantid::Geometry::d, m_data, and Mantid::Geometry::x.
EigenVector & Mantid::CurveFitting::EigenVector::operator+= | ( | const EigenVector & | v | ) |
Add a vector.
v | :: The other vector |
Definition at line 138 of file EigenVector.cpp.
References inspector(), mutator(), and size().
EigenVector & Mantid::CurveFitting::EigenVector::operator-= | ( | const EigenVector & | v | ) |
Subtract a vector.
v | :: The other vector |
Definition at line 148 of file EigenVector.cpp.
References inspector(), mutator(), and size().
EigenVector & Mantid::CurveFitting::EigenVector::operator= | ( | const Eigen::VectorXd | v | ) |
Assignment operator - Eigen::VectorXd.
Definition at line 81 of file EigenVector.cpp.
EigenVector & Mantid::CurveFitting::EigenVector::operator= | ( | const EigenVector & | v | ) |
Copy assignment operator.
v | :: The other vector |
Definition at line 63 of file EigenVector.cpp.
EigenVector & Mantid::CurveFitting::EigenVector::operator= | ( | const std::vector< double > & | v | ) |
|
inline |
|
inline |
Get a const reference to an element.
Definition at line 67 of file EigenVector.h.
References m_data.
void Mantid::CurveFitting::EigenVector::resize | ( | const size_t | n | ) |
Resize the vector.
n | :: The new length |
Definition at line 96 of file EigenVector.cpp.
References m_data, m_view, n, and size().
Referenced by Mantid::CurveFitting::CostFunctions::CostFuncPoisson::addValDerivHessian(), Mantid::CurveFitting::ComplexMatrix::eigenSystemHermitian(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::getParameters(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::initChainsAndParameters(), and Mantid::CurveFitting::CostFunctions::CostFuncFitting::valDerivHessian().
void Mantid::CurveFitting::EigenVector::set | ( | const size_t | i, |
const double | value | ||
) |
Set an element.
set an element
i | :: The element index |
value | :: The new value |
Definition at line 113 of file EigenVector.cpp.
Referenced by Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares::addValDerivHessian(), Mantid::CurveFitting::CostFunctions::CostFuncPoisson::calculateDerivative(), EigenVector(), Mantid::CurveFitting::FuncMinimisers::TrustRegionMinimizer::evalF(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::getParameters(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::initChainsAndParameters(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::LevenbergMarquardtMDMinimizer::iterate(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::tieApplication(), and Mantid::CurveFitting::CostFunctions::CostFuncFitting::valDerivHessian().
size_t Mantid::CurveFitting::EigenVector::size | ( | ) | const |
Size of the vector.
Definition at line 108 of file EigenVector.cpp.
References m_data.
Referenced by Mantid::CurveFitting::CostFunctions::CostFuncLeastSquares::addValDerivHessian(), Mantid::CurveFitting::Functions::CrystalFieldFunction::calcExcitations(), Mantid::CurveFitting::Functions::CrystalFieldMultiSpectrum::calcExcitations(), Mantid::CurveFitting::Functions::CrystalFieldPeaksBase::calculateEigenSystem(), Mantid::CurveFitting::Functions::calculateExcitations(), Mantid::CurveFitting::Functions::calculateIntensities(), dot(), Mantid::CurveFitting::Functions::CrystalFieldPeaks::functionGeneral(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::getParameters(), Mantid::CurveFitting::FuncMinimisers::FABADAMinimizer::initChainsAndParameters(), Mantid::CurveFitting::EigenMatrix::multiplyByVector(), Mantid::CurveFitting::NLLS::norm2(), Mantid::CurveFitting::EigenMatrix::operator*(), operator*=(), operator+=(), operator-=(), Mantid::CurveFitting::operator<<(), resize(), Mantid::CurveFitting::CostFunctions::CostFuncFitting::setParameters(), sort(), and sortIndices().
void Mantid::CurveFitting::EigenVector::sort | ( | const std::vector< size_t > & | indices | ) |
Sort this vector in order defined by an index array.
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().
std::vector< size_t > Mantid::CurveFitting::EigenVector::sortIndices | ( | bool | ascending = true | ) | const |
Create an index array that would sort this vector.
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().
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.
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().
void Mantid::CurveFitting::EigenVector::zero | ( | ) |
Definition at line 134 of file EigenVector.cpp.
References m_data.
Referenced by Mantid::CurveFitting::CostFunctions::CostFuncPoisson::addValDerivHessian(), Mantid::CurveFitting::Functions::calculateZeemanEigensystem(), Mantid::CurveFitting::Functions::BSpline::evaluateBasisFunctions(), Mantid::CurveFitting::NLLS::NLLS_workspace::initialize(), and Mantid::CurveFitting::CostFunctions::CostFuncFitting::valDerivHessian().
|
private |
Default element storage.
Definition at line 108 of file EigenVector.h.
Referenced by EigenVector(), get(), indexOfMaxElement(), indexOfMinElement(), indicesOfMinMaxElements(), norm2(), operator*=(), operator+=(), operator=(), resize(), set(), size(), sort(), StdVectorRef(), toStdVector(), and zero().
|
private |
The map to the Eigen vector.
Definition at line 110 of file EigenVector.h.
Referenced by operator=(), resize(), and sort().