function [V, Lambda_mat] = PcaViaKlt(data)
%% Implement PCA by applying KLT to sample covariance matrix
%
%  Input: 
%    data is a p*n matrix, where p is the number of features, n is the
%    number of data points used.
%
%  Output: 
%    V is a matrix whose column vectors are eigenvectors of a sample
%    covariance matrix calculated from the input. Lambda_mat is a diagonal
%    matrix whose elements are eigenvalues ordered with respect to the
%    eigenvectors in V.
%
%  ECE 792-41 Statistical Foundations for Signal Processing and Machine Learning
%  Prof. Chau-Wai Wong, ECE, NC State University, Sept. 2020

num_imgs = size(data, 2);
data_centered = ...;  % remove the sample mean
R = ...;  % calculate the sample covariance matrix
...  % eigendecomposition using eig()
