diff --git a/t.cc b/t.cc index 0f0ba9c..51e865b 100644 --- a/t.cc +++ b/t.cc @@ -2592,15 +2592,140 @@ cin>>x; cout <>t; -bitvector m = mantissa(t,64); +int s; +cin>>t>>s; +bitvector m = mantissa(t,64,s); cout <>n; +NRMat > a(n,n); +a.randomize(1); +NRMat > ah=a.transpose(true); +NRMat > b=a-ah; +//general non-symmetric unitary matrix +NRMat > u=exp(b); +NRMat > bsym(b),banti(b); +bsym.copyonwrite(); +banti.copyonwrite(); +for(int i=0; i > usym=exp(bsym); +NRMat > uanti=exp(banti); +cout < > uh=u.transpose(true); +NRMat > usymh=usym.transpose(true); +NRMat > uantih=uanti.transpose(true); +cout <<"error of unitarity of u*uh = "<<(u*uh).norm(1.)< > uubar=expi(hbar); +NRMat > ubar = NRMat >(ainv) * u * NRMat >(a); +cout <<"error of similarity transformed exponential = "<<(ubar-uubar).norm()< > ubarh = ubar.transpose(true); +NRMat > ubarh2 = NRMat >(atr) * u.transpose(true) * NRMat >(ainvtr); +cout <<"error of ubar hermit conjugation = "<<(ubarh-ubarh2).norm()< > uubarh = uubar.transpose(true); +//cout <<"H = "<