class_VectorBlock.cpp File Reference

Go to the source code of this file.

Functions

int main (int, char **)
 
template<typename Derived >
const Eigen::VectorBlock< const Derived > segmentFromRange (const Eigen::MatrixBase< Derived > &v, int start, int end)
 
template<typename Derived >
Eigen::VectorBlock< Derived > segmentFromRange (Eigen::MatrixBase< Derived > &v, int start, int end)
 

Function Documentation

◆ main()

int main ( int  ,
char **   
)

Definition at line 18 of file class_VectorBlock.cpp.

19 {
20  Eigen::Matrix<int,1,6> v; v << 1,2,3,4,5,6;
21  std::cout << segmentFromRange(2*v, 2, 4) << std::endl; // calls the const version
22  segmentFromRange(v, 1, 3) *= 5; // calls the non-const version
23  std::cout << "Now the vector v is:" << std::endl << v << std::endl;
24  return 0;
25 }
Array< int, Dynamic, 1 > v
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
Eigen::VectorBlock< Derived > segmentFromRange(Eigen::MatrixBase< Derived > &v, int start, int end)

◆ segmentFromRange() [1/2]

template<typename Derived >
const Eigen::VectorBlock<const Derived> segmentFromRange ( const Eigen::MatrixBase< Derived > &  v,
int  start,
int  end 
)

Definition at line 13 of file class_VectorBlock.cpp.

14 {
15  return Eigen::VectorBlock<const Derived>(v.derived(), start, end-start);
16 }
Expression of a fixed-size or dynamic-size sub-vector.
Definition: VectorBlock.h:62
static const lastp1_t end

◆ segmentFromRange() [2/2]

template<typename Derived >
Eigen::VectorBlock<Derived> segmentFromRange ( Eigen::MatrixBase< Derived > &  v,
int  start,
int  end 
)

Definition at line 6 of file class_VectorBlock.cpp.

7 {
8  return Eigen::VectorBlock<Derived>(v.derived(), start, end-start);
9 }