From: Jan Philipp Thiele Date: Sat, 10 Feb 2024 14:59:58 +0000 (+0100) Subject: Add norm_sqr() function to TpetraVector X-Git-Tag: relicensing~54^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c536cfdbb093b8cc1f7221dccbcf90b4dc1b19f;p=dealii.git Add norm_sqr() function to TpetraVector --- diff --git a/include/deal.II/lac/trilinos_tpetra_vector.h b/include/deal.II/lac/trilinos_tpetra_vector.h index d124158394..f84325aa87 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.h @@ -657,6 +657,16 @@ namespace LinearAlgebra real_type linfty_norm() const; + /** + * Return the square of the l2-norm. + */ + real_type + norm_sqr() const; + + /** + * + * + */ /** * Performs a combined operation of a vector addition and a subsequent * inner product, returning the value of the inner product. In other diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h index eed13a0575..b40eadef01 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h @@ -874,6 +874,15 @@ namespace LinearAlgebra + template + typename Vector::real_type + Vector::norm_sqr() const + { + Vector::real_type d = l2_norm(); + return d * d; + } + + template Number Vector::add_and_dot(