Commit 649d78c1 authored by Riccardo La Placa's avatar Riccardo La Placa
Browse files

RESHAPE

parent 7c25fa50
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -113,13 +113,13 @@ end
%CONTROLLARE SE CON LA FUNZIONE RESHAPE PUOI EVITARE IL CICLO FOR

% Time series for each segment
x = zeros(M,N);
x = zeros(N,M);
toc

tic
aux1 = M*N;
aux2 = C(1:aux1); clear aux1
x = reshape(aux2,[M,N]); clear aux2
x = reshape(aux2,[N,M]); clear aux2
toc
clear C
% 
@@ -260,12 +260,11 @@ tic
% Cercheremo un modo per combinare in tutti i possibili modi vettori di 
% vari ni1,ni2,...,nis_s
%%%[kung,fu,fight] = ndgrid(nis{1},nino{2},nino{3});
% tm=gpuArray(tm);
% nibank = gpuArray(combinations(nis{:}).Variables);
% Lambda = zeros(length(nibank),length(f_gr),M,'gpuArray');
nibank = combinations(nis{:}).Variables;
Lambda = zeros(length(nibank),length(f_gr),M);
% Lambda = zeros(length(nibank),length(f_gr),M,'gpuArray');
tm=gpuArray(tm);
nibank = gpuArray(combinations(nis{:}).Variables);
Lambda = zeros(length(nibank),length(f_gr),M,'gpuArray');
% nibank = combinations(nis{:}).Variables;
% Lambda = zeros(length(nibank),length(f_gr),M);
toc 
%Fourier transform on original time-series --------------------------------
%per mantenere l'informazione di fase, non faccio il valore assoluto al quadrato della fft
@@ -286,10 +285,10 @@ for m=1:M
    % Y=Y(cond); 
    % X=ifft(Y); %inverse-fourier transf.

    % ttemp = gpuArray(tm(m,:)-tmid(m));
    % xtemp = gpuArray(x(m,:));
    ttemp = tm(m,:)-tmid(m);
    xtemp = x(m,:);
    ttemp = gpuArray(tm(m,:));
    xtemp = gpuArray(x(:,m).');
    % ttemp = tm(m,:);
    % xtemp = x(:,m).';

    % toc
    
@@ -318,7 +317,7 @@ for m=1:M
            % end
            % tic

            tau = sum((nibank(i,1:s_s)./(nizero*factorial(1:s_s))).*((ttemp(1:N)).^((1:s_s).').'),2);
            tau = tmid(m) + sum((nibank(i,1:s_s)./(nizero*factorial(1:s_s))).*((ttemp(1:N)).^((1:s_s).').'),2);
            % toc

            % tic
@@ -362,11 +361,12 @@ end

tic
% nisearcher = KDTreeSearcher(nibank,'BucketSize',100);
nisearcher = KDTreeSearcher(gather(nibank),'BucketSize',100);
%% The line above will have to be substituted with something along the lines
%% of the ones below to account for the metric g_jj in the phase derivatives
gdistance = @(a,b)sqrt(((a-b).^2)*(g_jj(1:s_s)));
% gdistance = @(a,b)sqrt(((a-b).^2)*(g_jj(1:s_s)));
% nisearcher = ExhaustiveSearcher(gather(nibank),'Distance',gdistance);
nisearcher = ExhaustiveSearcher(nibank,'Distance',gdistance);
% nisearcher = ExhaustiveSearcher(nibank,'Distance',gdistance);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parbank = combinations(porb_gr,a_gr,tasc_gr).Variables;