]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add norm_sqr() function to TpetraVector
authorJan Philipp Thiele <thiele@wias-berlin.de>
Sat, 10 Feb 2024 14:59:58 +0000 (15:59 +0100)
committerJan Philipp Thiele <thiele@wias-berlin.de>
Sat, 10 Feb 2024 14:59:58 +0000 (15:59 +0100)
include/deal.II/lac/trilinos_tpetra_vector.h
include/deal.II/lac/trilinos_tpetra_vector.templates.h

index d1241583941fececeaec5607a120b5c60c325bcc..f84325aa870245c228aec2b991b4a776f23a19c0 100644 (file)
@@ -657,6 +657,16 @@ namespace LinearAlgebra
       real_type
       linfty_norm() const;
 
+      /**
+       * Return the square of the l<sub>2</sub>-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
index eed13a0575f616c3786b9b9d77c8590d1e075429..b40eadef01f7770e3858f9e58b0c63847dc955cd 100644 (file)
@@ -874,6 +874,15 @@ namespace LinearAlgebra
 
 
 
+    template <typename Number, typename MemorySpace>
+    typename Vector<Number, MemorySpace>::real_type
+    Vector<Number, MemorySpace>::norm_sqr() const
+    {
+      Vector<Number, MemorySpace>::real_type d = l2_norm();
+      return d * d;
+    }
+
+
     template <typename Number, typename MemorySpace>
     Number
     Vector<Number, MemorySpace>::add_and_dot(

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


Typeset in Trocchi and Trocchi Bold Sans Serif.