% Uses solvePD to solve Mx=y for x

% function [x] = solve(M,y)
% M - matrix [n,d]
% y - vector [n,1]
% 
% Written by Jason Rennie, February 2004
% Last modified: Tue May 24 17:53:47 2005

function [x] = solve(M,y)
[n,d] = size(M);
[l] = length(y);
if (n ~= l)
  error('length of M [%d,%d] must match length of y [%d,1]',n,d,l);
end

x = solvePD(M'*M,M'*y);
