%Ekta Gujral,Tianxiong Yang,Ravdeep Pasricha and Evangelos E. Papalexakis
%Department of Computer Science and Engineering, University of California Riverside 
%"OCTen:Online Compression-based Tensor Decomposition", Submitted in PKDD 2018
function C=getTemporalMatrix(slice,A,B,C,pmA)
       R=size(C,2);
       %% permute based on A and B matrix and normalize each component of C
       C=normalizeMatrix(C*pmA,R);
       %% get back C matrix from new slice using A and B from method;Then get scaler from Cobtained
       Cobtained=zeros(size(C));
       for i=1:size(C,1)
          x= pinv(A)*slice(:,:,i)*pinv(B');
          Cobtained(i,:)=sum(x);
       end
       [~,val]=normalizeMatrix(Cobtained,R);
       %% absorb the scaler from above step to C and return it back
       C=C*diag(val);
end
