Browse Source

fixed some warnings (comparison between signed/unsigned)

tempestpy_adaptions
gereon 12 years ago
parent
commit
8dce5af515
  1. 11
      src/parser/DeterministicSparseTransitionParser.cpp
  2. 2
      src/parser/DeterministicSparseTransitionParser.h
  3. 6
      src/parser/NondeterministicSparseTransitionParser.cpp
  4. 2
      src/storage/SparseMatrix.h

11
src/parser/DeterministicSparseTransitionParser.cpp

@ -44,7 +44,7 @@ namespace parser {
* @param buf Data to scan. Is expected to be some char array. * @param buf Data to scan. Is expected to be some char array.
* @param maxnode Is set to highest id of all nodes. * @param maxnode Is set to highest id of all nodes.
*/ */
uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, int_fast64_t& maxnode, RewardMatrixInformationStruct* rewardMatrixInformation) {
uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, uint_fast64_t& maxnode, RewardMatrixInformationStruct* rewardMatrixInformation) {
bool isRewardMatrix = rewardMatrixInformation != nullptr; bool isRewardMatrix = rewardMatrixInformation != nullptr;
uint_fast64_t nonZeroEntryCount = 0; uint_fast64_t nonZeroEntryCount = 0;
@ -58,7 +58,8 @@ uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, int_fast
/* /*
* Check all transitions for non-zero diagonal entries and deadlock states. * Check all transitions for non-zero diagonal entries and deadlock states.
*/ */
int_fast64_t row, lastRow = -1, col;
int_fast64_t lastRow = -1;
uint_fast64_t row, col;
uint_fast64_t readTransitionCount = 0; uint_fast64_t readTransitionCount = 0;
bool rowHadDiagonalEntry = false; bool rowHadDiagonalEntry = false;
double val; double val;
@ -71,12 +72,12 @@ uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, int_fast
col = checked_strtol(buf, &buf); col = checked_strtol(buf, &buf);
if (!isRewardMatrix) { if (!isRewardMatrix) {
if (lastRow != row) {
if (lastRow != (int_fast64_t)row) {
if ((lastRow != -1) && (!rowHadDiagonalEntry)) { if ((lastRow != -1) && (!rowHadDiagonalEntry)) {
++nonZeroEntryCount; ++nonZeroEntryCount;
rowHadDiagonalEntry = true; rowHadDiagonalEntry = true;
} }
for (int_fast64_t skippedRow = lastRow + 1; skippedRow < row; ++skippedRow) {
for (uint_fast64_t skippedRow = (uint_fast64_t)(lastRow + 1); skippedRow < row; ++skippedRow) {
++nonZeroEntryCount; ++nonZeroEntryCount;
} }
lastRow = row; lastRow = row;
@ -146,7 +147,7 @@ DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(std::st
/* /*
* Perform first pass, i.e. count entries that are not zero. * Perform first pass, i.e. count entries that are not zero.
*/ */
int_fast64_t maxStateId;
uint_fast64_t maxStateId;
uint_fast64_t nonZeroEntryCount = this->firstPass(file.data, maxStateId, rewardMatrixInformation); uint_fast64_t nonZeroEntryCount = this->firstPass(file.data, maxStateId, rewardMatrixInformation);
LOG4CPLUS_INFO(logger, "First pass on " << filename << " shows " << nonZeroEntryCount << " NonZeros."); LOG4CPLUS_INFO(logger, "First pass on " << filename << " shows " << nonZeroEntryCount << " NonZeros.");

2
src/parser/DeterministicSparseTransitionParser.h

@ -26,7 +26,7 @@ class DeterministicSparseTransitionParser : public Parser {
private: private:
std::shared_ptr<storm::storage::SparseMatrix<double>> matrix; std::shared_ptr<storm::storage::SparseMatrix<double>> matrix;
uint_fast64_t firstPass(char* buf, int_fast64_t &maxnode, RewardMatrixInformationStruct* rewardMatrixInformation);
uint_fast64_t firstPass(char* buf, uint_fast64_t &maxnode, RewardMatrixInformationStruct* rewardMatrixInformation);
}; };

6
src/parser/NondeterministicSparseTransitionParser.cpp

@ -91,7 +91,7 @@ uint_fast64_t NondeterministicSparseTransitionParser::firstPass(char* buf, uint_
// If we skipped some states, we need to reserve empty rows for all their nondeterministic // If we skipped some states, we need to reserve empty rows for all their nondeterministic
// choices. // choices.
for (uint_fast64_t i = lastsource + 1; i < source; ++i) {
for (int_fast64_t i = lastsource + 1; i < source; ++i) {
choices += ((*rewardMatrixInformation->nondeterministicChoiceIndices)[i + 1] - (*rewardMatrixInformation->nondeterministicChoiceIndices)[i]); choices += ((*rewardMatrixInformation->nondeterministicChoiceIndices)[i + 1] - (*rewardMatrixInformation->nondeterministicChoiceIndices)[i]);
} }
@ -221,7 +221,7 @@ NondeterministicSparseTransitionParser::NondeterministicSparseTransitionParser(s
} }
if (isRewardFile) { if (isRewardFile) {
if (choices > rewardMatrixInformation->rowCount || maxnode + 1 > rewardMatrixInformation->columnCount) {
if (choices > rewardMatrixInformation->rowCount || (uint_fast64_t)(maxnode + 1) > rewardMatrixInformation->columnCount) {
LOG4CPLUS_ERROR(logger, "Reward matrix size exceeds transition matrix size."); LOG4CPLUS_ERROR(logger, "Reward matrix size exceeds transition matrix size.");
throw storm::exceptions::WrongFileFormatException() << "Reward matrix size exceeds transition matrix size."; throw storm::exceptions::WrongFileFormatException() << "Reward matrix size exceeds transition matrix size.";
} else if (choices != rewardMatrixInformation->rowCount) { } else if (choices != rewardMatrixInformation->rowCount) {
@ -278,7 +278,7 @@ NondeterministicSparseTransitionParser::NondeterministicSparseTransitionParser(s
// If we skipped some states, we need to reserve empty rows for all their nondeterministic // If we skipped some states, we need to reserve empty rows for all their nondeterministic
// choices. // choices.
for (uint_fast64_t i = lastsource + 1; i < source; ++i) {
for (int_fast64_t i = lastsource + 1; i < source; ++i) {
curRow += ((*rewardMatrixInformation->nondeterministicChoiceIndices)[i + 1] - (*rewardMatrixInformation->nondeterministicChoiceIndices)[i]); curRow += ((*rewardMatrixInformation->nondeterministicChoiceIndices)[i + 1] - (*rewardMatrixInformation->nondeterministicChoiceIndices)[i]);
} }

2
src/storage/SparseMatrix.h

@ -770,7 +770,7 @@ public:
T constOne = storm::utility::constGetOne<T>(); T constOne = storm::utility::constGetOne<T>();
// copy diagonal entries to other matrix // copy diagonal entries to other matrix
for (int i = 0; i < rowCount; ++i) {
for (unsigned int i = 0; i < rowCount; ++i) {
resultDinv->addNextValue(i, i, constOne / resultLU->getValue(i, i)); resultDinv->addNextValue(i, i, constOne / resultLU->getValue(i, i));
resultLU->getValue(i, i) = storm::utility::constGetZero<T>(); resultLU->getValue(i, i) = storm::utility::constGetZero<T>();
} }
Loading…
Cancel
Save