Commit c649444f authored by olivier stasse's avatar olivier stasse
Browse files

Merge pull request #5 from olivier-stasse/master

Add eigen 3.2.x support + Fix some warnings.
parents 408afbdd 3e1ae6c8
...@@ -37,7 +37,7 @@ bool checkColumn( const Eigen::MatrixBase<D>& A, ...@@ -37,7 +37,7 @@ bool checkColumn( const Eigen::MatrixBase<D>& A,
const Eigen::MatrixBase<D>& B, const Eigen::MatrixBase<D>& B,
const int index, int sign = +1 ) const int index, int sign = +1 )
{ {
const int NC = A.rows(),NA=A.cols(),NB=B.cols(), NX = NA+NB; const int NC = (int)A.rows(),NA=(int)A.cols(),NB=(int)B.cols(), NX = (int)(NA+NB);
std::vector<Eigen::MatrixXd> J(3); std::vector<Eigen::MatrixXd> J(3);
std::vector<soth::VectorBound> b(3); std::vector<soth::VectorBound> b(3);
...@@ -98,7 +98,7 @@ int checkAndModify( SubMatrix<MatrixXd,ColPermutation> &A, ...@@ -98,7 +98,7 @@ int checkAndModify( SubMatrix<MatrixXd,ColPermutation> &A,
} }
if( checkColumn(A,B,index,-1) ) if( checkColumn(A,B,index,-1) )
{ {
int ref = A.removeCol(index); int ref = (int)A.removeCol(index);
B.pushColFront(ref); B.pushColFront(ref);
cout << "transfert ... "<< endl; cout << "transfert ... "<< endl;
return 0; return 0;
...@@ -116,7 +116,7 @@ bool checkOut( const MatrixXd &X, ...@@ -116,7 +116,7 @@ bool checkOut( const MatrixXd &X,
/* shoot ab = rand, with a>0 and target=AB*ab /* shoot ab = rand, with a>0 and target=AB*ab
* solve X*x=target, with x>0. */ * solve X*x=target, with x>0. */
const int NC = A.rows(),NA=A.cols(),NB=B.cols(), NX = X.cols(); const int NC = (int)A.rows(), NA=(int)A.cols(),NB=(int)B.cols(), NX = (int)X.cols();
VectorXd ab = VectorXd::Random(NA+NB); ab.head(NA)+= VectorXd::Ones(NA); ab.head(NA)/=2; VectorXd ab = VectorXd::Random(NA+NB); ab.head(NA)+= VectorXd::Ones(NA); ab.head(NA)/=2;
VectorXd target = A*ab.head(NA)+B*ab.tail(NB); VectorXd target = A*ab.head(NA)+B*ab.tail(NB);
cout << "ab = " << (MATLAB)ab << endl; cout << "ab = " << (MATLAB)ab << endl;
...@@ -162,7 +162,7 @@ bool checkIn( const MatrixXd &X, ...@@ -162,7 +162,7 @@ bool checkIn( const MatrixXd &X,
/* shoot x = rand>0, and target=X*x /* shoot x = rand>0, and target=X*x
* solve Aa+Bb = x, with a>0. */ * solve Aa+Bb = x, with a>0. */
const int NC = A.rows(),NA=A.cols(),NB=B.cols(), NX = X.cols(); const int NC = (int)A.rows(),NA=(int)A.cols(),NB=(int)B.cols(), NX =(int) X.cols();
VectorXd x = VectorXd::Random(NX); x+= VectorXd::Ones(NX); x/=2; VectorXd x = VectorXd::Random(NX); x+= VectorXd::Ones(NX); x/=2;
VectorXd target = X*x; VectorXd target = X*x;
cout << "x = " << (MATLAB)x << endl; cout << "x = " << (MATLAB)x << endl;
...@@ -201,7 +201,7 @@ bool checkIn( const MatrixXd &X, ...@@ -201,7 +201,7 @@ bool checkIn( const MatrixXd &X,
int main (int argc, char** argv) int main (int , char** )
{ {
# ifndef NDEBUG # ifndef NDEBUG
sotDebugTrace::openFile(); sotDebugTrace::openFile();
......
...@@ -55,7 +55,7 @@ int main () ...@@ -55,7 +55,7 @@ int main ()
std::vector<soth::VectorBound> b; std::vector<soth::VectorBound> b;
soth::Random::setSeed(704819); soth::Random::setSeed(704819);
const int size = 100; // const int size = 100;
//generateFixedSizeRandomProfile(size, //generateFixedSizeRandomProfile(size,
// 1,0.99,0.99,NB_STAGE,RANKFREE,RANKLINKED,NR,NC); // 1,0.99,0.99,NB_STAGE,RANKFREE,RANKLINKED,NR,NC);
...@@ -79,7 +79,7 @@ int main () ...@@ -79,7 +79,7 @@ int main ()
{ {
RANKFREE += 6,3,7,2,5,5,44,6,2,4,5,3,7,1,50; RANKFREE += 6,3,7,2,5,5,44,6,2,4,5,3,7,1,50;
RANKLINKED.resize(RANKFREE.size(),0); RANKLINKED.resize(RANKFREE.size(),0);
NB_STAGE = RANKFREE.size(); NB_STAGE = (unsigned int)RANKFREE.size();
NR = RANKFREE; NR = RANKFREE;
NC = 150; NC = 150;
} }
...@@ -87,7 +87,7 @@ int main () ...@@ -87,7 +87,7 @@ int main ()
std::cout << "nVar \t= " << NC << std::endl; std::cout << "nVar \t= " << NC << std::endl;
std::cout << "nLevels \t= " << NB_STAGE << std::endl; std::cout << "nLevels \t= " << NB_STAGE << std::endl;
std::cout << "LevelDim \t= [ "; std::cout << "LevelDim \t= [ ";
for(int i=0;i<NB_STAGE;++i) std::cout << NR[i] << " "; for(int i=0;i<(int)NB_STAGE;++i) std::cout << NR[i] << " ";
std::cout << "]" << std::endl; std::cout << "]" << std::endl;
generateDeficientDataSet(J,b,NB_STAGE,RANKFREE,RANKLINKED,NR,NC); generateDeficientDataSet(J,b,NB_STAGE,RANKFREE,RANKLINKED,NR,NC);
...@@ -109,7 +109,7 @@ int main () ...@@ -109,7 +109,7 @@ int main ()
gettimeofday(&t0,NULL); gettimeofday(&t0,NULL);
for(int i=0;i<1000;++i) ehqp(hsolver); for(int i=0;i<1000;++i) ehqp(hsolver);
gettimeofday(&t1,NULL); gettimeofday(&t1,NULL);
time = (t1.tv_sec-t0.tv_sec)+(t1.tv_usec-t0.tv_usec)/1.0e6; time = (double)(t1.tv_sec-t0.tv_sec)+(double)(t1.tv_usec-t0.tv_usec)/1.0e6;
cout << "ehqp = " << time << " ms " << std::endl; cout << "ehqp = " << time << " ms " << std::endl;
...@@ -121,7 +121,7 @@ int main () ...@@ -121,7 +121,7 @@ int main ()
Eigen::DestructiveColPivQR<MatrixXd,MatrixXd > mQR(A,Y, 1e-6); Eigen::DestructiveColPivQR<MatrixXd,MatrixXd > mQR(A,Y, 1e-6);
//Eigen::DestructiveColPivQR<SubMatrixXd,MatrixXd > mQR(Ar,Y, 1e-6); //Eigen::DestructiveColPivQR<SubMatrixXd,MatrixXd > mQR(Ar,Y, 1e-6);
gettimeofday(&t1,NULL); gettimeofday(&t1,NULL);
time = (t1.tv_sec-t0.tv_sec)+(t1.tv_usec-t0.tv_usec)/1.0e6; time = (double)(t1.tv_sec-t0.tv_sec)+(double)(t1.tv_usec-t0.tv_usec)/1.0e6;
cout << "qr = " << time << " ms " << std::endl; cout << "qr = " << time << " ms " << std::endl;
......
...@@ -65,7 +65,7 @@ namespace soth ...@@ -65,7 +65,7 @@ namespace soth
activeRow( unsigned int ref, Bound::bound_t type ) activeRow( unsigned int ref, Bound::bound_t type )
{ {
const unsigned int row = getAFreeRow(); const unsigned int row = getAFreeRow();
assert( (row>=0)&&(row<size()) ); assert( row<size() );
active( ref,type,row ); active( ref,type,row );
return row; return row;
} }
......
...@@ -44,7 +44,7 @@ namespace soth ...@@ -44,7 +44,7 @@ namespace soth
public: /* --- Accessors --- */ public: /* --- Accessors --- */
/* Return the number of active constraint. */ /* Return the number of active constraint. */
inline unsigned int nbActive( void ) const { return nba; } inline unsigned int nbActive( void ) const { return nba; }
inline unsigned int size( void ) const { return cstMap.size(); } inline unsigned int size( void ) const { return (unsigned int)cstMap.size(); }
bool isFreezed( unsigned int ref ) const; bool isFreezed( unsigned int ref ) const;
bool isActive( unsigned int ref ) const; bool isActive( unsigned int ref ) const;
bool wasActive( unsigned int ref,const Bound::bound_t type ) const; bool wasActive( unsigned int ref,const Bound::bound_t type ) const;
......
...@@ -66,8 +66,8 @@ namespace soth ...@@ -66,8 +66,8 @@ namespace soth
template< typename Derived > template< typename Derived >
void MATLAB::genericInit( const MatrixBase<Derived> & m1 ) void MATLAB::genericInit( const MatrixBase<Derived> & m1 )
{ {
if( m1.rows()==0 ) initMatrixRowNull( m1.cols() ); if( m1.rows()==0 ) initMatrixRowNull( (unsigned int)m1.cols() );
else if( m1.cols()==0 ) initMatrixColNull( m1.rows() ); else if( m1.cols()==0 ) initMatrixColNull( (unsigned int)m1.rows() );
else if( m1.IsVectorAtCompileTime) else if( m1.IsVectorAtCompileTime)
{ {
if( m1.cols()==1 ) initVector( m1.col(0) ); if( m1.cols()==1 ) initVector( m1.col(0) );
...@@ -91,7 +91,7 @@ namespace soth ...@@ -91,7 +91,7 @@ namespace soth
if( m1.size()!=i+1 ) if( m1.size()!=i+1 )
{ {
ostmp << ","; ostmp << ",";
const int size = ostmp.str().length(); const int size = (int)ostmp.str().length();
for( unsigned int i=size;i<8;++i) ostmp<<" "; for( unsigned int i=size;i<8;++i) ostmp<<" ";
ostmp << "\t"; ostmp << "\t";
} }
...@@ -138,7 +138,7 @@ namespace soth ...@@ -138,7 +138,7 @@ namespace soth
if( m1.cols()!=j+1 ) if( m1.cols()!=j+1 )
{ {
ostmp << ","; ostmp << ",";
const int size = ostmp.str().length(); const int size = (int)ostmp.str().length();
for( unsigned int i=size;i<8;++i) ostmp<<" "; for( unsigned int i=size;i<8;++i) ostmp<<" ";
ostmp << "\t"; ostmp << "\t";
} }
......
...@@ -54,7 +54,7 @@ namespace soth ...@@ -54,7 +54,7 @@ namespace soth
,boundsMap( inbounds.data(),inbounds.size(),1) ,boundsMap( inbounds.data(),inbounds.size(),1)
,J( Jmap ), bounds( boundsMap ) ,J( Jmap ), bounds( boundsMap )
,nr( inJ.rows() ), nc( inJ.cols() ) ,nr( (unsigned int)inJ.rows() ), nc( (unsigned int)inJ.cols() )
,Y(inY) ,Y(inY)
{ {
......
...@@ -5,6 +5,18 @@ ...@@ -5,6 +5,18 @@
namespace Eigen namespace Eigen
{ {
#if EIGEN_VERSION_AT_LEAST(3,2,0)
#define LOCAL_ABS(x) std::abs(x)
#define LOCAL_ABS2(x) numext::abs2(x)
#else
#define LOCAL_ABS(x) internal::abs(x)
#define LOCAL_ABS2(x) internal::abs2(x)
#endif
/** This class is a modification of Eigen's ColPivHouseholdeQR to perform a rank-revealing QR with column pivoting /** This class is a modification of Eigen's ColPivHouseholdeQR to perform a rank-revealing QR with column pivoting
* MP = QR with R*P' directly stored in the input matrix M and the householder vectors essential parts stored in the * MP = QR with R*P' directly stored in the input matrix M and the householder vectors essential parts stored in the
* column of a different matrix given by the user. * column of a different matrix given by the user.
...@@ -41,14 +53,14 @@ class DestructiveColPivQR ...@@ -41,14 +53,14 @@ class DestructiveColPivQR
m_q(householderEssentialStorage), m_q(householderEssentialStorage),
//m_hCoeffs(std::min(matrix.rows(),matrix.cols())), //m_hCoeffs(std::min(matrix.rows(),matrix.cols())),
m_hCoeffs(householderEssentialStorage.diagonal()), m_hCoeffs(householderEssentialStorage.diagonal()),
m_colsPermutation(matrix.cols()), m_colsPermutation((int)matrix.cols()),
m_colsTranspositions(matrix.cols()), m_colsTranspositions((int)matrix.cols()),
m_colsIntTranspositions(matrix.cols()), m_colsIntTranspositions((int)matrix.cols()),
m_temp(matrix.cols()), m_temp((int)matrix.cols()),
m_colSqNorms(matrix.cols()), m_colSqNorms((int)matrix.cols()),
m_isInitialized(false), m_isInitialized(false),
m_usePrescribedEpsilon((epsilon==0.)? false : true), m_usePrescribedEpsilon((epsilon==0.)? false : true),
m_prescribedEpsilon(epsilon) m_prescribedEpsilon(epsilon)
{ {
eigen_assert(epsilon >= 0.); eigen_assert(epsilon >= 0.);
compute(); compute();
...@@ -262,7 +274,7 @@ typename MatrixType::RealScalar DestructiveColPivQR<MatrixType, HouseholderStror ...@@ -262,7 +274,7 @@ typename MatrixType::RealScalar DestructiveColPivQR<MatrixType, HouseholderStror
{ {
eigen_assert(m_isInitialized && "DestructiveColPivQR is not initialized."); eigen_assert(m_isInitialized && "DestructiveColPivQR is not initialized.");
eigen_assert(m_r.rows() == m_r.cols() && "You can't take the determinant of a non-square matrix!"); eigen_assert(m_r.rows() == m_r.cols() && "You can't take the determinant of a non-square matrix!");
return internal::abs(m_r.diagonal().prod()); return LOCAL_ABS(m_r.diagonal().prod());
} }
template<typename MatrixType, typename HouseholderStrorageType> template<typename MatrixType, typename HouseholderStrorageType>
...@@ -305,8 +317,7 @@ DestructiveColPivQR<MatrixType, HouseholderStrorageType>& DestructiveColPivQR<Ma ...@@ -305,8 +317,7 @@ DestructiveColPivQR<MatrixType, HouseholderStrorageType>& DestructiveColPivQR<Ma
// The threshold should be decided wrt. to the norm of ML, while this class only consider // The threshold should be decided wrt. to the norm of ML, while this class only consider
// the norm of L -> TODO: add an initialization of threshold by EPS*norm(L) ... is it really // the norm of L -> TODO: add an initialization of threshold by EPS*norm(L) ... is it really
// necessary, 'cos it is time consuming. // necessary, 'cos it is time consuming.
RealScalar threshold_helper = internal::abs2(epsilon()); RealScalar threshold_helper = LOCAL_ABS2(epsilon());
m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case) m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
m_maxpivot = RealScalar(0); m_maxpivot = RealScalar(0);
...@@ -362,7 +373,7 @@ DestructiveColPivQR<MatrixType, HouseholderStrorageType>& DestructiveColPivQR<Ma ...@@ -362,7 +373,7 @@ DestructiveColPivQR<MatrixType, HouseholderStrorageType>& DestructiveColPivQR<Ma
m_r.col(m_colsIntTranspositions[k]).tail(rows-k-1).setZero(); m_r.col(m_colsIntTranspositions[k]).tail(rows-k-1).setZero();
// remember the maximum absolute value of diagonal coefficients // remember the maximum absolute value of diagonal coefficients
if(internal::abs(beta) > m_maxpivot) m_maxpivot = internal::abs(beta); if(LOCAL_ABS(beta) > m_maxpivot) m_maxpivot = LOCAL_ABS(beta);
// apply the householder transformation // apply the householder transformation
for (Index l = k+1; l<cols; ++l) for (Index l = k+1; l<cols; ++l)
...@@ -383,9 +394,9 @@ DestructiveColPivQR<MatrixType, HouseholderStrorageType>& DestructiveColPivQR<Ma ...@@ -383,9 +394,9 @@ DestructiveColPivQR<MatrixType, HouseholderStrorageType>& DestructiveColPivQR<Ma
//std::cout << "norms=" << std::endl << m_colSqNorms << std::endl; //std::cout << "norms=" << std::endl << m_colSqNorms << std::endl;
} }
m_colsPermutation.setIdentity(cols); m_colsPermutation.setIdentity((int)cols);
for(Index k = 0; k < m_nonzero_pivots; ++k) for(Index k = 0; k < m_nonzero_pivots; ++k)
m_colsPermutation.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k)); m_colsPermutation.applyTranspositionOnTheRight((int)k, (int)m_colsTranspositions.coeff(k));
m_det_pq = (number_of_transpositions%2) ? -1 : 1; m_det_pq = (number_of_transpositions%2) ? -1 : 1;
m_isInitialized = true; m_isInitialized = true;
......
...@@ -130,7 +130,7 @@ namespace soth ...@@ -130,7 +130,7 @@ namespace soth
{ {
int r=0; int r=0;
for (size_t i=0; i<stages.size(); ++i) for (size_t i=0; i<stages.size(); ++i)
r+= stages[i]->rank(); r+= (int) stages[i]->rank();
return r; return r;
} }
......
...@@ -47,7 +47,7 @@ namespace soth ...@@ -47,7 +47,7 @@ namespace soth
//sizes //sizes
int sizeA() const; int sizeA() const;
int rank() const; int rank() const;
unsigned int nbStages() const { return stages.size(); } unsigned int nbStages() const { return (unsigned int)stages.size(); }
/* --- Decomposition --- */ /* --- Decomposition --- */
public: public:
......
...@@ -133,7 +133,7 @@ namespace soth ...@@ -133,7 +133,7 @@ namespace soth
} }
cstref_vector_t Stage:: cstref_vector_t Stage::
getOptimalActiveSet( bool withTwin ) getOptimalActiveSet( bool )
{ {
cstref_vector_t res(sizeA()); cstref_vector_t res(sizeA());
int loop=0; int loop=0;
...@@ -235,7 +235,7 @@ namespace soth ...@@ -235,7 +235,7 @@ namespace soth
/* Compute ML=J(initIr,:)*Y. */ /* Compute ML=J(initIr,:)*Y. */
computeInitialJY(); computeInitialJY();
assert( Yinit.getRank() >= 0 && Yinit.getRank()<=(int)nc ); assert( Yinit.getRank() >= 0 && Yinit.getRank()<=(int)nc );
const unsigned int previousRank = Y.getRank(); const unsigned int previousRank = (unsigned int)Y.getRank();
isWIdenty = true; isWIdenty = true;
...@@ -292,7 +292,7 @@ namespace soth ...@@ -292,7 +292,7 @@ namespace soth
* sizeL = mQR.rank(); * sizeL = mQR.rank();
*/ */
assert( mQR.rank()>=0 && mQR.rank()<=int(sizeL) ); assert( mQR.rank()>=0 && mQR.rank()<=int(sizeL) );
const unsigned int rank = mQR.rank(); const unsigned int rank = (unsigned int)mQR.rank();
conditionalWinit( sizeL==rank ); conditionalWinit( sizeL==rank );
while( sizeL>rank ) while( sizeL>rank )
...@@ -344,13 +344,13 @@ namespace soth ...@@ -344,13 +344,13 @@ namespace soth
const Index r = (in_r<0)?row-1:in_r; const Index r = (in_r<0)?row-1:in_r;
for( Index i=r-1;i>=0;--i ) // PSEUDOZEROS for( Index i=r-1;i>=0;--i ) // PSEUDOZEROS
{ {
Givens G1(L.col(i),i,row); Givens G1(L.col(i),(int)i,(int)row);
G1.applyTransposeOnTheRight(Mr); G1.applyTransposeOnTheRight(Mr);
G1.applyTransposeOnTheRight(L,r); G1.applyTransposeOnTheRight(L,(int)r);
G1.applyThisOnTheLeft(Wr); G1.applyThisOnTheLeft(Wr);
} }
removeARowFromL( row ); removeARowFromL((unsigned int)row );
sotDEBUG(15) << "W = " << MATLAB(W,isWIdenty) << std::endl; sotDEBUG(15) << "W = " << MATLAB(W,isWIdenty) << std::endl;
sotDEBUG(15) << "L = " << (MATLAB)L << std::endl; sotDEBUG(15) << "L = " << (MATLAB)L << std::endl;
...@@ -387,7 +387,8 @@ namespace soth ...@@ -387,7 +387,8 @@ namespace soth
{ {
if( std::abs(lambda[i])>EPSILON ) if( std::abs(lambda[i])>EPSILON )
{ {
const unsigned int cstref = activeSet.mapInv(i); const unsigned int cstref = (unsigned int)
activeSet.mapInv((unsigned int)i);
if(! activeSet.isFreezed(cstref) ) if(! activeSet.isFreezed(cstref) )
{ {
activeSet.freeze(cstref); activeSet.freeze(cstref);
...@@ -529,7 +530,7 @@ namespace soth ...@@ -529,7 +530,7 @@ namespace soth
sotDEBUG(5) << "W0 = " << MATLAB(W,isWIdenty) << std::endl; sotDEBUG(5) << "W0 = " << MATLAB(W,isWIdenty) << std::endl;
sotDEBUG(5) << "M0 = " << (MATLAB)M << std::endl; sotDEBUG(5) << "M0 = " << (MATLAB)M << std::endl;
sotDEBUG(5) << "L0 = " << (MATLAB)L << std::endl; sotDEBUG(5) << "L0 = " << (MATLAB)L << std::endl;
L.pushColFront( M.popColBack() ); L.pushColFront( (int) M.popColBack() );
sizeM--; sizeM--;
/* Check if one of the M's grown. */ /* Check if one of the M's grown. */
...@@ -544,7 +545,7 @@ namespace soth ...@@ -544,7 +545,7 @@ namespace soth
Block<MatrixXd> ML(ML_,0,0,nr,sizeM+1); Block<MatrixXd> ML(ML_,0,0,nr,sizeM+1);
for( Index j=i+1;j<sizeN();++j ) // PSEUDOZERO for( Index j=i+1;j<sizeN();++j ) // PSEUDOZERO
{ {
Givens G1( Ln,i,j ); Givens G1( Ln,(int)i,(int)j );
G1.transpose() >> M; G1.transpose() >> M;
G1.transpose() >> Ln; G1.transpose() >> Ln;
W << G1; W << G1;
...@@ -631,7 +632,7 @@ namespace soth ...@@ -631,7 +632,7 @@ namespace soth
const int rowRankInL = col-sizeN(); const int rowRankInL = col-sizeN();
activeSet.unactiveRow(row); activeSet.unactiveRow(row);
const unsigned int wcoldown = W.removeCol(col); const unsigned int wcoldown = (unsigned int)W.removeCol(col);
if( rowRankInL>=0 ) { L.removeRow(rowRankInL); sizeL--; } if( rowRankInL>=0 ) { L.removeRow(rowRankInL); sizeL--; }
freeML.put(wcoldown); freeML.put(wcoldown);
...@@ -711,7 +712,7 @@ namespace soth ...@@ -711,7 +712,7 @@ namespace soth
/* Choose the first available row in ML. */ /* Choose the first available row in ML. */
const unsigned int wcolup = freeML.get(); const unsigned int wcolup = freeML.get();
assert( (wcolup >= 0)&&(wcolup<nr) ); assert( wcolup<nr );
sotDEBUG(5) << " wc=" << wcolup << endl; sotDEBUG(5) << " wc=" << wcolup << endl;
/* Add a line to ML. */ /* Add a line to ML. */
...@@ -728,7 +729,7 @@ namespace soth ...@@ -728,7 +729,7 @@ namespace soth
if( norm2>EPSILON*EPSILON ) if( norm2>EPSILON*EPSILON )
{ {
sotDEBUG(45) << "Oversize value is x"<<i<<" = " << JupY(i)<<std::endl; sotDEBUG(45) << "Oversize value is x"<<i<<" = " << JupY(i)<<std::endl;
rankJ=i+1; rankJ=(unsigned int)i+1;
break; break;
} }
} }
...@@ -738,7 +739,7 @@ namespace soth ...@@ -738,7 +739,7 @@ namespace soth
{ /* Rank increase: remove the tail of JuY. */ { /* Rank increase: remove the tail of JuY. */
for( Index i=rankJ-1;i>int(sizeM+sizeL);--i ) for( Index i=rankJ-1;i>int(sizeM+sizeL);--i )
{ {
Givens G1(JupY,i-1,i,true); Givens G1(JupY,(int)i-1,(int)i,true);
Yup.push(G1); Yup.push(G1);
} }
addARow(wcolup); addARow(wcolup);
...@@ -1394,7 +1395,8 @@ namespace soth ...@@ -1394,7 +1395,8 @@ namespace soth
bool res=false; bool res=false;
EI_FOREACH( i,lambda ) EI_FOREACH( i,lambda )
{ {
const unsigned int cstref = activeSet.mapInv(i); const unsigned int cstref = (unsigned int)
activeSet.mapInv((unsigned int)i);
Bound::bound_t btype = activeSet.whichBound(cstref); Bound::bound_t btype = activeSet.whichBound(cstref);
if( activeSet.isFreezed(cstref) ) continue; if( activeSet.isFreezed(cstref) ) continue;
...@@ -1403,7 +1405,8 @@ namespace soth ...@@ -1403,7 +1405,8 @@ namespace soth
case Bound::BOUND_TWIN: case Bound::BOUND_TWIN:
break; // Nothing to do. break; // Nothing to do.
case Bound::BOUND_SUP: case Bound::BOUND_SUP:
sotDEBUG(5) << name<<": row"<<i<<", cst"<<which(i) << ": l=" << lambda(i,0) << endl; sotDEBUG(5) << name<<": row"<<i<<", cst"<<which((unsigned int)i)
<< ": l=" << lambda(i,0) << endl;
if( -lambda[i]>lmax ) if( -lambda[i]>lmax )
{ {
// double Ju = J.row(cstref)*u; // double Ju = J.row(cstref)*u;
...@@ -1411,12 +1414,13 @@ namespace soth ...@@ -1411,12 +1414,13 @@ namespace soth
{ {
res=true; res=true;
lmax=-lambda[i]; lmax=-lambda[i];
row=i; row=(unsigned int)i;
} }
} }
break; break;
case Bound::BOUND_INF: case Bound::BOUND_INF:
sotDEBUG(5) << name<<": row"<<i<<", cst"<<which(i) << ": l=" << lambda(i,0) << endl; sotDEBUG(5) << name<<": row"<<i<<", cst"<<which((unsigned int)i)
<< ": l=" << lambda(i,0) << endl;
if( -lambda[i]>lmax ) // TODO: change the sign of the bound-inf cst. if( -lambda[i]>lmax ) // TODO: change the sign of the bound-inf cst.
{ {
// double Ju = J.row(cstref)*u; // double Ju = J.row(cstref)*u;
...@@ -1424,7 +1428,7 @@ namespace soth ...@@ -1424,7 +1428,7 @@ namespace soth
{ {
res=true; res=true;
lmax=-lambda[i]; lmax=-lambda[i];
row=i; row=(unsigned int)i;
} }
} }
break; break;
......
...@@ -243,7 +243,7 @@ namespace soth ...@@ -243,7 +243,7 @@ namespace soth
inline unsigned int nbConstraints( void ) const { return nr; } inline unsigned int nbConstraints( void ) const { return nr; }
inline unsigned int sizeA( void ) const { return activeSet.nbActive(); } inline unsigned int sizeA( void ) const { return activeSet.nbActive(); }
// sizeN = card(In) = sizeA-sizeL. // sizeN = card(In) = sizeA-sizeL.
inline int sizeN( void ) const { assert((int)sizeA()-sizeL>=0);return sizeA()-sizeL; } inline int sizeN( void ) const { assert((int)(sizeA()-sizeL)>=0);return sizeA()-sizeL; }
inline Index rank() const {return sizeL;} inline Index rank() const {return sizeL;}