public static void TestSVD()
		{
			int m = 8;
			int n = 5;
			JamaMatrix jamaMatrix = JamaMatrix.random(5, 3);
			JamaMatrix jamaMatrix2 = JamaMatrix.random(m, n).times(jamaMatrix).times(jamaMatrix.transpose());
			D.Say(0, "A = \n" + jamaMatrix2.ToString());
			SingularValueDecomposition singularValueDecomposition = new SingularValueDecomposition(jamaMatrix2);
			JamaMatrix u = singularValueDecomposition.getU();
			D.Say(0, "U = \n" + u.ToString());
			JamaMatrix s = singularValueDecomposition.S;
			D.Say(0, "S = \n" + s.ToString());
			JamaMatrix v = singularValueDecomposition.getV();
			D.Say(0, "V = \n" + v.ToString());
			D.Say(0, "rank = " + singularValueDecomposition.rank());
			D.Say(0, "cond = " + singularValueDecomposition.cond());
			D.Say(0, "norm2 = " + singularValueDecomposition.norm2());
			JamaMatrix jamaMatrix3 = new JamaMatrix(singularValueDecomposition.SingularValues, 1);
			D.Say(0, "singuler values = \n" + jamaMatrix3.ToString());
			JamaMatrix jamaMatrix4 = u.times(s).times(v.transpose());
			D.Say(0, "reconA =\n" + jamaMatrix4.ToString());
			JamaMatrix jamaMatrix5 = jamaMatrix4.minus(jamaMatrix2);
			D.Say(0, "diffA =\n" + jamaMatrix5.ToString());
		}
		private static JamaMatrix PseudoInverseBySVD(JamaMatrix gm)
		{
			if (gm.RowDimension < gm.ColumnDimension)
			{
				JamaMatrix gm2 = gm.transpose();
				JamaMatrix jamaMatrix = PolynomialImageTransformer.PseudoInverseBySVD(gm2);
				return jamaMatrix.transpose();
			}
			if (gm.RowDimension == gm.ColumnDimension)
			{
				return gm.inverse();
			}
			SingularValueDecomposition singularValueDecomposition = new SingularValueDecomposition(gm);
			JamaMatrix jamaMatrix2 = singularValueDecomposition.S.transpose();
			for (int i = 0; i < jamaMatrix2.RowDimension; i++)
			{
				double element = jamaMatrix2.GetElement(i, i);
				if (element != 0.0)
				{
					jamaMatrix2.SetElement(i, i, 1.0 / element);
				}
			}
			return singularValueDecomposition.getV().times(jamaMatrix2).times(singularValueDecomposition.getU().transpose());
		}