%Convert row vectors of LAB values to XYZ tristimulus values 
% Eric Dubois 2017-05-12
%If necessary, the input should be reshaped into an N by 3 array before 
%calling this routine.
%Uses the function f_lab2xyz
%Reference white is assumed to be D65
function XYZ = LAB2XYZ(LAB)
W = [.9505 1 1.0891]; %D65
XYZ(:,1) = W(1)*f_lab2xyz(LAB(:,2)/500 + (LAB(:,1)+16)/116);
XYZ(:,2) = W(2)*f_lab2xyz((LAB(:,1)+16)/116);
XYZ(:,3) = W(3)*f_lab2xyz(-LAB(:,3)/200 + (LAB(:,1)+16)/116);