*** empty log message ***

This commit is contained in:
jiri 2005-02-25 23:37:26 +00:00
parent a8dcc5d297
commit 7f79e55a63

View File

@ -340,11 +340,21 @@ extern "C" void FORNAME(dggev)(const char *JOBVL, const char *JOBVR, const int *
//statics for sorting //statics for sorting
static int *gdperm; static int *gdperm;
static double *gdwr, *gdwi; static double *gdwr, *gdwi, *gdbeta;
//compare methods //compare methods
static double realonly(const int i, const int j) static double realonly(const int i, const int j)
{ {
if(gdbeta)
{
if(gdbeta[i]==0. && gdbeta[j]!=0) return 1.;
if(gdbeta[j]==0. && gdbeta[i]!=0) return -1.;
if(gdbeta[i]==0. && gdbeta[j]==0) return 0.;
double tmp = gdwr[i]/gdbeta[i]-gdwr[j]/gdbeta[j];
if(tmp) return tmp;
return gdwi[j]/gdbeta[j]-gdwi[i]/gdbeta[i];
}
//else
double tmp = gdwr[i]-gdwr[j]; double tmp = gdwr[i]-gdwr[j];
if(tmp) return tmp; if(tmp) return tmp;
return gdwi[j]-gdwi[i]; return gdwi[j]-gdwi[i];
@ -354,9 +364,7 @@ static double realfirst(const int i, const int j)
{ {
if(gdwi[i] && ! gdwi[j]) return 1.; if(gdwi[i] && ! gdwi[j]) return 1.;
if(!gdwi[i] && gdwi[j]) return -1.; if(!gdwi[i] && gdwi[j]) return -1.;
double tmp = gdwr[i]-gdwr[j]; return realonly(i,j);
if(tmp) return tmp;
return gdwi[j]-gdwi[i];
} }
static double (* gdcompar[2])(const int, const int) = {&realonly, &realfirst}; static double (* gdcompar[2])(const int, const int) = {&realonly, &realfirst};
@ -369,6 +377,7 @@ int itmp;
itmp=gdperm[i]; gdperm[i]=gdperm[j]; gdperm[j]=itmp; itmp=gdperm[i]; gdperm[i]=gdperm[j]; gdperm[j]=itmp;
tmp=gdwr[i]; gdwr[i]=gdwr[j]; gdwr[j]=tmp; tmp=gdwr[i]; gdwr[i]=gdwr[j]; gdwr[j]=tmp;
tmp=gdwi[i]; gdwi[i]=gdwi[j]; gdwi[j]=tmp; tmp=gdwi[i]; gdwi[i]=gdwi[j]; gdwi[j]=tmp;
if(gdbeta) {tmp=gdbeta[i]; gdbeta[i]=gdbeta[j]; gdbeta[j]=tmp;}
} }
@ -426,7 +435,7 @@ void gdiagonalize(NRMat<double> &a, NRVec<double> &wr, NRVec<double> &wi,
if(biorthonormalize && vl && vr) if(biorthonormalize && vl && vr)
{ {
if(b || beta) laerror("biorthonormalize not implemented yet for generalized non-symmetric eiugenproblem");//metric b would be needed if(b || beta) laerror("@@@ biorthonormalize not implemented yet for generalized non-symmetric eigenproblem");//metric b would be needed
int i=0; int i=0;
while(i<n) while(i<n)
{ {
@ -486,10 +495,10 @@ void gdiagonalize(NRMat<double> &a, NRVec<double> &wr, NRVec<double> &wi,
if(sorttype>0) if(sorttype>0)
{ {
if(b || beta) laerror("sort not implemented yet for generalized non-symmetric eiugenproblem");
NRVec<int> perm(n); NRVec<int> perm(n);
for(int i=0; i<n;++i) perm[i]=i; for(int i=0; i<n;++i) perm[i]=i;
gdperm= perm; gdperm= perm;
if(beta) gdbeta= *beta; else gdbeta= NULL;
gdwr=wr, gdwi=wi; gdwr=wr, gdwi=wi;
genqsort(0,n-1,gdcompar[sorttype-1],gdswap); genqsort(0,n-1,gdcompar[sorttype-1],gdswap);
if(vl) if(vl)