SingularValueDecomposition<Real>::SingularValueDecomposition (
    const GMatrix<Real>& M, GMatrix<Real>& L, GMatrix<Real>& D,
    GMatrix<Real>& RTranspose)
{
	// TODO.  Implement other QR factorizations and SVD code from "Matrix
	// Computations", and then give the user the ability to specify which
	// methods are used here.

	int numRows = M.GetNumRows();
	int numCols = M.GetNumColumns();
	L.SetSize(numRows, numRows);
	D.SetSize(numRows, numCols);
	RTranspose.SetSize(numCols, numCols);

	GMatrix<Real> kMTM = M.TransposeTimes(M);
	EigenDecomposition<Real> es(kMTM);
	es.Solve(false);
	GMatrix<Real> V = es.GetEigenvectors();
	GMatrix<Real> MV = M*V;
	HouseholderQR(MV, L, D);
	RTranspose = V.Transpose();
}