def exercise_increasing_dimensions(self): print("Scaling with m and m/n: ", end=' ') n_tests = 0 for sigma, a in self.matrices(): m, n = a.focus() if self.show_progress: if not n_tests: print() print((m, n), end=' ') sys.stdout.flush() svd = self.klass(a, self.accumulate_u, self.accumulate_v) if self.show_progress: print('!', end=' ') sys.stdout.flush() sigma = sigma.select(flex.sort_permutation(sigma, reverse=True)) delta = (svd.sigma - sigma).norm() / sigma.norm() / min( m, n) / self.eps assert delta < 10 n_tests += 1 if not self.exercise_tntbx: if self.show_progress: print() continue svd = tntbx.svd_m_ge_n_double(a) if self.show_progress: print('!') sys.stdout.flush() sigma = sigma.select(flex.sort_permutation(sigma, reverse=True)) delta = ((svd.singular_values() - sigma).norm() / sigma.norm() / min(m, n) / self.eps) assert delta < 10 if self.show_progress: print() print("%i done" % n_tests)
def exercise_increasing_dimensions(self): print "Scaling with m and m/n: ", n_tests = 0 for sigma, a in self.matrices(): m, n = a.focus() if self.show_progress: if not n_tests: print print (m,n), sys.stdout.flush() svd = scitbx.linalg.svd.real(a, self.accumulate_u, self.accumulate_v) if self.show_progress: print '!', sys.stdout.flush() sigma = sigma.select(flex.sort_permutation(sigma, reverse=True)) delta = (svd.sigma - sigma).norm()/sigma.norm()/min(m,n)/self.eps assert delta < 10 n_tests += 1 if not self.exercise_tntbx: if self.show_progress: print continue svd = tntbx.svd_m_ge_n_double(a) if self.show_progress: print '!' sys.stdout.flush() sigma = sigma.select(flex.sort_permutation(sigma, reverse=True)) delta = ((svd.singular_values() - sigma).norm() /sigma.norm()/min(m,n)/self.eps) assert delta < 10 if self.show_progress: print print "%i done" % n_tests