Map<>.noalias()=A*B gives wrong result
Submitted by Patrick Peltzer
Assigned to Nobody
Link to original bugzilla bug (#1741)
Version: 3.3 (current stable)
Description
Created attachment 949
Minimal code example to reproduce the issue
In an alias free multiplication with a Map<> type to assign to, using noalias() can lead to wrong results. Example:
C_Map = A * B; // Correct
C.setZero();
C_Map.noalias() = A*B; // Incorrect
See the attached code example on how to reproduce. I've noticed this for larger matrices (C_Map >= 8x8), where only half of the rows are modified and the other half stays untouched. Typical output for the minimal code example:
C_Map
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
C_Map.noalias()
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
I've reproduced the issue on version 3.3.7 and the current 3.3 and the default branch.
Attachment 949, "Minimal code example to reproduce the issue":
map_noalias.cpp