diff --git a/Optima/EchelonizerW.cpp b/Optima/EchelonizerW.cpp index 04bc8430..019d1c38 100644 --- a/Optima/EchelonizerW.cpp +++ b/Optima/EchelonizerW.cpp @@ -21,6 +21,7 @@ #include <Optima/Exception.hpp> #include <Optima/EchelonizerExtended.hpp> #include <Optima/Utils.hpp> +#include <Optima/Macros.hpp> namespace Optima { @@ -90,19 +91,7 @@ struct EchelonizerW::Impl const auto nb = echelonizer.numBasicVariables(); const auto nn = echelonizer.numNonBasicVariables(); - //============================================================================================================= - // WARNING: - //============================================================================================================= - // For some reason, the commented line below does not play correctly with - // eigen commit 7b35638ddb99a0298c5d3450de506a8e8e0203d3 in Windows with Release mode. - // This problem does not exist in Linux and macOS, and also in Windows with Debug mode. - // The pytest tests fail with error message like this: - // Windows fatal exception: access violation - // Current thread 0x00002544 (most recent call first): - // File "C:\Users\allan\codes\optima\tests\testing\utils\matrices.py", line 156 in createMatrixViewRWQ - // The solution was to avoid creating the topRows reference from the returned reference in echelonizer.R(). - //============================================================================================================= - // const auto Rb = echelonizer.R().topRows(nb); // WARNING: This + // const auto Rb = echelonizer.R().topRows(nb); // WARNING: This creates dangling references. const auto R = echelonizer.R(); const auto Rb = R.topRows(nb); @@ -155,7 +144,8 @@ struct EchelonizerW::Impl const auto nb = echelonizer.numBasicVariables(); const auto nn = echelonizer.numNonBasicVariables(); - const auto Rb = echelonizer.R().topRows(nb); + const auto R = echelonizer.R(); + const auto Rb = R.topRows(nb); const auto Sbn = S.topLeftCorner(nb, nn); const auto Sbp = S.topRightCorner(nb, np); const auto jbn = echelonizer.Q();