Browse Source

Added typecast when dealing with some Eigen functions to avoid comparing

signed and unsigned values
tempestpy_adaptions
Lanchid 12 years ago
parent
commit
a69faa9f6a
  1. 9
      src/storage/SparseMatrix.h

9
src/storage/SparseMatrix.h

@ -191,12 +191,12 @@ public:
throw storm::exceptions::InvalidArgumentException("Trying to initialize from an Eigen matrix that is not in compressed form.");
}
if (eigenSparseMatrix.rows() > this->rowCount) {
if (static_cast<uint_fast64_t>(eigenSparseMatrix.rows()) > this->rowCount) {
triggerErrorState();
LOG4CPLUS_ERROR(logger, "Trying to initialize from an Eigen matrix that has more rows than the target matrix.");
throw storm::exceptions::InvalidArgumentException("Trying to initialize from an Eigen matrix that has more rows than the target matrix.");
}
if (eigenSparseMatrix.cols() > this->colCount) {
if (static_cast<uint_fast64_t>(eigenSparseMatrix.cols()) > this->colCount) {
triggerErrorState();
LOG4CPLUS_ERROR(logger, "Trying to initialize from an Eigen matrix that has more columns than the target matrix.");
throw storm::exceptions::InvalidArgumentException("Trying to initialize from an Eigen matrix that has more columns than the target matrix.");
@ -226,7 +226,7 @@ public:
LOG4CPLUS_ERROR(logger, "Unable to allocate internal storage.");
throw std::bad_alloc();
} else {
if ((eigenSparseMatrix.innerSize() > nonZeroEntryCount) || (entryCount > nonZeroEntryCount)) {
if ((static_cast<uint_fast64_t>(eigenSparseMatrix.innerSize()) > nonZeroEntryCount) || (static_cast<uint_fast64_t>(entryCount) > nonZeroEntryCount)) {
triggerErrorState();
LOG4CPLUS_ERROR(logger, "Invalid internal composition of Eigen Sparse Matrix");
throw storm::exceptions::InvalidArgumentException("Invalid internal composition of Eigen Sparse Matrix");
@ -236,7 +236,8 @@ public:
std::vector<T> eigenValueTemp;
uint_fast64_t outerSize = eigenSparseMatrix.outerSize() + 1;
for (uint_fast64_t i = 0; i < entryCount; ++i) {
uint_fast64_t entryCountUnsigned = static_cast<uint_fast64_t>(entryCount);
for (uint_fast64_t i = 0; i < entryCountUnsigned; ++i) {
eigenColumnTemp.push_back(indexPtr[i]);
eigenValueTemp.push_back(valuePtr[i]);
}

Loading…
Cancel
Save