mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
some documentation fixes (Cwise* and Cholesky)
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
USING_PART_OF_NAMESPACE_EIGEN
|
||||
using namespace std;
|
||||
|
||||
// define a custom template binary functor
|
||||
// define a custom template unary functor
|
||||
template<typename Scalar>
|
||||
struct CwiseClampOp EIGEN_EMPTY_STRUCT {
|
||||
struct CwiseClampOp {
|
||||
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
|
||||
const Scalar operator()(const Scalar& x) const { return x<m_inf ? m_inf : (x>m_sup ? m_sup : x); }
|
||||
Scalar m_inf, m_sup;
|
||||
@@ -14,6 +14,6 @@ struct CwiseClampOp EIGEN_EMPTY_STRUCT {
|
||||
int main(int, char**)
|
||||
{
|
||||
Matrix4d m1 = Matrix4d::random();
|
||||
cout << m1.cwise(CwiseClampOp<double>(-0.5,0.5)) << endl;
|
||||
cout << m1 << endl << "becomes: " << endl << m1.cwise(CwiseClampOp<double>(-0.5,0.5)) << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user