private void button10_Click(object sender, EventArgs e) { double beta = 10; 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; for (int n = 0; n < Dirac.N; n++) for (byte alpha = 0; alpha < 4; alpha++) for (byte a = 0; a < 3; a++) { DateTime t = DateTime.Now; Dirac D = new Dirac(Field); D.phi[n, alpha, a] = Complex.One; //double philen = Dirac.V1hermV2(D.phi, D.phi).Module(); D.Prepare(); for (int i = 0; i < 5; i++) { D.Iter(); //Vector phinew = D.MulD(D.x); //double r = 0;// D.V1hermV2(phinew, phinew).Module(); //D.V1hermV2(D.ri, D.ri).Module(); //Text = "i = " + i.ToString() + " philen=" + philen.ToString() + " =? " + r.ToString() + " " + (DateTime.Now - t).ToString(); //t = DateTime.Now; } res += D.x[n, alpha, a]; Text = n.ToString() + " " + (res / new Complex((n + 1) * 12, 0)).ToString(); Application.DoEvents(); if (CloseMe) break; } Text = (res / new Complex(Dirac.N, 0)).ToString(); //for (int exp = 0; exp < 1; exp++) //{ // double beta = 6;// 1 + 10 * exp; // SU3 Field = new SU3(4, 2, beta, 0, true);//4х2 field beta=6 flux=0 // for (int i = 0; i < 10; i++) Field.Sweep(false); // DateTime t = DateTime.Now; // int K = 100; // Vector[] chi = new Vector[K]; // Complex tr = new Complex(); // for (int k = 0; k < K; k++) // { // Dirac D = new Dirac(Field); // chi[k] = new Vector(Dirac.N, rand.Next()); // chi[k].FillGaussRandom(); // D.phi = chi[k]; // //double philen = Dirac.V1hermV2(D.phi, D.phi).Module(); // D.Prepare(); // for (int i = 0; i < 4; i++) // { // D.Iter(); // //Vector v = D.MulD(D.x); // //Text = Dirac.V1hermV2(D.ri, D.ri).ToString();//"Dx = " + Dirac.V1hermV2(v, v).Module() + " phi = " + philen.ToString(); // //Application.DoEvents(); // } // tr += Dirac.V1hermV2(D.phi, D.x); // Text = beta.ToString() + " " + k.ToString(); // Application.DoEvents(); // } // tr *= new Complex(1 / (double)K / (4 * 4 * 4 * 2 * 12 * 2), 0); // Text = tr.ToString(); // chart1.Series[0].Points.AddXY(beta, tr.x); //} }
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]); } }
private void button12_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); Complex res = Complex.Zero; Dirac D = new Dirac(Field); D.phi.FillRandom(); DateTime t = DateTime.Now; D.Prepare(); //for (int i = 0; i < 10; i++) D.Iter(); Text = ((DateTime.Now - t).TotalMilliseconds).ToString(); }