* Exception
*/
DeclException0 (ExcMatrixNotBlockSquare);
+
/**
* Exception
*/
DeclException0 (ExcMatrixNotInitialized);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcDivideByZero);
+
private:
/**
{
Assert (columns != 0, ExcMatrixNotInitialized());
Assert (rows != 0, ExcMatrixNotInitialized());
+ Assert (factor !=0, ExcDivideByZero());
+
+ const number factor_inv = 1. / factor;
for (unsigned int r=0; r<rows; ++r)
for (unsigned int c=0; c<columns; ++c)
- block(r,c) /= factor;
+ block(r,c) *= factor_inv;
return *this;
}
/**
* Exception
*/
+ DeclException0 (ExcDivideByZero);
+ /**
+ * Exception
+ */
DeclException2 (ExcIteratorRange,
int, int,
<< "The iterators denote a range of " << arg1
{
Assert (cols != 0, ExcMatrixNotInitialized());
Assert (val != 0, ExcMatrixNotInitialized());
+ Assert (factor !=0, ExcDivideByZero());
+
+ const number factor_inv = 1. / factor;
number *val_ptr = &val[0];
const number *const end_ptr = &val[cols->n_nonzero_elements()];
while (val_ptr != end_ptr)
- *val_ptr++ /= factor;
+ *val_ptr++ *= factor_inv;
return *this;
}
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams