Commit 6bc955dc authored by Martin Maechler's avatar Martin Maechler
Browse files

get rid of compiler warnings (int <-> unsigned int / extraneous ";")

parent cf620d68
......@@ -71,7 +71,7 @@ bigmod & bigvec::get(unsigned int row, unsigned int col) {
}
bigmod & bigvec::operator[] (unsigned int i)
bigmod & bigvec::operator[] (unsigned int i)
{
checkValuesMod();
return *valuesMod[i];
......@@ -94,18 +94,18 @@ void bigvec::checkValuesMod() {
// reconstruct bigmod that are references to values and modulus:
clearValuesMod();
if(modulus.size()>0) {
for (int i = 0 ; i < value.size(); i++)
for (unsigned int i = 0 ; i < value.size(); i++)
valuesMod.push_back(new bigmod(value[i], modulus[i%modulus.size()]));
} else {
for (int i= 0 ; i < value.size(); i++)
for (unsigned int i= 0 ; i < value.size(); i++)
valuesMod.push_back(new BigModInt(value[i]));
}
}
}
void bigvec::clearValuesMod(){
for (int i = 0 ; i < valuesMod.size(); i++){
for (unsigned int i = 0 ; i < valuesMod.size(); i++){
delete valuesMod[i];
}
valuesMod.clear();
......@@ -123,7 +123,7 @@ void bigvec::set(unsigned int i,const bigmod & val)
return;
}
int nrow_mod = nrow;
unsigned int nrow_mod = nrow;
if(nrow<1)
nrow_mod = 1;
if( (modulus.size() == (unsigned int)nrow_mod ) || (modulus.size() == 1) )
......@@ -145,7 +145,7 @@ void bigvec::set(unsigned int i,const bigmod & val)
void bigvec::push_back(const bigmod & number)
{
int nrow_mod = (nrow < 0) ? 1 : nrow;
unsigned int nrow_mod = (nrow < 0) ? 1 : nrow;
clearValuesMod();
value.push_back(number.getValue());
......@@ -162,7 +162,7 @@ void bigvec::push_back(const bigmod & number)
}
// standard cas
if((modulus.size() != 1 ) && (static_cast<int>(modulus.size()) != nrow_mod) )
if((modulus.size() != 1 ) && (modulus.size() != nrow_mod))
{
modulus.push_back(number.getModulus());
return;
......@@ -185,7 +185,7 @@ void bigvec::push_back(const bigmod & number)
}
}
/**
/**
* insert int value
*/
void bigvec::push_back(int value_p)
......@@ -194,7 +194,7 @@ void bigvec::push_back(int value_p)
value.push_back(biginteger(value_p));
}
/**
/**
* insert int value
*/
void bigvec::push_back(biginteger & value_p)
......
......@@ -56,7 +56,7 @@ namespace solve_gmp_R
{
// A [ i ,j] = A[ i + j * A.nrow]
for(int k = 0 ; k < A.nRows(); ++k)
for(unsigned int k = 0 ; k < A.nRows(); ++k)
{
if(A.get(k, k).sgn() == 0 )
Rf_error("System is singular");
......@@ -66,7 +66,7 @@ namespace solve_gmp_R
A.mulLine(k,tmpValeur);
B.mulLine(k,tmpValeur);
for(int i = 0; i< A.nRows(); ++i)
for(unsigned int i = 0; i < A.nRows(); ++i)
{
if(i == k)
continue;
......
......@@ -29,7 +29,7 @@ namespace math{
virtual ~Matrix() {
if (transposate) delete transposate;
};
}
virtual unsigned int nRows() const = 0;
......@@ -53,7 +53,7 @@ namespace math{
* \brief substract lambda * line j to line i
*/
void subLine(unsigned int i,unsigned int j,const T & lambda){
for(int k=0; k < nCols() ; ++k)
for(unsigned int k=0; k < nCols() ; ++k)
set(i , k , get(i, k) - ( get(j , k) * lambda ) );
}
......@@ -61,7 +61,7 @@ namespace math{
* \brief multiply line i by lambda
*/
void mulLine(unsigned int i,const T & lambda){
for(int k=0; k < nCols(); ++k)
for(unsigned int k=0; k < nCols(); ++k)
set(i , k, get(i,k) * lambda );
}
......@@ -77,7 +77,7 @@ namespace math{
public:
Transpose(Matrix<T> & source_p)
: source(source_p) {
};
}
unsigned int size() const{
return source.size();
......@@ -95,12 +95,12 @@ namespace math{
source.set(j,i,val);
}
};
};
// template code.
template<class T>
Vector<T>::Vector() {
};
}
template<class T>
Matrix<T>::Matrix() :
......@@ -121,7 +121,7 @@ namespace math{
unsigned int Matrix<T>::nCols() const{
return this->size() / nRows();
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment