Removed some warnings
This commit is contained in:
parent
9cf176a0ff
commit
4e76390661
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.13 2006/07/28 12:39:05 zifnab1974
|
||||||
|
added some typename directives
|
||||||
|
|
||||||
Revision 1.12 2006/07/24 07:26:47 fiorin
|
Revision 1.12 2006/07/24 07:26:47 fiorin
|
||||||
Changed the template argument in JacobiRotate and added method for sorting eigenvalues and eigenvectors (SortEigenvaluesAndEigenvectors)
|
Changed the template argument in JacobiRotate and added method for sorting eigenvalues and eigenvectors (SortEigenvaluesAndEigenvectors)
|
||||||
|
|
||||||
|
@ -79,33 +82,33 @@ namespace vcg
|
||||||
for (ip=0;ip<dimension;++ip) //Initialize b and d to the diagonal of a.
|
for (ip=0;ip<dimension;++ip) //Initialize b and d to the diagonal of a.
|
||||||
{
|
{
|
||||||
b[ip]=d[ip]=w[ip][ip];
|
b[ip]=d[ip]=w[ip][ip];
|
||||||
z[ip]=0.0; //This vector will accumulate terms of the form tapq as in equation (11.1.14).
|
z[ip]=ScalarType(0.0); //This vector will accumulate terms of the form tapq as in equation (11.1.14).
|
||||||
}
|
}
|
||||||
nrot=0;
|
nrot=0;
|
||||||
for (i=0;i<50;i++)
|
for (i=0;i<50;i++)
|
||||||
{
|
{
|
||||||
sm=0.0;
|
sm=ScalarType(0.0);
|
||||||
for (ip=0;ip<dimension-1;++ip) // Sum off diagonal elements
|
for (ip=0;ip<dimension-1;++ip) // Sum off diagonal elements
|
||||||
{
|
{
|
||||||
for (iq=ip+1;iq<dimension;++iq)
|
for (iq=ip+1;iq<dimension;++iq)
|
||||||
sm += fabs(w[ip][iq]);
|
sm += fabs(w[ip][iq]);
|
||||||
}
|
}
|
||||||
if (sm == 0.0) //The normal return, which relies on quadratic convergence to machine underflow.
|
if (sm == ScalarType(0.0)) //The normal return, which relies on quadratic convergence to machine underflow.
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (i < 4)
|
if (i < 4)
|
||||||
tresh=0.2*sm/(dimension*dimension); //...on the first three sweeps.
|
tresh=ScalarType(0.2)*sm/(dimension*dimension); //...on the first three sweeps.
|
||||||
else
|
else
|
||||||
tresh=0.0; //...thereafter.
|
tresh=ScalarType(0.0); //...thereafter.
|
||||||
for (ip=0;ip<dimension-1;++ip)
|
for (ip=0;ip<dimension-1;++ip)
|
||||||
{
|
{
|
||||||
for (iq=ip+1;iq<dimension;iq++)
|
for (iq=ip+1;iq<dimension;iq++)
|
||||||
{
|
{
|
||||||
g=100.0*fabs(w[ip][iq]);
|
g=ScalarType(100.0)*fabs(w[ip][iq]);
|
||||||
//After four sweeps, skip the rotation if the off-diagonal element is small.
|
//After four sweeps, skip the rotation if the off-diagonal element is small.
|
||||||
if(i>4 && (float)(fabs(d[ip])+g) == (float)fabs(d[ip]) && (float)(fabs(d[iq])+g) == (float)fabs(d[iq]))
|
if(i>4 && (float)(fabs(d[ip])+g) == (float)fabs(d[ip]) && (float)(fabs(d[iq])+g) == (float)fabs(d[iq]))
|
||||||
w[ip][iq]=0.0;
|
w[ip][iq]=ScalarType(0.0);
|
||||||
else if (fabs(w[ip][iq]) > tresh)
|
else if (fabs(w[ip][iq]) > tresh)
|
||||||
{
|
{
|
||||||
h=d[iq]-d[ip];
|
h=d[iq]-d[ip];
|
||||||
|
@ -113,19 +116,19 @@ namespace vcg
|
||||||
t=(w[ip][iq])/h; //t =1/(2#)
|
t=(w[ip][iq])/h; //t =1/(2#)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theta=0.5*h/(w[ip][iq]); //Equation (11.1.10).
|
theta=ScalarType(0.5)*h/(w[ip][iq]); //Equation (11.1.10).
|
||||||
t=1.0/(fabs(theta)+sqrt(1.0+theta*theta));
|
t=ScalarType(1.0)/(fabs(theta)+sqrt(ScalarType(1.0)+theta*theta));
|
||||||
if (theta < 0.0) t = -t;
|
if (theta < ScalarType(0.0)) t = -t;
|
||||||
}
|
}
|
||||||
c=1.0/sqrt(1+t*t);
|
c=ScalarType(1.0)/sqrt(ScalarType(1.0)+t*t);
|
||||||
s=t*c;
|
s=t*c;
|
||||||
tau=s/(1.0+c);
|
tau=s/(ScalarType(1.0)+c);
|
||||||
h=t*w[ip][iq];
|
h=t*w[ip][iq];
|
||||||
z[ip] -= h;
|
z[ip] -= h;
|
||||||
z[iq] += h;
|
z[iq] += h;
|
||||||
d[ip] -= h;
|
d[ip] -= h;
|
||||||
d[iq] += h;
|
d[iq] += h;
|
||||||
w[ip][iq]=0.0;
|
w[ip][iq]=ScalarType(0.0);
|
||||||
for (j=0;j<=ip-1;j++) { //Case of rotations 1 <= j < p.
|
for (j=0;j<=ip-1;j++) { //Case of rotations 1 <= j < p.
|
||||||
JacobiRotate<MATRIX_TYPE>(w,s,tau,j,ip,j,iq) ;
|
JacobiRotate<MATRIX_TYPE>(w,s,tau,j,ip,j,iq) ;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +159,7 @@ namespace vcg
|
||||||
* Given the eigenvectors and the eigenvalues as output from JacobiRotate, sorts the eigenvalues
|
* Given the eigenvectors and the eigenvalues as output from JacobiRotate, sorts the eigenvalues
|
||||||
* into descending order, and rearranges the columns of v correspondinlgy.
|
* into descending order, and rearranges the columns of v correspondinlgy.
|
||||||
/param eigenvalues
|
/param eigenvalues
|
||||||
/param eigenvector
|
/param eigenvector (in columns)
|
||||||
*/
|
*/
|
||||||
template < typename MATRIX_TYPE, typename POINT_TYPE >
|
template < typename MATRIX_TYPE, typename POINT_TYPE >
|
||||||
void SortEigenvaluesAndEigenvectors(POINT_TYPE &eigenvalues, MATRIX_TYPE &eigenvectors)
|
void SortEigenvaluesAndEigenvectors(POINT_TYPE &eigenvalues, MATRIX_TYPE &eigenvectors)
|
||||||
|
|
Loading…
Reference in New Issue