I have been using Eigen matrices to test a new code I wrote, and I just ran into this issue for the first time. I just started reading about "Fixed vs. Dynamic size" in Eigen matrices and I thought I was using "dynamic" matrices for large sizes, but when I try using larger number of grids I get the error:
staticconstint nx = 128;
staticconstint ny = 128;
usingnamespace std;
usingnamespace Eigen;
int main(){
Eigen::Matrix<double, (ny+1), nx> X; //ERROR HERE
X.setZero();
//other similar initializations
}
This code is running fine for smaller sizes of nx; ny; but not the case I am showing. Ideally, I would like to run something as large as nx=1024; and ny=1024;
Is this not possible using Eigen matrices? Thanks.
Actually, Eigen was easier to install than I realised - just unzip the templated headers into a directory, then adjust the include path. No Windows settings to fiddle with, or code to build. Works a treat from the command line.
Can't help feeling all this matrix stuff is easier in Fortran, though:
program main
use iso_fortran_env
implicit none
integer, parameter :: nx = 128, ny = 128
real(kind=real64), allocatable :: X(:,:)
allocate( X(ny+1,nx) )
X = 0
end program