The following setup is compiling very slowly relative to just using a standard C matrix (i.e. double M[35][35]). Some parts of the code have been left out for simplicity. Also, sorry for poor formatting on the comma-initialization of M, didn't copy-paste as planned.
What's the solution for speeding this up? I tried making M a fixed, rather than dynamic, matrix, but this still runs at a pitifully slow pace.
Here is the code:
#include <Eigen.h>
using namespace Eigen;
void get_matrices(){
Matrix<float,35,35> M;
M << 173 ,169 ,164 ,160 ,155 ,150 ,146 ,141 ,137 ,132 ,127 ,123 ,118 ,114 ,109 ,104 ,99.9 ,95.3 ,89.7 ,84.1 ,78.5 ,72.9 ,67.3 ,61.7 ,56.1 ,50.5 ,44.8 ,39.2 ,33.6 ,28 ,22.4 ,16.8 ,11.2 ,5.61 ,0 ,
173 ,169 ,164 ,160 ,155 ,150 ,146 ,141 ,137 ,132 ,127 ,123 ,118 ,114 ,109 ,104 ,99.9 ,95.3 ,89.7 ,84.1 ,78.5 ,72.9 ,67.3 ,61.7 ,56.1 ,50.5 ,44.8 ,39.2 ,33.6 ,28 ,22.4 ,16.8 ,11.2 ,5.61 ,0 ,
173 ,169 ,164 ,160 ,155 ,150 ,146 ,141 ,137 ,132 ,127 ,123 ,118 ,114 ,109 ,104 ,99.9 ,95.3 ,89.7 ,84.1 ,78.5 ,72.9 ,67.3 ,61.7 ,56.1 ,50.5 ,44.8 ,39.2 ,33.6 ,28 ,22.4 ,16.8 ,11.2 ,5.61 ,0 ,
173 ,169 ,164 ,160 ,155 ,150 ,146 ,141 ,137 ,132 ,127 ,123 ,118 ,114 ,109 ,104 ,99.9 ,95.3 ,89.7 ,84.1 ,78.5 ,72.9 ,67.3 ,61.7 ,56.1 ,50.5 ,44.8 ,39.2 ,33.6 ,28 ,22.4 ,16.8 ,11.2 ,5.61 ,0 ,
173 ,169 ,164 ,160 ,155 ,150 ,146 ,141 ,137 ,132 ,127 ,123 ,118 ,114 ,109 ,104 ,99.9 ,95.3 ,89.7 ,84.1 ,78.5 ,72.9 ,67.3 ,61.7 ,56.1 ,50.5 ,44.8 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