Public Types | Public Member Functions | Private Types | List of all members
Eigen::Reshaped< XprType, Rows, Cols, Order > Class Template Reference

Expression of a fixed-size or dynamic-size reshape. More...

#include <Reshaped.h>

Inheritance diagram for Eigen::Reshaped< XprType, Rows, Cols, Order >:
Inheritance graph
[legend]

Public Types

typedef Impl Base
 

Public Member Functions

EIGEN_DEVICE_FUNC Reshaped (XprType &xpr)
 
EIGEN_DEVICE_FUNC Reshaped (XprType &xpr, Index reshapeRows, Index reshapeCols)
 

Private Types

typedef ReshapedImpl< XprType, Rows, Cols, Order, typename internal::traits< XprType >::StorageKind > Impl
 

Detailed Description

template<typename XprType, int Rows, int Cols, int Order>
class Eigen::Reshaped< XprType, Rows, Cols, Order >

Expression of a fixed-size or dynamic-size reshape.

Template Parameters
XprTypethe type of the expression in which we are taking a reshape
Rowsthe number of rows of the reshape we are taking at compile time (optional)
Colsthe number of columns of the reshape we are taking at compile time (optional)
Ordercan be ColMajor or RowMajor, default is ColMajor.

This class represents an expression of either a fixed-size or dynamic-size reshape. It is the return type of DenseBase::reshaped(NRowsType,NColsType) and most of the time this is the only way it is used.

However, in C++98, if you want to directly maniputate reshaped expressions, for instance if you want to write a function returning such an expression, you will need to use this class. In C++11, it is advised to use the auto keyword for such use cases.

Here is an example illustrating the dynamic case:

#include <Eigen/Core>
#include <iostream>
using namespace std;
using namespace Eigen;
template<typename Derived>
{
return Reshaped<const Derived>(m.derived(), rows, cols);
}
int main(int, char**)
{
MatrixXd m(3, 4);
m << 1, 4, 7, 10,
2, 5, 8, 11,
3, 6, 9, 12;
cout << m << endl;
cout << "Matrix m is:" << endl << m << endl;
cout << "Matrix n is:" << endl << n << endl;
}

Output:

Here is an example illustrating the fixed-size case:

#include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
{
return Eigen::Reshaped<Derived, 4, 2>(m.derived());
}
int main(int, char**)
{
MatrixXd m(2, 4);
m << 1, 2, 3, 4,
5, 6, 7, 8;
MatrixXd n = reshape_helper(m);
cout << "matrix m is:" << endl << m << endl;
cout << "matrix n is:" << endl << n << endl;
return 0;
}

Output:

See also
DenseBase::reshaped(NRowsType,NColsType)

Definition at line 96 of file Reshaped.h.

Member Typedef Documentation

◆ Base

template<typename XprType , int Rows, int Cols, int Order>
typedef Impl Eigen::Reshaped< XprType, Rows, Cols, Order >::Base

Definition at line 102 of file Reshaped.h.

◆ Impl

template<typename XprType , int Rows, int Cols, int Order>
typedef ReshapedImpl<XprType, Rows, Cols, Order, typename internal::traits<XprType>::StorageKind> Eigen::Reshaped< XprType, Rows, Cols, Order >::Impl
private

Definition at line 99 of file Reshaped.h.

Constructor & Destructor Documentation

◆ Reshaped() [1/2]

template<typename XprType , int Rows, int Cols, int Order>
EIGEN_DEVICE_FUNC Eigen::Reshaped< XprType, Rows, Cols, Order >::Reshaped ( XprType xpr)
inline

Fixed-size constructor

Definition at line 109 of file Reshaped.h.

◆ Reshaped() [2/2]

template<typename XprType , int Rows, int Cols, int Order>
EIGEN_DEVICE_FUNC Eigen::Reshaped< XprType, Rows, Cols, Order >::Reshaped ( XprType xpr,
Index  reshapeRows,
Index  reshapeCols 
)
inline

Dynamic-size constructor

Definition at line 119 of file Reshaped.h.


The documentation for this class was generated from the following file:
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
reshape_helper
Eigen::Reshaped< Derived, 4, 2 > reshape_helper(MatrixBase< Derived > &m)
Definition: class_FixedReshaped.cpp:8
rows
int rows
Definition: Tutorial_commainit_02.cpp:1
main
int main(int argc, char **argv)
Definition: cmake/example_cmake_find_gtsam/main.cpp:63
n
int n
Definition: BiCGSTAB_simple.cpp:1
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
Eigen::Ref
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:281
std
Definition: BFloat16.h:88
Eigen::MatrixBase
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
cols
int cols
Definition: Tutorial_commainit_02.cpp:1
Eigen::Reshaped
Expression of a fixed-size or dynamic-size reshape.
Definition: Reshaped.h:96


gtsam
Author(s):
autogenerated on Thu Dec 19 2024 04:10:40