From: Guido Kanschat Date: Sun, 6 Mar 2005 03:03:55 +0000 (+0000) Subject: use functions of base class X-Git-Tag: v8.0.0~14516 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ef30559fa8546174bf16f221369cdbb28cf2a8b;p=dealii.git use functions of base class git-svn-id: https://svn.dealii.org/trunk@10012 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index 253207fb81..33e2dc5173 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -80,10 +80,10 @@ template bool FullMatrix::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; @@ -131,7 +131,7 @@ FullMatrix::vmult (Vector& dst, const Vector& 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())); @@ -301,7 +301,7 @@ void FullMatrix::Tvmult (Vector &dst, const Vector &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())); @@ -340,7 +340,7 @@ double FullMatrix::residual (Vector& dst, const Vector& src, const Vector& 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())); @@ -369,7 +369,7 @@ template void FullMatrix::forward (Vector &dst, const Vector &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())); @@ -392,7 +392,7 @@ template void FullMatrix::backward (Vector &dst, const Vector &src) const { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); unsigned int j; unsigned int nu = (m()::add_row (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; kel(i,k) += s*this->el(j,k); @@ -477,7 +477,7 @@ void FullMatrix::add_row (const unsigned int i, 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 void FullMatrix::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; kel(k,i) += s*this->el(k,j); @@ -501,7 +501,7 @@ void FullMatrix::add_col (const unsigned int i, const number s, 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; lel(l,i) += s*this->el(l,j) + t*this->el(l,k); @@ -512,7 +512,7 @@ void FullMatrix::add_col (const unsigned int i, const number s, template void FullMatrix::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::swap_row (const unsigned int i, const unsigned int j) template void FullMatrix::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::swap_col (const unsigned int i, const unsigned int j) template void FullMatrix::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::mmult (FullMatrix &dst, const FullMatrix &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())); @@ -585,7 +585,7 @@ void FullMatrix::Tmmult (FullMatrix &dst, const FullMatrix &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())); @@ -616,7 +616,7 @@ template template number2 FullMatrix::matrix_norm_square (const Vector &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())); @@ -646,7 +646,7 @@ template number2 FullMatrix::matrix_scalar_product (const Vector &u, const Vector &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())); @@ -692,7 +692,7 @@ FullMatrix::symmetrize () template number FullMatrix::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(); @@ -712,7 +712,7 @@ number FullMatrix::l1_norm () const template number FullMatrix::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(); @@ -735,7 +735,7 @@ FullMatrix::print (std::ostream &s, const unsigned int w, const unsigned int p) const { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); for (unsigned int i=0; im(); ++i) { @@ -752,7 +752,7 @@ void FullMatrix::add_scaled (const number s, const FullMatrix &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())); @@ -939,7 +939,7 @@ template void FullMatrix::add_diag (const number s, const FullMatrix& 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())); @@ -1064,7 +1064,7 @@ template void FullMatrix::Tadd (const number s, const FullMatrix& src) { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); Assert (m() == n(), ExcNotQuadratic()); Assert (m() == src.m(), ExcDimensionMismatch(m(), src.m())); @@ -1209,7 +1209,7 @@ template double FullMatrix::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())); @@ -1238,7 +1238,7 @@ template number FullMatrix::norm2 () const { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); number s = 0.; for (unsigned int i=0; in_rows()*this->n_cols(); ++i) @@ -1252,7 +1252,7 @@ template number FullMatrix::relative_symmetry_norm2 () const { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); number s = 0.; number a = 0.; @@ -1274,7 +1274,7 @@ template void FullMatrix::invert (const FullMatrix &M) { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); Assert (this->n_cols() == this->n_rows(), ExcNotQuadratic()); @@ -1466,7 +1466,7 @@ FullMatrix::print_formatted (std::ostream &out, { 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 @@ -1508,7 +1508,7 @@ template void FullMatrix::gauss_jordan () { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); Assert (this->n_cols() == this->n_rows(), ExcNotQuadratic()); // Gauss-Jordan-Algorithmus @@ -1598,7 +1598,7 @@ template void FullMatrix::householder(Vector& src) { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); // m > n, src.n() = m Assert (this->n_cols() <= this->n_rows(), @@ -1644,7 +1644,7 @@ double FullMatrix::least_squares (Vector& dst, Vector& src) { - Assert (this->data() != 0, ExcEmptyMatrix()); + Assert (!this->empty(), ExcEmptyMatrix()); // m > n, m = src.n, n = dst.n