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

%   CBVK Toolbox
%   JHMG, PMSB 2016


clear

P=2;        % Expansion order
rep1=20;    % Number of repetitions for greater precision of execution
            % time measurement
rep2=100;

arq1='mtaylor_lit_nr_AfiltA_P2';  % Ouput file
arq2='mtaylor_eval_nr_AfiltA_P2';  % Ouput file
% --------------------------------------------------------------------

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

% Pre-calculated weights and indices (cbvkutil/mkwtaylor.m)
load wtaylor_m11_P5

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

min(dt);
%save(arq1,'dt');

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

min(dt);
%save(arq2,'dt');

