From: Wolfgang Bangerth Date: Tue, 7 Apr 1998 14:04:47 +0000 (+0000) Subject: Add some norms to the dVector class. X-Git-Tag: v8.0.0~23101 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcbaaaceb19015a5707765d11c319cb50b1e56a4;p=dealii.git Add some norms to the dVector class. git-svn-id: https://svn.dealii.org/trunk@153 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/dvector.h b/deal.II/lac/include/lac/dvector.h index 33a08d319b..c593ca6e75 100644 --- a/deal.II/lac/include/lac/dvector.h +++ b/deal.II/lac/include/lac/dvector.h @@ -117,6 +117,12 @@ class dVector : public VectorBase * squares of the elements. */ double l2_norm () const; + + /** + * Return the maximum absolute value of the + * elements of this vector. + */ + double linfty_norm () const; /** diff --git a/deal.II/lac/source/dvector.cc b/deal.II/lac/source/dvector.cc index 9ede32ce1b..57de951301 100644 --- a/deal.II/lac/source/dvector.cc +++ b/deal.II/lac/source/dvector.cc @@ -6,6 +6,7 @@ #include #include +#include dVector::dVector () : dim(0), @@ -226,6 +227,30 @@ double dVector::l2_norm () const +double dVector::linfty_norm () const { + double max0=0., + max1=0., + max2=0., + max3=0.; + for (unsigned int i=0; i<(dim/4); ++i) + { + if (max0