[context] Reconsider access to local matrix entries
Currently, access to matrix entries happens like this:
for (auto [trialFunctions,i] : cell.jacobian(test_space,trial_space))
for (auto [dof,j] : trialFunctions)
dof += // value to add
which is pretty nice. However, in private conversation, @smuething mentioned that he also considered
for (auto [trialFunctions,i,j] : cell.jacobian(test_space,trial_space))
dof += // value
He said he had to discard the idea because it wouldn't run effectively. I wonder, though, if the alternative approach deserves a second chance, because I see some advantages:
- It is more elegant
- It is easier to explain
- It makes handling symmetric matrices more elegant and efficient, because
cell.jacobian
could simply skip the duplicatei,j
-pairs. (Okay, admittedly maybe that is possible with the current approach, too)?
Do we know why the alternative approach is so slow? Is that maybe only because compilers miss some optimization opportunities?