Changeset 420 for trunk/test/svd_test.cc


Ignore:
Timestamp:
Dec 2, 2005, 1:15:50 AM (17 years ago)
Author:
Jari Häkkinen
Message:

Merged better_matrix_class changes r402:419 into the trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/svd_test.cc

    r377 r420  
    3737  for (size_t i=0; i<s.size(); ++i)
    3838    S(i,i)=s[i];
    39   gslapi::matrix V=svd.V();
    40   gslapi::matrix U=svd.U();
    41   double error = this_norm(A-U*S*V.transpose());
     39  gslapi::matrix Vtranspose=svd.V();
     40  Vtranspose.transpose();
     41  // Reconstructing A = U*S*Vtranspose
     42  gslapi::matrix Areconstruct=svd.U();
     43  Areconstruct*=S;
     44  Areconstruct*=Vtranspose;
     45  Areconstruct-=A;  // Expect null matrix
     46  double error = this_norm(Areconstruct);
    4247  bool testerror=false;
    4348  if (error>MAXTOL) {
     
    4954  }
    5055
    51   error=this_norm(V.transpose()*V)-n;
     56  Vtranspose*=svd.V();  // Expect unity matrix
     57  error=this_norm(Vtranspose)-n;
    5258  if (error>MAXTOL) {
    5359    std::cerr << "test_svd: FAILED, algorithm " << algo
     
    5763  }
    5864
    59   error=this_norm(U.transpose()*U)-n;
     65  gslapi::matrix Utranspose=svd.U();
     66  Utranspose.transpose();
     67  Utranspose*=svd.U();  // Expect unity matrix
     68  error=this_norm(Utranspose)-n;
    6069  if (error>MAXTOL) {
    6170    std::cerr << "test_svd: FAILED, algorithm " << algo
Note: See TracChangeset for help on using the changeset viewer.