mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add some more examples for the API documentation.
The only missing examples now are for homogeneous() and hnormalized(); I don't know what they're used for ...
This commit is contained in:
18
doc/examples/MatrixBase_cwise_const.cpp
Normal file
18
doc/examples/MatrixBase_cwise_const.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#define EIGEN2_SUPPORT
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
Matrix3i m = Matrix3i::Random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
Matrix3i n = Matrix3i::Random();
|
||||
cout << "And here is the matrix n:" << endl << n << endl;
|
||||
cout << "The coefficient-wise product of m and n is:" << endl;
|
||||
cout << m.cwise() * n << endl;
|
||||
cout << "Taking the cube of the coefficients of m yields:" << endl;
|
||||
cout << m.cwise().pow(3) << endl;
|
||||
}
|
||||
Reference in New Issue
Block a user