solve_algo=7 and stack_solve_algo=2 are now allowed under Octave

The gmres() function has been implemented (actually since Octave 3.4.1!).
time-shift
Sébastien Villemot 2018-08-02 15:20:39 +02:00
parent fda021855c
commit d03cc56587
6 changed files with 7 additions and 24 deletions

View File

@ -3352,7 +3352,7 @@ Newton algorithm with a sparse LU solver at each iteration (requires
@item 7
Newton algorithm with a Generalized Minimal Residual (GMRES) solver at
each iteration (requires @code{bytecode} and/or @code{block} option,
@pxref{Model declaration}; not available under Octave)
@pxref{Model declaration})
@item 8
Newton algorithm with a Stabilized Bi-Conjugate Gradient (BICGSTAB)
@ -3984,7 +3984,7 @@ declaration}).
@item 2
Use a Newton algorithm with a Generalized Minimal Residual (GMRES)
solver at each iteration (requires @code{bytecode} and/or @code{block}
option, @pxref{Model declaration}; not available under Octave)
option, @pxref{Model declaration})
@item 3
Use a Newton algorithm with a Stabilized Bi-Conjugate Gradient

View File

@ -37,10 +37,6 @@ if (DynareOptions.block || DynareOptions.bytecode) && DynareOptions.stack_solve_
error('perfect_foresight_solver:ArgCheck','PERFECT_FORESIGHT_SOLVER: you can''t use stack_solve_algo = 6 with block or bytecode option')
end
if isoctave && DynareOptions.stack_solve_algo == 2
error('perfect_foresight_solver:ArgCheck','PERFECT_FORESIGHT_SOLVER: you can''t use stack_solve_algo = 2 under Octave')
end
if isempty(DynareResults.endo_simul) || any(size(DynareResults.endo_simul) ~= [ DynareModel.endo_nbr, DynareModel.maximum_lag+DynareOptions.periods+DynareModel.maximum_lead ])

View File

@ -280,9 +280,6 @@ for it_=start:incr:finish
end
elseif (stack_solve_algo==2 && is_dynamic) || (options.solve_algo==7 && ~is_dynamic)
flag1=1;
if isoctave
error('SOLVE_ONE_BOUNDARY: you can''t use solve_algo=7 since GMRES is not implemented in Octave')
end
if verbose == 1 && ~is_dynamic
disp('steady: GMRES ')
end

View File

@ -48,7 +48,7 @@ if ~options_.bytecode && options_.block && options_.solve_algo == 5
error('STEADY: you can''t use solve_algo = 5 without bytecode option')
end
if isoctave && ismember(options_.solve_algo,[7,11])
if isoctave && options_.solve_algo == 11
error(['SIMUL: you can''t use solve_algo = %u under Octave'],options_.solve_algo)
end

View File

@ -4833,14 +4833,6 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
void
dynSparseMatrix::Solve_Matlab_GMRES(mxArray *A_m, mxArray *b_m, int Size, double slowc, int block, bool is_two_boundaries, int it_, mxArray *x0_m)
{
#ifdef OCTAVE_MEX_FILE
ostringstream tmp;
if (steady_state)
tmp << " GMRES method is not implemented in Octave. You cannot use solve_algo=7, change solve_algo.\n";
else
tmp << " GMRES method is not implemented in Octave. You cannot use stack_solve_algo=2, change stack_solve_algo.\n";
throw FatalExceptionHandling(tmp.str());
#endif
size_t n = mxGetM(A_m);
const char *field_names[] = {"droptol", "type"};
mwSize dims[1] = { 1 };

View File

@ -43,19 +43,17 @@ cd([top_test_dir filesep 'block_bytecode']);
tic;
for blockFlag = 0:1
for bytecodeFlag = 0:1
## Recall that solve_algo=7 and stack_solve_algo=2 are not supported
## under Octave
default_solve_algo = 2;
default_stack_solve_algo = 0;
if !blockFlag && !bytecodeFlag
solve_algos = 0:4;
stack_solve_algos = [0 6];
elseif blockFlag && !bytecodeFlag
solve_algos = [0:4 6 8];
stack_solve_algos = [0 1 3 4];
solve_algos = [0:4 6:8];
stack_solve_algos = 0:4;
else
solve_algos = [0:6 8];
stack_solve_algos = [0 1 3:5];
solve_algos = 0:8;
stack_solve_algos = 0:5;
endif
sleep(1) # Workaround for strange race condition related to the _static.m file