%Longin Jan Latecki, latecki@temple.edu, Oct 2012

function [z_UU,accuracy]=ssl(PLL, PLU, PUL, PUU, True_LL)

% NOTE: This is optimized based on assumptions from the sample code sent out.  If that changes, we'll need to make some changes.
% That is, if the True_LL matrix isn't an array from 1 to 70, we'll need to uncomment a bunch of the material below.
%if all(True_LL == [1:length(True_LL)]')
	% Jesse recommended removing Y_L, as it's the identity and, subsequently, does nothing.
	[~,z_UU] = max((inv(eye(size(PUU)) - PUU) * PUL)'); % Optimize everything.  85% average on this implementation.
%else
	%Y_L = zeros(size(PLL)); % We assume one unique example from each class, in order.
	%for i=1:length(True_LL)
	%	Y_L(i,True_LL(i)) = 1.0; % Under nearly every circumstance, we can assume this to be the identity matrix, but if there are duplicate measures in True_LL, then we cannot.
	%end
	%[~,z_UU] = max((inv(eye(size(PUU)) - PUU) * PUL * Y_L)'); % 85%
%end

z_UU = z_UU'; % Our max requires that this be done.
end