E.push_back(er); // when the program fails, this is where it happens
So that is where you need to look to try and establish why. Either E or er are not valid; but there is no way anyone here can guess which. Also, expressions like er=BA * F * MA.inverse(); do not make it easy. You need to look at BA, F and the result of MA.inverse at the time of the crash.
You mean you can not have the same name in the same scope.
It is routine to carry the same name such as i, j, count etc but they get restricted to
within a local scope as a local variable in a function or unit.
Not like there should be many but global variables obviously can't have the same name.
It is not a limitation. When C was designed there was not thought to be a need for such a feature. But you could still have variables and functions that were limited to specific source modules. And local variables inside functions were hidden from others automatically.