|Summary:||Automatically adjust the prototype of functors for CwiseNullaryOp|
|Product:||Eigen||Reporter:||Gael Guennebaud <gael.guennebaud>|
|Component:||Core - general||Assignee:||Nobody <eigen.nobody>|
|Severity:||Feature Request||CC:||chtz, gael.guennebaud, jacob.benoit.1, taylor|
|Version:||3.3 (current stable)|
|Bug Depends on:|
|Bug Blocks:||457, 720|
Description Gael Guennebaud 2016-08-31 12:46:29 UTC
Created attachment 726 [details] patch Current functors passed to NullaryExpr must implement both operator()(i) and operator()(i,j) plus specialize internal::functor_has_linear_access<> for non trivial functors. This is rather painful and cumbersome to document (hence, this is currently not really documented!). The proposed patch automatically detect whether the functor expose one or multiple of the following operators: operator()() operator()(i) operator()(i,j) and then a little helper augments the input functors with the missing operators. With this change, no need to provide operator()(i,j) if nor i nor j are required (e.g., for random, and constant). I'd like to push this change in 3.3 as it considerably help in documenting and using NullaryExpr.
Comment 1 Christoph Hertzberg 2016-08-31 13:14:50 UTC
I'm all for this!
Comment 2 Gael Guennebaud 2018-10-02 07:26:12 UTC
This patch has been merged a while ago, it's even part of 3.3
Comment 3 Nobody 2019-12-04 16:11:05 UTC
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1286.