1 #ifndef MADNESS_JACOBI_H
2 #define MADNESS_JACOBI_H
21 int i, j,
k, iter, nrot;
22 double tolmin = std::sqrt(n) * 5.0e-16, tol = 0.05;
27 A(i,j) =
A(j,i) = 0.5*(
A(i,j) +
A(j,i));
35 double daii = std::fabs(
A(i,i));
41 double * __restrict__ ai = &A(i,0); \
42 double * __restrict__ aj = &A(j,0); \
43 for (k=0; k<n; k++) { \
53 double * __restrict__ ai = &A(0,i); \
54 double * __restrict__ aj = &A(0,j); \
55 for (k=0; k<n*n; k+=n) { \
63 for (iter=0; iter<5000; iter++) {
67 for (j=i+1; j<n; j++) {
68 if (set[i] != set[j]) {
72 double daij = std::fabs(aij);
74 maxdaij =
std::max(maxdaij,daij/maxd);
76 if (daij > tol*maxd) {
78 double ds = std::fabs(s);
79 if (daij > (tolmin*ds)) {
82 if ((tolmin*daij) > ds) {
83 c = s = 1.0/std::sqrt(2.);
87 double u = 0.25/std::sqrt(0.25+t*t);
116 A(j,i) =
A(i,j) = 0.0;
126 if (nrot == 0 && tol <= tolmin)
break;
127 tol = std::min(tol,maxdaij*1
e-1);
132 printf(
"Jacobi iteration did not converge in 5000 passes\n");
real_convolution_3d A(World &world)
Definition: DKops.h:230
Definition: test_ar.cc:118
#define max(a, b)
Definition: lda.h:51
Defines madness::MadnessException for exception handling.
#define MADNESS_CHECK(condition)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition: madness_exception.h:190
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
void jacobi(Tensor< double > &A, Tensor< double > &V, const std::vector< int > &set)
Definition: jacobi.h:13
Defines simple templates for printing to std::cout "a la Python".
static const double c
Definition: relops.cc:10
static const long k
Definition: rk.cc:44
static double V(const coordT &r)
Definition: tdse.cc:288
Defines and implements most of Tensor.
void e()
Definition: test_sig.cc:75
double u(const double x, const double expnt)
Definition: testperiodic.cc:56