New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1009 - One-index coeff accessors should static_assert on LinearAccessBit
Summary: One-index coeff accessors should static_assert on LinearAccessBit
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - expression templates (show other bugs)
Version: unspecified
Hardware: All All
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 3.3
  Show dependency treegraph
 
Reported: 2015-05-01 15:10 UTC by Benoit Jacob
Modified: 2015-11-27 09:08 UTC (History)
3 users (show)



Attachments
minimal testcase (135 bytes, text/x-c++src)
2015-05-01 15:10 UTC, Benoit Jacob
no flags Details
Add static assertions on linear access. Breaks lots of tests at the moment. (2.69 KB, patch)
2015-05-01 15:11 UTC, Benoit Jacob
no flags Details | Diff

Description Benoit Jacob 2015-05-01 15:10:30 UTC
Created attachment 570 [details]
minimal testcase

coeff(Index) and coeffRef(Index), and corresponding operator()(Index) and operator[], should probably require LinearAccessBit, right?

The attached testcase is how I came across this: I was mistakenly using operator()(Index) on a Block<MatrixXf>, so I was addressing coefficients outside of the block.

Also attaching a patch that does this static-assertion; but I can't push it at the moment, because it seems to be breaking lots of tests, and I don't currently have time to look into them...
Comment 1 Benoit Jacob 2015-05-01 15:11:51 UTC
Created attachment 571 [details]
Add static assertions on linear access. Breaks lots of tests at the moment.
Comment 2 Gael Guennebaud 2015-11-12 16:30:30 UTC
This flags is now handled by the evaluator, so the test should be internal::evaluator<Derived>::Flags&LinearAccessBit, but that does not seem to be sufficient. If I relax it to:

bool(internal::evaluator<Derived>::Flags & LinearAccessBit) || Derived::IsVectorAtCompileTime

then everything compile again meaning that some vector expressions does not have the LinearAccessBit flag...
Comment 3 Gael Guennebaud 2015-11-27 09:08:13 UTC
https://bitbucket.org/eigen/eigen/commits/40765154d719/
Summary:     Bug 1009, part 1/2: make sure vector expressions expose LinearAccessBit flag.

https://bitbucket.org/eigen/eigen/commits/1bcd78a74740/
Summary:     Bug 1009, part 2/2: add static assertion on LinearAccessBit in coeff(index)-like methods.

Note You need to log in before you can comment on or make changes to this bug.