Revision d3661924f8d555396418399c38395b8ca49cdecb authored by eriszhang on 08 August 2021, 03:00:33 UTC, committed by eriszhang on 08 August 2021, 03:00:33 UTC
1 parent 11f7ded
remove_vector_element.cpp
#include "remove_vector_element.h"
void remove_vector_element(
const int idxToRemove,
Eigen::VectorXd & vec)
{
unsigned int numEles = vec.size() - 1;
if( idxToRemove < numEles )
vec.segment(idxToRemove,numEles-idxToRemove) = vec.segment(idxToRemove+1,numEles-idxToRemove);
vec.conservativeResize(numEles);
}
void remove_vector_element(
const int idxToRemove,
Eigen::VectorXi & vec)
{
unsigned int numEles = vec.size() - 1;
if( idxToRemove < numEles )
vec.segment(idxToRemove,numEles-idxToRemove) = vec.segment(idxToRemove+1,numEles-idxToRemove);
vec.conservativeResize(numEles);
}
// template <class M>
// void remove_vector_element(
// const int & idxToRemove,
// M & vec)
// {
// unsigned int numEles = vec.size() - 1;
// if( idxToRemove < numEles )
// vec.segment(idxToRemove,numEles-idxToRemove) = vec.segment(idxToRemove+1,numEles-idxToRemove);
// vec.conservativeResize(numEles);
// }
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...