mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Examples for DenseBase::middle{Rows,Cols}()
This commit is contained in:
parent
5c58582a08
commit
c64c0f382f
15
doc/examples/DenseBase_middleCols_int.cpp
Normal file
15
doc/examples/DenseBase_middleCols_int.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <Eigen/Core>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int const N = 5;
|
||||||
|
MatrixXi A(N,N);
|
||||||
|
A.setRandom();
|
||||||
|
cout << "A =\n" << A << '\n' << endl;
|
||||||
|
cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
15
doc/examples/DenseBase_middleRows_int.cpp
Normal file
15
doc/examples/DenseBase_middleRows_int.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <Eigen/Core>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int const N = 5;
|
||||||
|
MatrixXi A(N,N);
|
||||||
|
A.setRandom();
|
||||||
|
cout << "A =\n" << A << '\n' << endl;
|
||||||
|
cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
15
doc/examples/DenseBase_template_int_middleCols.cpp
Normal file
15
doc/examples/DenseBase_template_int_middleCols.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <Eigen/Core>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int const N = 5;
|
||||||
|
MatrixXi A(N,N);
|
||||||
|
A.setRandom();
|
||||||
|
cout << "A =\n" << A << '\n' << endl;
|
||||||
|
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
15
doc/examples/DenseBase_template_int_middleRows.cpp
Normal file
15
doc/examples/DenseBase_template_int_middleRows.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <Eigen/Core>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int const N = 5;
|
||||||
|
MatrixXi A(N,N);
|
||||||
|
A.setRandom();
|
||||||
|
cout << "A =\n" << A << '\n' << endl;
|
||||||
|
cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user