int execute(int argc, char** argv) { if(argc < 0) { fprintf(stderr, "Erreur : pas assez d'argument dans la fonction d'execution\n"); return 0; } if(strcmp(argv[0], "cd") == 0) { return mcd(argc, argv); } else if(strcmp(argv[0], "mkdir") == 0) { return mmkdir(argc, argv); } else if(strcmp(argv[0], "cat") == 0) { return mcat(argc, argv); } else if(strcmp(argv[0], "ls") == 0) { return mls(argc, argv); } else if(strcmp(argv[0], "vim") == 0) { return mvim(argc, argv); } else { printf("Commande non reconnu\n"); return 0; } }
// Optimized for low memory usage void arfit(const Matrix &x, int order, Matrix &a, Matrix &q, Matrix &v) { if(order + 2 >= x.rows()) std::cerr << "ERROR: Not enough data. Try a smaller order." << std::endl << die(); std::vector< Matrix > acf(order + 1); for(int p = 0; p <= order; ++p) acf[p] = x.block(p, 0, x.rows() - p, x.cols()).transpose() * x.block(0, 0, x.rows() - p, x.cols()); std::vector< std::vector< Matrix > > vACF_0(order), vACF_1(order); for(int row = 0; row < order; ++row) { vACF_0[row].resize(order); vACF_1[row].resize(order); for(int col = 0; col < order; ++col) if(row <= col) { vACF_0[row][col] = acf[col-row]; vACF_1[row][col] = acf[col-row+1]; } else { vACF_0[row][col] = acf[row-col].transpose(); vACF_1[row][col] = acf[row-col+1].transpose(); } } v = mcat(vACF_0); Matrix ACF_1 = mcat(vACF_1); Matrix A = ACF_1 * v.inverse(); Matrix Q = (v - A * ACF_1.transpose()) / x.rows(); a = A.block(0, 0, x.cols(), x.cols() * order); q = Q.block(0, 0, x.cols(), x.cols()); v /= x.rows(); }