Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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