Skip to content

Cleaning up linear access functions #2245

@bbbales2

Description

@bbbales2

Now that we're exposing expressions in the language, we need to clean up functions that depend on linear access in Eigen types.

Specifically, with a simple Eigen type like Eigen::MatrixXd, it is possible to instead of looping over ij like so:

Eigen::MatrixXd A;
for(size_t i = 0; i < A.size(); ++i) {
  for(size_t i = 0; j < A.size(); ++j) {
    ... A(i, j) ...;
  }
}

to just do:

Eigen::MatrixXd A;
for(size_t i = 0; i < A.size(); ++i) {
  ... A(i) ...;
}

This was convenient because the same thing worked with matrices, vectors, row vectors.

Now that we have expressions and maps and such we need to be more careful.

There have been two pulls addressing issues like this so far, #2205 and #2223

I made this issue so we would vaguely have a place to discuss:

  1. How we should be testing for this so it doesn't bite us
  2. Track known issues that exist (until there's some sort of general solution in place)
  3. How do we handle row major vs. column major -- now our double loops will be explicitly bad in some cases

And and I do not want to stall #2223 unnecessarily to try to fix everything in one go.

Current Version:

v3.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions