public void Update(int x, int y, int z, int t, int dir, bool withOR) { Link A = GetSumOfStaples(x, y, z, t, dir); //here A is the sum of staples! //heatbath //Link W = Mul(U[x, y, z, t, dir], A); double det; //Link X = new Link(true); ////for heat-bath //for (int i = 0; i < d; i++) // for (int j = i + 1; j < d; j++) // { // Complex a = W.A[i, i]; // Complex B = W.A[i, j]; // Complex C = W.A[j, i]; // Complex D = W.A[j, j]; // // det = (W.A[i, i] * W.A[j, j] - W.A[i, j] * W.A[j, i]).x; // double x0 = 1 / 2f * (a.x + D.x); // double x1 = 1 / 2f * (B.y + C.y); // double x2 = 1 / 2f * (B.x - C.x); // double x3 = 1 / 2f * (a.y - D.y); // // det = GetDet(A); // det = x0 * x0 + x1 * x1 + x2 * x2 + x3 * x3; // Link a_ = GetHeatBath(det, i, j); // Link r = new Link(true); // det = Math.Sqrt(det); // x0 /= det; // x1 /= det; // x2 /= det; // x3 /= det; // r.A[i, i] = new Complex(x0, x3); // r.A[i, j] = new Complex(x2, x1); // r.A[j, i] = new Complex(-x2, x1); // r.A[j, j] = new Complex(x0, -x3); // r = Mul(a_, r.HermConj()); // W = Mul(r, W); // X = Mul(r, X); // } //U[x, y, z, t, dir] = Mul(X, U[x, y, z, t, dir]); // //for overrelaxation //if (GetRandom() < 0.1) /* if (withOR) { //for (int or = 0; or < 0; or++) //{ //calculating determinant of SU(2) double det = Math.Pow(GetDet(A),1.0/3.0); for (int i = 0; i < SU3.d; i++) for (int j = 0; j < SU3.d; j++) { A.A[i, j].x /= det; A.A[i, j].y /= det; } A = Mul(A.HermConj(), Mul(U[x, y, z, t, dir].HermConj(), A.HermConj())); Orthogonalize(ref A); U[x, y, z, t, dir]=A; } else {*/ //for Metropolis //for (int hit = 0; hit <= 10; hit++) //{ // bool accepted = false; double dSG; Link X = new Link(true); // while (!accepted) // { // X = GetRandomMetroLink(); // //-I // for (int i = 0; i < d; i++) X.A[i, i].x--; // dSG = -beta / SU3.d * ReTr(Mul(X, Mul(U[x, y, z, t, dir], A))); // double r = GetRandom(); // if (r <= Math.Exp(-dSG)) accepted = true; // } // for (int i = 0; i < d; i++) X.A[i, i].x++; // U[x, y, z, t, dir] = Mul(X, U[x, y, z, t, dir]); //} //for poor dynamical fermions for (int hit = 0; hit <= 10; hit++) { bool accepted = false; double dSG; Link X = new Link(true); while (!accepted) { X = GetRandomMetroLink(); Xsite = new Site(x, y, z, t); Xdir = dir; Uprime = Mul(X, U[x, y, z, t, dir]); Dirac D = new Dirac(this); Vector chi = new Vector(Dirac.N); chi.FillGaussRandom(); D.phi = D.MulD(chi); double Fold = Dirac.V1hermV2(chi, chi).x; D.Prepare(); D.IterPrime(); //here - D.x = D^-1*phi double Fnew = Dirac.V1hermV2(D.x, D.x).x; double dSF = Fnew - Fold; //X-I for (int i = 0; i < d; i++) X.A[i, i].x--; dSG = -beta / SU3.d * ReTr(Mul(X, Mul(U[x, y, z, t, dir], A))); double r = GetRandom(); if (r <= Math.Exp(-(dSG + dSF))) accepted = true; } for (int i = 0; i < d; i++) X.A[i, i].x++; U[x, y, z, t, dir] = Mul(X, U[x, y, z, t, dir]); } }
double dSF() { Dirac D = new Dirac(this); Vector chi = new Vector(Dirac.N, DateTime.Now.Millisecond); D.phi = D.MulD(chi); return 0; }
private void button13_Click(object sender, EventArgs e) { //double beta = 6; //SU3 Field = new SU3(int.Parse(tbNs.Text),int.Parse(tbNt.Text), beta, 0, true);//4х2 field beta=6 flux=0 //for (int i = 0; i < 10; i++) Field.Sweep(false); //Dirac Dt = new Dirac(Field); //Complex res = Complex.Zero; //DateTime t = DateTime.Now; //Dirac D = new Dirac(Field); ////D.phi[0, 0, 0] = Complex.One; //D.phi.FillGaussRandom(); //double philen = Dirac.V1hermV2(D.phi, D.phi).Module(); //D.Prepare(); //for (int i = 0; i < 100; i++) //{ // D.Iter(); // Vector phinew = D.MulD(D.x); // double pn = Dirac.V1hermV2(phinew, phinew).Module(); //D.V1hermV2(D.ri, D.ri).Module(); // double r = Dirac.V1hermV2(D.ri, D.ri).Module(); // Text = "i = " + i.ToString() + " philen=" + philen.ToString() + " =? " + pn.ToString() + " r= " + r.ToString()+" "+(DateTime.Now - t).ToString(); // t = DateTime.Now; // Application.DoEvents(); // if (r < 1E-5) break; //} int Ns = 4; int Nt = 2; SU3 UnityField = new SU3(Ns, Nt, 6, 0, true); for (int i = 0; i < Ns; i++) for (int j = 0; j < Ns; j++) for (int k = 0; k < Ns; k++) for (int t = 0; t < Nt; t++) for (int m = 1; m <= 4; m++) { for (int a = 0; a < 3; a++) for (int b = 0; b < 3; b++) UnityField.U[i, j, k, t, m].A[a, b] = new Complex(1, 1); } Complex sum = Complex.Zero; Dirac D = new Dirac(UnityField); D.phi.FillUnity(); Vector v1 = D.MulD(D.phi); Text = Dirac.V1hermV2(v1,v1).ToString(); //Complex sum = Complex.Zero; //for (int i = 0; i < Ns * Ns * Ns * Nt; i++) //{ // for (byte alpha = 0; alpha < 4; alpha++) // for (byte a = 0; a < 3; a++) // { // Dirac D = new Dirac(UnityField); // //D.phi.FillUnity(); // //Vector v1 = D.MulD(D.phi); // D.phi[i, alpha, a] = Complex.One; // D.Prepare(); // int it = D.Iter(); // Text = it.ToString(); // //Vector v2 = D.x; // sum += D.x[i, alpha, a]; // //Text = it.ToString()+Dirac.V1hermV2(v2, v2).ToString(); // } // Text = i.ToString() + " temps=" + sum.ToString(); Application.DoEvents(); //} //Text = sum.ToString(); }