mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Removed Column and Row in favor of Block
This commit is contained in:
@@ -3,17 +3,17 @@ USING_PART_OF_NAMESPACE_EIGEN
|
||||
using namespace std;
|
||||
|
||||
template<typename Derived>
|
||||
Eigen::Column<Derived>
|
||||
Eigen::Block<Derived,Derived::RowsAtCompileTime,1>
|
||||
firstColumn(MatrixBase<Derived>& m)
|
||||
{
|
||||
return Eigen::Column<Derived>(m.asArg(), 0);
|
||||
return typename Eigen::Block<Derived,Derived::RowsAtCompileTime,1>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
const Eigen::Column<Derived>
|
||||
const Eigen::Block<Derived,Derived::RowsAtCompileTime,1>
|
||||
firstColumn(const MatrixBase<Derived>& m)
|
||||
{
|
||||
return Eigen::Column<Derived>(m.asArg(), 0);
|
||||
return typename Eigen::Block<Derived,Derived::RowsAtCompileTime,1>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
||||
@@ -3,17 +3,17 @@ USING_PART_OF_NAMESPACE_EIGEN
|
||||
using namespace std;
|
||||
|
||||
template<typename Derived>
|
||||
Eigen::Row<Derived>
|
||||
Eigen::Block<Derived,1,Derived::ColsAtCompileTime>
|
||||
firstRow(MatrixBase<Derived>& m)
|
||||
{
|
||||
return Eigen::Row<Derived>(m.asArg(), 0);
|
||||
return Eigen::Block<Derived,1,Derived::ColsAtCompileTime>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
const Eigen::Row<Derived>
|
||||
const Eigen::Block<Derived,1,Derived::ColsAtCompileTime>
|
||||
firstRow(const MatrixBase<Derived>& m)
|
||||
{
|
||||
return Eigen::Row<Derived>(m.asArg(), 0);
|
||||
return Eigen::Block<Derived,1,Derived::ColsAtCompileTime>(m.asArg(), 0);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
typedef Matrix3i MyMatrixType;
|
||||
MyMatrixType m = MyMatrixType::random(3, 3);
|
||||
cout << "Here's the matrix m:" << endl << m << endl;
|
||||
typedef Eigen::Eval<Eigen::Row<MyMatrixType> >::MatrixType MyRowType;
|
||||
typedef Eigen::Eval<Eigen::Block<MyMatrixType,1,MyMatrixType::ColsAtCompileTime> >::MatrixType MyRowType;
|
||||
// now MyRowType is just the same typedef as RowVector3i
|
||||
MyRowType r = m.row(0);
|
||||
cout << "Here's r:" << endl << r << endl;
|
||||
|
||||
Reference in New Issue
Block a user