Example #1
0
static void MatrixDetails(const GeneralMatrix& A)
// write matrix details to Exception buffer
{
   MatrixBandWidth bw = A.BandWidth(); int ubw = bw.upper; int lbw = bw.lower;
   Exception::AddMessage("MatrixType = ");
   Exception::AddMessage(A.Type().Value());
   Exception::AddMessage("  # Rows = "); Exception::AddInt(A.Nrows());
   Exception::AddMessage("; # Cols = "); Exception::AddInt(A.Ncols());
   if (lbw >=0)
      { Exception::AddMessage("; lower BW = "); Exception::AddInt(lbw); }
   if (ubw >=0)
      { Exception::AddMessage("; upper BW = "); Exception::AddInt(ubw); }
   Exception::AddMessage("\n");
}
Example #2
0
void GetSubMatrix::operator=(const BaseMatrix& bmx)
{
   REPORT
   Tracer tr("SubMatrix(=)"); GeneralMatrix* gmx = 0;
   // MatrixConversionCheck mcc;         // Check for loss of info
   Try
   {
      SetUpLHS(); gmx = ((BaseMatrix&)bmx).Evaluate();
      if (row_number != gmx->Nrows() || col_number != gmx->Ncols())
         Throw(IncompatibleDimensionsException());
      LoadAndStoreFlag lasf =
         (  row_skip == col_skip
            && gm->Type().IsSymmetric()
            && gmx->Type().IsSymmetric() )
        ? LoadOnEntry+DirectPart
        : LoadOnEntry;
      MatrixRow mrx(gmx, lasf);
      MatrixRow mr(gm, LoadOnEntry+StoreOnExit+DirectPart, row_skip);
                                     // do need LoadOnEntry
      MatrixRowCol sub; int i = row_number;
      while (i--)
      {
         mr.SubRowCol(sub, col_skip, col_number);   // put values in sub
         sub.CopyCheck(mrx); mr.Next(); mrx.Next();
      }
      gmx->tDelete();
#ifdef TEMPS_DESTROYED_QUICKLY
      delete this;
#endif
   }

   CatchAll
   {
      if (gmx) gmx->tDelete();
#ifdef TEMPS_DESTROYED_QUICKLY
      delete this;
#endif
      ReThrow;
   }
}