function P = dlt34(xk, yk)
	% solve the set of similarity relations
	% xk ~ Pyk
	% 
	% for xk = [x1k x2k x3k]' is a 3x1 vector
	%     yk = [y1k y2k y3k y4k]' is a 4x1 vector
	% 
	% to find the 3x4 matrix P
	
	% set up the problem as solving
	% xk' * H * P * yk = 0
	%
	% leveraging xk'*H*xk = 0
	% however, for xk on R^3, the dimension of H_m is 3
	% i.e. there are three basis-matrices H_m that can satisfy xk'*H*xk = 0
	% these are:
	% H1 = [0 0 0; 0 0 -1; 0 1 0]
	% H2 = [0 0 1; 0 0 0; -1 0 0]
	% H3 = [0 -1 0; 1 0 0; 0 0 0]
	%
	% so we get three sets of equations
	% bk' * p = [0 0 0]'
	
	% number of similarity relations we have
	N			= size(xk, 2);
	assert(size(yk,2) == N);
	assert(size(xk,1) == 3);
	assert(size(yk,1) == 4);
	
	% set up matrix B
	% with rows b_k
	% that satisfy b_k * p = 0
	B			= zeros(N*3, 12);
	for k = 1 : N
		x					= xk(:, k);
		y					= yk(:, k);
		B(3*(k-1)+1, :)= [ 0; +x(3)*y(1); -x(2)*y(1); 0; +x(3)*y(2); -x(2)*y(2); 0; +x(3)*y(3); -x(2)*y(3); 0; +x(3)*y(4); -x(2)*y(4)];
		B(3*(k-1)+2, :)= [ -x(3)*y(1); 0; +x(1)*y(1); -x(3)*y(2); 0; +x(1)*y(2); -x(3)*y(3); 0; +x(1)*y(3); -x(3)*y(4); 0; +x(1)*y(4)];
		B(3*(k-1)+3, :)= [ +x(2)*y(1); -x(1)*y(1); 0; +x(2)*y(2); -x(1)*y(2); 0; +x(2)*y(3); -x(1)*y(3); 0; +x(2)*y(4); -x(1)*y(4); 0];
	end
	
	% now our solution p is the solution of
	% B*p = 0
	% i.e. p is in the null space of B
	% can be solved with SVD
	% 
	% we add the additional constraint that |p| = 1
	% to find the minimal P
	%
	% p is the unit singular vector of A corresponding to the last column of
	% V, when the elements in S are ranked in decreasing size
	% which, helpfully, matlab does by default
	[Q,D]		= eig(B.' * B);
	D			= diag(D);
	[~,idx]	= min(abs(D));
	p			= Q(:, idx);
	P			= reshape(p, [3 4]);
end
	
		
	 