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

%   CBVK Toolbox
%   JHMG, PMSB 2016


clear

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

arq1='mtaylor_sp_nr_AfiltA_P2';  % Ouput F1ile
arq2='mtaylor_esp_nr_AfiltA_P2'; % Ouput F1ile
% --------------------------------------------------------------------

% 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
[F1i,F1c,F11] = multaylorsp(f,x,P,I);
[G1i,G1c,G11] = multaylorsp(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
[F1cn,F11n,G1cn,G11n]=evtaylorsp(m,F1c,F1i,F11,G1c,G1i,G11,names,values,wtylr);
dt(r)=toc;
fprintf('%g\n ', dt(r))
end

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

