[CoinUtils-tickets] [COIN-OR Common Utilities] #69: printMatrixElement

COIN-OR Common Utilities coin-trac at coin-or.org
Mon Nov 28 17:47:54 EST 2011


#69: printMatrixElement
--------------------+-------------------------------------------------------
Reporter:  mosu001  |       Type:  defect
  Status:  new      |   Priority:  major 
 Version:  trunk    |   Keywords:        
--------------------+-------------------------------------------------------
 I am trying to use printMatrixElement within Dip and the routine hangs. I
 have updated the code as indicated by // MJO =

 void
 CoinPackedMatrix::printMatrixElement(const int row_val, const int col_val)
 const
 {
 int major_index, minor_index;
 if (isColOrdered())
   {
   major_index = col_val;
   minor_index = row_val;
   }
 else
   {
   major_index = row_val;
   minor_index = col_val;
   }
 if (getMajorDim() < major_index) // MJO = Changed from > to <
   std::cout << "Major index out of range: " << major_index << " vs. " <<
 getMajorDim() << "\n";
 CoinBigIndex curr_point = start_[major_index];
 CoinBigIndex stop_point = curr_point + length_[major_index];
 while (curr_point < stop_point)
   {
   if (index_[curr_point] == minor_index)
     {
       std::cout << element_[curr_point];
     return;
     }
   curr_point++; // MJO = Added this to stop infinite loop
   }
  std::cout << 0.0;
 }

-- 
Ticket URL: <https://projects.coin-or.org/CoinUtils/ticket/69>
COIN-OR Common Utilities <http://projects.coin-or.org/CoinUtils>
Common data structures and linear algebra functions for COIN-OR projects



More information about the CoinUtils-tickets mailing list