예제 #1
0
void initMatrix (M &m)
{
   mt.init (42);

   for (unsigned d = 0; d < m.getDimension(); ++d)
   {
      for (unsigned r = 0; r < m.getM(); ++ r)
      {
         for (unsigned b = 0; b < m.getTotalPrec(); ++b)
         {
            m.setDigit (d, r, b, mt (m.getBase()));
         }
      }
   }
}
예제 #2
0
bool verifyMatrix (M &m)
{
   mt.init (42);

   for (unsigned d = 0; d < m.getDimension(); ++d)
   {
      for (unsigned r = 0; r < m.getM(); ++ r)
      {
         for (unsigned b = 0; b < m.getTotalPrec(); ++b)
         {
            if (int (m.getDigit (d, r, b)) != mt (m.getBase()))
            {
               return false;
            }
         }
      }
   }

   return true;
}