eigen_plugin.hpp
Go to the documentation of this file.
00001 
00011 /*****************************************************************************
00012 ** Ifdefs
00013 *****************************************************************************/
00014 
00015 #ifndef ECL_LINEAR_ALGEBRA_EIGEN_PLUGIN_HPP_
00016 #define ECL_LINEAR_ALGEBRA_EIGEN_PLUGIN_HPP_
00017 
00018 /*****************************************************************************
00019 ** Code
00020 *****************************************************************************/
00021 
00022 typedef MatrixFormatter<Derived,Scalar> Formatter;
00023 
00024 inline void conservativeResize(int rows, int cols)
00025 {
00026    PlainObject tmp(rows, cols); // alternatively: PlainObject::Zero(rows,cols)
00027    const int common_rows = std::min(rows, this->rows());
00028    const int common_cols = std::min(cols, this->cols());
00029    tmp.block(0,0,common_rows,common_cols) = this->block(0,0,common_rows,common_cols);
00030    this->derived().swap(tmp);
00031 }
00032 
00033 inline void conservativeResize(int size)
00034 {
00035    EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00036 
00037    if (RowsAtCompileTime == 1)
00038    {
00039           PlainObject tmp(1,size); // alternatively: PlainObject::Zero(1,size)
00040           const int common_size = std::min(cols(),size);
00041           tmp.block(0,0,1,common_size) = this->block(0,0,1,common_size);
00042           this->derived().swap(tmp);
00043    }
00044    else
00045    {
00046           PlainObject tmp(size,1); // alternatively: PlainObject::Zero(size,1)
00047           const int common_size = std::min(rows(),size);
00048           tmp.block(0,0,common_size,1) = this->block(0,0,common_size,1);
00049           this->derived().swap(tmp);
00050    }
00051 }
00052 
00053 #endif /* ECL_LINEAR_ALGEBRA_EIGEN_PLUGIN_HPP_ */


ecl_linear_algebra
Author(s): Daniel Stonier
autogenerated on Wed Aug 26 2015 11:27:14