From 84560cd6c7148abf94eec4dc3e2ef1cb2600d97d Mon Sep 17 00:00:00 2001 From: jiri Date: Thu, 5 Nov 2009 16:58:24 +0000 Subject: [PATCH] *** empty log message *** --- t.cc | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/t.cc b/t.cc index 749c72f..1cb8363 100644 --- a/t.cc +++ b/t.cc @@ -1292,7 +1292,7 @@ vv += u; cout < scale; cin >> scale; @@ -1312,5 +1312,93 @@ cout <<"Error "<<(y-z).norm()<>nocc>>nvirt; +int n=nocc+nvirt; +NRMat t(nocc,nvirt); +t.randomize(0.5); +NRSMat A(n); +A=1.; +for(int i=0; i B(n,n); +NRVec E(n); +cout < Awork=A; +diagonalize(Awork,E,&B); +cout < U = A*B; +for(int p=0; p > h(ham); +h *= complex(0,1); +h.simplify(); +cout <<"norms of input (should be same) "< > hexp = exp(h); +cout <<"sparse exp time "< >hamexp2(hexp); +cout <<"norm of results "< >hamexp3 = complexmatrix(c,s); +cout <<"sincos error = "<<(hamexp1-hamexp3).norm()< hreal(hamreal); +SparseMat si,co; +t=clock()/((double) (CLOCKS_PER_SEC)); +sincos(si,co,hreal); +cout <<"sparse sincos time "< >hamexp4 = complexmatrix(NRMat(co),NRMat(si)); +cout <<"sincos error 2 = "<<(hamexp1-hamexp4).norm()< > rhs(ham.ncols()); +rhs.randomize(1.); +t=clock()/((double) (CLOCKS_PER_SEC)); +NRVec > r1 = exptimes(ham*complex(0,1),rhs); +cout <<"dense exptimes "< > r2 = exptimes(h,rhs); +cout <<"sparse exptimes "< > r3 = cov + siv*complex(0,1); +cout <<"sincostimes error = "<<(r1-r3).norm()< > siv2,cov2; +t=clock()/((double) (CLOCKS_PER_SEC)); +sincostimes(hreal,siv2,cov2,rhs); +cout <<"sparse sincostimes "< > r4 = cov2 + siv2*complex(0,1); +cout <<"sincostimes error 2 = "<<(r1-r4).norm()<