class aux::AuxiliaryFunctionality¶
Overview¶
Some auxiliary functions. More…
#include <AdditionalFunctionality.h>
class AuxiliaryFunctionality {
public:
// construction
AuxiliaryFunctionality();
virtual ~AuxiliaryFunctionality();
// methods
void assembleMatrixOfRepetitiveCoordinates(const gpr::Coord& coord, gpr::EigenMatrix& matrix, Eigen::VectorXd& ind);
void assembleVectorFromEnergyAndGradient(const gpr::Observation& observation, Eigen::VectorXd& vector);
template <typename D, template<typename> class T>
void repmatConst(const gpr::Index_t Ni, const gpr::Index_t Nj, const D value, T<D>& field);
};
Detailed Documentation¶
Some auxiliary functions.
Methods¶
void assembleMatrixOfRepetitiveCoordinates(const gpr::Coord& coord, gpr::EigenMatrix& matrix, Eigen::VectorXd& ind)
Assemble Eigen matrix with repetitive rows based on provided set of coordinates R.
This function mimics the following MATAB code:
[N_im,D] = size(R);
matrix = [repmat(R,D+1,1),reshape(repmat(0:D,N_im,1),[],1)];
The last column in the resulting matrix consists of repetitive integer indices.
Note
The resulting matrix will have size [(size(R, 2) + 1) * size(R, 1); size(R, 2) + 1].
Note
Uses Eigen block replication (D+1 block copies) instead of element-wise assignment. The index column and ind vector are filled with setConstant() per block.
Parameters:
coord |
Original set of coordinates |
matrix |
Matrix assembled using coord |
ind |
Vector of indices |
void assembleVectorFromEnergyAndGradient(const gpr::Observation& observation, Eigen::VectorXd& vector)
Combine Energy and gradient into a single Eigen vector.
Note
Gradient is copied in column-major order via Eigen::Map to match the ind_Ddim block structure expected by the covariance matrix layout (all dE/dx first, then dE/dy, then dE/dz).
template <typename D, template<typename> class T>
void repmatConst(const gpr::Index_t Ni, const gpr::Index_t Nj, const D value, T<D>& field)
Simple replica of the repmat from MATLAB. repmat(ref_value, Ni, Nj)