mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Fix documentation of reshape to vectors.
This commit is contained in:
parent
84a1101b36
commit
41c3a2ffc1
@ -25,7 +25,7 @@
|
|||||||
/// AutoSize does preserve compile-time sizes when possible, i.e., when the sizes of the input are known at compile time \b and
|
/// AutoSize does preserve compile-time sizes when possible, i.e., when the sizes of the input are known at compile time \b and
|
||||||
/// that the other size is passed at compile-time using Eigen::fix<N> as above.
|
/// that the other size is passed at compile-time using Eigen::fix<N> as above.
|
||||||
///
|
///
|
||||||
/// \sa operator()(all), class Reshaped, fix, fix<N>(int)
|
/// \sa class Reshaped, fix, fix<N>(int)
|
||||||
///
|
///
|
||||||
template<int Order = ColMajor, typename NRowsType, typename NColsType>
|
template<int Order = ColMajor, typename NRowsType, typename NColsType>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
@ -40,22 +40,24 @@ reshaped(NRowsType nRows, NColsType nCols) const;
|
|||||||
|
|
||||||
/// \returns an expression of \c *this with columns (or rows) stacked to a linear column (or row) vector
|
/// \returns an expression of \c *this with columns (or rows) stacked to a linear column (or row) vector
|
||||||
///
|
///
|
||||||
/// \tparam Order specifies whether to glue columns or rows, and returns a column or row vector.
|
/// \tparam Order specifies whether to stack columns to a column-vector (ColMajor) or
|
||||||
/// Possible values are ColMajor, RowMajor or AutoOrder. The default is ColMajor.
|
/// to cat rows to a row-vector (RowMajor). The default is ColMajor.
|
||||||
///
|
///
|
||||||
/// If Order==ColMajor (the default), then it returns a column vector from the stacked columns of \c *this.
|
/// If Order==ColMajor (the default), then it returns a column vector from the stacked columns of \c *this.
|
||||||
/// This is equivalent to \code A(all) \endcode and \code A.reshaped<RowMajor>(fix<1>,AutoSize) \endcode.
|
/// This is equivalent to `A.reshaped<ColMajor>(AutoSize,fix<1>)`.
|
||||||
///
|
///
|
||||||
/// If Order==RowMajor, then it returns a row vector from the glued rows of \c *this.
|
/// If Order==RowMajor, then it returns a row vector from the glued rows of \c *this.
|
||||||
/// This is equivalent to \code A.reshaped<RowMajor>(fix<1>,AutoSize) \endcode.
|
/// This is equivalent to `A.reshaped<RowMajor>(fix<1>,AutoSize)`.
|
||||||
///
|
///
|
||||||
/// If Order=AutoOrder, the it returns the same expression as \code A.reshaped<storage_order_of_A>() \endcode
|
/// Example:
|
||||||
|
/// \include MatrixBase_reshaped_to_vector.cpp
|
||||||
|
/// Output: \verbinclude MatrixBase_reshaped_to_vector.out
|
||||||
///
|
///
|
||||||
/// If you want more control, you can still fall back to reshaped(NRowsType,NColsType).
|
/// If you want more control, you can still fall back to reshaped(NRowsType,NColsType).
|
||||||
/// For instance, to return a column vector with element stacked following the storage order,
|
/// For instance, to return a column vector with element stacked following the storage order,
|
||||||
/// you can do: \code A.reshaped<AutoOrder>(AutoSize,fix<1>) \endcode
|
/// you can do: \code A.reshaped<AutoOrder>(AutoSize,fix<1>) \endcode
|
||||||
///
|
///
|
||||||
/// \sa operator()(all), reshaped(NRowsType,NColsType), class Reshaped
|
/// \sa reshaped(NRowsType,NColsType), class Reshaped
|
||||||
///
|
///
|
||||||
template<int Order = ColMajor>
|
template<int Order = ColMajor>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
@ -68,20 +70,6 @@ EIGEN_DEVICE_FUNC
|
|||||||
inline const Reshaped<const Derived,...>
|
inline const Reshaped<const Derived,...>
|
||||||
reshaped() const;
|
reshaped() const;
|
||||||
|
|
||||||
/// \returns as expression of \c *this with columns stacked to a linear column vector
|
|
||||||
///
|
|
||||||
/// This overload is essentially a shortcut for
|
|
||||||
/// \code this->reshape(AutoSize,fix<1>) \endcode
|
|
||||||
///
|
|
||||||
/// Example:
|
|
||||||
/// \include MatrixBase_reshaped_all.cpp
|
|
||||||
/// Output: \verbinclude MatrixBase_reshaped_all.out
|
|
||||||
///
|
|
||||||
/// \sa reshaped()
|
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
inline Reshaped<Derived,SizeAtCompileTime,1>
|
|
||||||
operator()(all);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// This file is automatically included twice to generate const and non-const versions
|
// This file is automatically included twice to generate const and non-const versions
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
Matrix4i m = Matrix4i::Random();
|
|
||||||
cout << "Here is the matrix m:" << endl << m << endl;
|
|
||||||
cout << "Here is m(all).transpose():" << endl << m(all).transpose() << endl;
|
|
||||||
cout << "Here is m.reshaped(fix<1>,AutoSize):" << endl << m.reshaped(fix<1>,AutoSize) << endl;
|
|
4
doc/snippets/MatrixBase_reshaped_to_vector.cpp
Normal file
4
doc/snippets/MatrixBase_reshaped_to_vector.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Matrix4i m = Matrix4i::Random();
|
||||||
|
cout << "Here is the matrix m:" << endl << m << endl;
|
||||||
|
cout << "Here is m.reshaped().transpose():" << endl << m.reshaped().transpose() << endl;
|
||||||
|
cout << "Here is m.reshaped<RowMajor>(): " << endl << m.reshaped<RowMajor>() << endl;
|
Loading…
x
Reference in New Issue
Block a user