bool
FullMatrix<number>::all_zero () const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
- const number *p = this->data(),
- *e = this->data() + n()*m();
+ const number* p = this->data();
+ const number* const e = this->data() + n_elements();
while (p!=e)
if (*p++ != 0.0)
return false;
const Vector<number2>& src,
const bool adding) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert(dst.size() == m(), ExcDimensionMismatch(dst.size(), m()));
Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n()));
const Vector<number2> &src,
const bool adding) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert(dst.size() == n(), ExcDimensionMismatch(dst.size(), n()));
Assert(src.size() == m(), ExcDimensionMismatch(src.size(), m()));
const Vector<number2>& src,
const Vector<number3>& right) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert(dst.size() == m(), ExcDimensionMismatch(dst.size(), m()));
Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n()));
void FullMatrix<number>::forward (Vector<number2> &dst,
const Vector<number2> &src) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (dst.size() == m(), ExcDimensionMismatch(dst.size(), m()));
Assert (src.size() == n(), ExcDimensionMismatch(src.size(), n()));
void FullMatrix<number>::backward (Vector<number2> &dst,
const Vector<number2> &src) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
unsigned int j;
unsigned int nu = (m()<n() ? m() : n());
const number s,
const unsigned int j)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
for (unsigned int k=0; k<m(); ++k)
this->el(i,k) += s*this->el(j,k);
const number t,
const unsigned int k)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
const unsigned int size_m = m();
for (unsigned l=0; l<size_m; ++l)
void FullMatrix<number>::add_col (const unsigned int i, const number s,
const unsigned int j)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
for (unsigned int k=0; k<n(); ++k)
this->el(k,i) += s*this->el(k,j);
const unsigned int j, const number t,
const unsigned int k)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
for (unsigned int l=0; l<n(); ++l)
this->el(l,i) += s*this->el(l,j) + t*this->el(l,k);
template <typename number>
void FullMatrix<number>::swap_row (const unsigned int i, const unsigned int j)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
number s;
for (unsigned int k=0; k<m(); ++k)
template <typename number>
void FullMatrix<number>::swap_col (const unsigned int i, const unsigned int j)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
number s;
for (unsigned int k=0; k<n(); ++k)
template <typename number>
void FullMatrix<number>::diagadd (const number src)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (m() == n(), ExcDimensionMismatch(m(),n()));
for (unsigned int i=0; i<n(); ++i)
const FullMatrix<number2> &src,
const bool adding) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (n() == src.m(), ExcDimensionMismatch(n(), src.m()));
Assert (dst.n() == src.n(), ExcDimensionMismatch(dst.n(), src.n()));
Assert (dst.m() == m(), ExcDimensionMismatch(m(), dst.m()));
const FullMatrix<number2> &src,
const bool adding) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (m() == src.m(), ExcDimensionMismatch(m(), src.m()));
Assert (n() == dst.m(), ExcDimensionMismatch(n(), dst.m()));
Assert (src.n() == dst.n(), ExcDimensionMismatch(src.n(), dst.n()));
template <typename number2>
number2 FullMatrix<number>::matrix_norm_square (const Vector<number2> &v) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert(m() == v.size(), ExcDimensionMismatch(m(),v.size()));
Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size()));
number2 FullMatrix<number>::matrix_scalar_product (const Vector<number2> &u,
const Vector<number2> &v) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert(m() == u.size(), ExcDimensionMismatch(m(),v.size()));
Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size()));
template <typename number>
number FullMatrix<number>::l1_norm () const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
number sum=0, max=0;
const unsigned int n_rows = m(), n_cols = n();
template <typename number>
number FullMatrix<number>::linfty_norm () const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
number sum=0, max=0;
const unsigned int n_rows = m(), n_cols = n();
const unsigned int w,
const unsigned int p) const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
for (unsigned int i=0; i<this->m(); ++i)
{
FullMatrix<number>::add_scaled (const number s,
const FullMatrix<number2> &src)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (m() == src.m(), ExcDimensionMismatch(m(), src.m()));
Assert (n() == src.n(), ExcDimensionMismatch(n(), src.n()));
void
FullMatrix<number>::add_diag (const number s, const FullMatrix<number2>& src)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (m() == src.m(), ExcDimensionMismatch(m(), src.m()));
Assert (n() == src.n(), ExcDimensionMismatch(n(), src.n()));
void
FullMatrix<number>::Tadd (const number s, const FullMatrix<number2>& src)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (m() == n(), ExcNotQuadratic());
Assert (m() == src.m(), ExcDimensionMismatch(m(), src.m()));
double
FullMatrix<number>::determinant () const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (this->n_cols() == this->n_rows(),
ExcDimensionMismatch(this->n_cols(), this->n_rows()));
number
FullMatrix<number>::norm2 () const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
number s = 0.;
for (unsigned int i=0; i<this->n_rows()*this->n_cols(); ++i)
number
FullMatrix<number>::relative_symmetry_norm2 () const
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
number s = 0.;
number a = 0.;
void
FullMatrix<number>::invert (const FullMatrix<number2> &M)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (this->n_cols() == this->n_rows(),
ExcNotQuadratic());
{
unsigned int width = width_;
- Assert ((this->data() != 0) || (this->n_cols()+this->n_rows()==0),
+ Assert ((!this->empty()) || (this->n_cols()+this->n_rows()==0),
ExcInternalError());
// set output format, but store old
void
FullMatrix<number>::gauss_jordan ()
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
Assert (this->n_cols() == this->n_rows(), ExcNotQuadratic());
// Gauss-Jordan-Algorithmus
void
FullMatrix<number>::householder(Vector<number2>& src)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
// m > n, src.n() = m
Assert (this->n_cols() <= this->n_rows(),
FullMatrix<number>::least_squares (Vector<number2>& dst,
Vector<number2>& src)
{
- Assert (this->data() != 0, ExcEmptyMatrix());
+ Assert (!this->empty(), ExcEmptyMatrix());
// m > n, m = src.n, n = dst.n