Template Class CVectorDynamic
Defined in File CVectorDynamic.h
Inheritance Relationships
Base Type
public mrpt::math::MatrixVectorBase< T, CVectorDynamic< T > >(Template Class MatrixVectorBase)
Class Documentation
-
template<class T>
class CVectorDynamic : public mrpt::math::MatrixVectorBase<T, CVectorDynamic<T>> Template for column vectors of dynamic size, compatible with Eigen.
See also
Note
For a complete introduction to Matrices and vectors in MRPT, see: http://www.mrpt.org/Matrices_vectors_arrays_and_Linear_Algebra_MRPT_and_Eigen_classes
Matrix type definitions
-
using Index = matrix_index_t
-
using size_type = matrix_dim_t
-
using difference_type = std::ptrdiff_t
-
static constexpr int RowsAtCompileTime = -1
-
static constexpr int ColsAtCompileTime = 1
-
static constexpr int is_mrpt_type = 1
Iterators interface
-
inline const_iterator begin() const
-
inline const_iterator end() const
-
inline const_iterator cbegin() const
-
inline const_iterator cend() const
Public Functions
-
inline void realloc(size_type new_len, bool newElementsToZero = false)
Internal use only: It reallocs the memory for the 2D matrix, maintaining the previous contents if possible.
-
inline void swap(CVectorDynamic<T> &o)
-
CVectorDynamic() = default
-
template<typename U>
inline explicit CVectorDynamic(const CVectorDynamic<U> &m) Copy (casting from if needed) from another matrix
-
template<size_type ROWS>
inline explicit CVectorDynamic(const CMatrixFixed<T, ROWS, 1> &v) Ctor from a fixed-size vector
-
template<typename ARRAY, typename = std::enable_if_t<std::is_array_v<ARRAY>>>
inline CVectorDynamic(const ARRAY &data) Constructor from a given size and a C array. The array length must match cols x row.
const double numbers[] = { 1,2,3, 4,5,6 }; CMatrixDouble M(3,2, numbers);
-
template<class Derived>
inline explicit CVectorDynamic(const Eigen::MatrixBase<Derived> &m) Convert from Eigen matrix
-
inline bool empty() const
-
inline void setSize(size_type row, size_type col, bool zeroNewElements = false)
Changes the size of matrix, maintaining the previous contents.
-
template<typename U>
inline CVectorDynamic &operator=(const CMatrixDynamic<U> &m) Assignment operator from another matrix (possibly of a different type)
-
template<class Derived>
inline CVectorDynamic &operator=(const Eigen::MatrixBase<Derived> &m) Assignment from an Eigen matrix
-
template<matrix_dim_t ROWS>
inline CVectorDynamic &operator=(const CMatrixFixed<T, ROWS, 1> &v) Assignment from a fixed-size vector
-
template<int LEN>
inline CMatrixFixed<Scalar, LEN, 1> segmentCopy(int start = 0) const const segmentCopy(): Returns a copy of the given vector segment
-
inline CVectorDynamic<Scalar> segmentCopy(int start, int LEN) const
const segmentCopy(): Returns a copy of the given vector segment (non templated version, dynamic length)
-
inline const T &operator()(Index row, Index col) const
Subscript operator to get individual elements
-
inline T &operator[](Index ith)
Subscript operator to get/set an individual element from a row or column matrix.
- Throws:
std::exception – If the object is not a column or row matrix.
-
inline const T &operator[](Index ith) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
template<typename EIGEN_VECTOR = eigen_t, typename EIGEN_MAP = Eigen::Map<EIGEN_VECTOR, MRPT_MAX_ALIGN_BYTES, Eigen::InnerStride<1>>>
inline EIGEN_MAP asEigen() Get as an Eigen-compatible Eigen::Map object
-
template<typename EIGEN_VECTOR = Eigen::Matrix<T, -1, 1, 0, -1, 1>, typename EIGEN_MAP = Eigen::Map<const EIGEN_VECTOR, MRPT_MAX_ALIGN_BYTES, Eigen::InnerStride<1>>>
inline EIGEN_MAP asEigen() const
-
template<typename T2>
CVectorDynamic<T2> cast() const
Protected Types
-
using vec_t = mrpt::containers::vector_with_small_size_optimization<T, small_size, MRPT_MAX_STATIC_ALIGN_BYTES>
Protected Static Attributes
-
static constexpr size_t small_size = 16
-
using Index = matrix_index_t