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 ** Includes
00020 *****************************************************************************/
00021 
00022 #include "formatters.hpp"
00023 
00024 /*****************************************************************************
00025 ** Code
00026 *****************************************************************************/
00027 
00028 typedef MatrixFormatter<Derived,Scalar> Formatter;
00029 
00030 inline void conservativeResize(int rows, int cols)
00031 {
00032    PlainObject tmp(rows, cols); // alternatively: PlainObject::Zero(rows,cols)
00033    const int common_rows = std::min(rows, this->rows());
00034    const int common_cols = std::min(cols, this->cols());
00035    tmp.block(0,0,common_rows,common_cols) = this->block(0,0,common_rows,common_cols);
00036    this->derived().swap(tmp);
00037 }
00038 
00039 inline void conservativeResize(int size)
00040 {
00041    EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
00042 
00043    if (RowsAtCompileTime == 1)
00044    {
00045           PlainObject tmp(1,size); // alternatively: PlainObject::Zero(1,size)
00046           const int common_size = std::min(cols(),size);
00047           tmp.block(0,0,1,common_size) = this->block(0,0,1,common_size);
00048           this->derived().swap(tmp);
00049    }
00050    else
00051    {
00052           PlainObject tmp(size,1); // alternatively: PlainObject::Zero(size,1)
00053           const int common_size = std::min(rows(),size);
00054           tmp.block(0,0,common_size,1) = this->block(0,0,common_size,1);
00055           this->derived().swap(tmp);
00056    }
00057 }
00058 
00059 #endif /* ECL_LINEAR_ALGEBRA_EIGEN_PLUGIN_HPP_ */


ecl_linear_algebra
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:17:37