% Measures the minimum execution time of Volterra kernel calculation using
% SVD 
%
% Discrete-time Volterra kernels of the cascade of ideal
% discrete/continuous (D/C) converter, integrator, loudspeaker A and ideal
% C/D converter.

% CBVK Toolbox
% JHMG, PMSB 2016


clear

m=4;        % Dimension
P=2;        % Expansion order
N=100;      % Memory length
Fs=5000;    % Sampling frequency
rep=50;     % Number of repetitions for greater precision of execution
            % time measurement

arq1='CB_Aitgr_P2';            % CB file            
arq2='mVK_svd_Aitgr_P2_N100';  % Output file

msk{1}=1;
load mask_P2_N100a;            % Mask file (see cbvkutil/mask_P*m)
msk{2}=m2;

%------------------------------------------


% Carleman Bilinearization 
load(arq1);

warning('off','cbvk:vkrnsvd');

% Kernels

dt=zeros(1,rep);
for i=1:rep
    tic
    % Kernels of filters + loudspeaker
    kernels = vkrnsvd(F,G,b,c,N,1/Fs,m,P,msk);

    
    dt(i)=toc;
    fprintf('%g\n ', dt(i));
end
min(dt)
%save(arq2,'dt');
warning('on','cbvk:vkrnsvd');


