% Measures the  minimum execution time of literal redundant Taylor 
% expansion of filters + loudspeaker A and its numerical evaluation

%   CBVK Toolbox
%   JHMG, PMSB 2016


clear

P=4;       % Expansion order
rep1=5;    % Number of repetitions for greater precision of execution
           % time measurement
rep2=10;

arq1='mtaylor_lit_AfiltA_P4';  % Output file
arq2='mtaylor_eval_AfiltA_P4'; % Output file
% --------------------------------------------------------------------

% Literal model
[f,g,h,x,names,values]=dloudAfiltA_lit;      % Regenerate model to be sure

dt=zeros(1,rep1);
warning('off','cbvk:mtredlit');

for r=1:rep1
tic
F1 = mtredlit(f,x,P);
G1 = mtredlit(g,x,P-1);
dt(r)=toc;
fprintf('%g\n ', dt(r));
end

min(dt)
%save(arq1,'dt');
warning('on','cbvk:mtredlit');


dt=zeros(1,rep2);

% Numerical evaluation
m=length(x);
for r=1:rep2
tic
[F1n,G1n]=evtred(m,P,F1,G1,names,values);
dt(r)=toc;
fprintf('%g\n ', dt(r))
end

min(dt)
%save(arq2,'dt');
warning('on','cbvk:mtredlit');


