Created
April 20, 2020 16:38
-
-
Save theptrk/d886cbff40da76a0d8514a18077b23ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function X_rec = recoverData(Z, U, K) | |
% initialize recovered values | |
X_rec = zeros(size(Z, 1), size(U, 1)); | |
for i = 1:size(X_rec,1) | |
% projected_x is (1, K) | |
projected_x = Z(i, :); | |
% initialize x | |
x = zeros(1, size(U,1)); | |
% iterate through dimensions to recover value | |
for j = 1:size(x, 2) | |
% Ufor_dimension = (1, K) | |
Ufor_dimension = U(j, 1:K); | |
% set the value for this dimension | |
% (1, K) * (1, K)' | |
% (1, K) * (K, 1) = (1, 1) | |
recovered_for_dimension = projected_x * Ufor_dimension'; | |
x(j) = recovered_for_dimension; | |
end | |
X_rec(i,:) = x; | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment