This is an automated email from the git hooks/post-receive script.

logari81 pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
     new c8ed9342 Style changes
c8ed9342 is described below

commit c8ed934245a182656c57b35db0fe29b275cdbe55
Author: Konstantinos Poulios <logar...@gmail.com>
AuthorDate: Tue Dec 19 02:05:28 2023 +0100

    Style changes
---
 src/getfem/bgeot_config.h         |  8 ++++----
 src/getfem/getfem_config.h        |  4 ++--
 src/getfem/getfem_model_solvers.h |  8 ++++----
 src/gmm/gmm_blas.h                |  3 ++-
 src/gmm/gmm_dense_Householder.h   |  6 +++---
 src/gmm/gmm_dense_lu.h            |  8 ++++----
 src/gmm/gmm_dense_qr.h            | 33 +++++++++++++++------------------
 7 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/src/getfem/bgeot_config.h b/src/getfem/bgeot_config.h
index 939054e5..ee5e7783 100644
--- a/src/getfem/bgeot_config.h
+++ b/src/getfem/bgeot_config.h
@@ -39,7 +39,7 @@
 
 #include "getfem/getfem_arch_config.h"
 
-#ifdef GETFEM_HAVE_FEENABLEEXCEPT
+#if defined(GETFEM_HAVE_FEENABLEEXCEPT)
 # include <fenv.h>
 # define FE_ENABLE_EXCEPT { feenableexcept(FE_DIVBYZERO | FE_INVALID | 
FE_OVERFLOW); }
 #else
@@ -50,9 +50,9 @@
 #include "gmm/gmm_kernel.h"
 #include "gmm/gmm_dense_lu.h"
 
-#ifdef GETFEM_HAVE_QDLIB
+#if defined(GETFEM_HAVE_QDLIB)
 // #  define NO_INLINE
-#  ifdef GETFEM_QDLIB_USE_QUAD
+#  if defined(GETFEM_QDLIB_USE_QUAD)
 #    include <qd/qd_real.h>
 #  else
 #    include <qd/dd_real.h>
@@ -83,7 +83,7 @@ namespace bgeot {
 # define LONG_SCALAR_EPS 1E-16
 # define LONG_SCAL(xx) long_scalar_type(xx)
 #else
-#  ifdef GETFEM_QDLIB_USE_QUAD
+#  if defined(GETFEM_QDLIB_USE_QUAD)
   typedef qd_real long_scalar_type;
   typedef qd_real opt_long_scalar_type;
   inline scalar_type to_scalar(const qd_real &a) { return to_double(a); }
diff --git a/src/getfem/getfem_config.h b/src/getfem/getfem_config.h
index a06821bc..b04219fe 100644
--- a/src/getfem/getfem_config.h
+++ b/src/getfem/getfem_config.h
@@ -160,7 +160,7 @@
 //    0 - Sequential
 //    1 - Only the resolution of linear systems are parallelized
 //    2 - Assembly procedures are also parallelized
-#ifndef GETFEM_PARA_LEVEL
+#if !defined(GETFEM_PARA_LEVEL)
 # define GETFEM_PARA_LEVEL 0
 #endif
 
@@ -168,7 +168,7 @@
 #define GETFEM_MPI_FINALIZE {}
 
 #if defined(GETFEM_HAVE_DMUMPS_C_H)
-# ifndef GMM_USES_MUMPS
+# if !defined(GMM_USES_MUMPS)
 #   define GMM_USES_MUMPS
 # endif
 #endif
diff --git a/src/getfem/getfem_model_solvers.h 
b/src/getfem/getfem_model_solvers.h
index 469896d8..4472bb9e 100644
--- a/src/getfem/getfem_model_solvers.h
+++ b/src/getfem/getfem_model_solvers.h
@@ -168,7 +168,7 @@ namespace getfem {
     }
   };
 
-#ifdef GMM_USES_MUMPS
+#if defined(GMM_USES_MUMPS)
   template <typename MAT, typename VECT>
   struct linear_solver_mumps : public abstract_linear_solver<MAT, VECT> {
     void operator ()(const MAT &M, VECT &x, const VECT &b,
@@ -631,11 +631,11 @@ namespace getfem {
           <linear_solver_distributed_mumps<MATRIX, VECTOR>>();
 #else
     size_type ndof = md.nb_dof(), max3d = 15000, dim = md.leading_dimension();
-# ifdef GMM_USES_MUMPS
+# if defined(GMM_USES_MUMPS)
     max3d = 250000;
 # endif
     if ((ndof<300000 && dim<=2) || (ndof<max3d && dim<=3) || (ndof<1000)) {
-# ifdef GMM_USES_MUMPS
+# if defined(GMM_USES_MUMPS)
       if (md.is_symmetric())
         return std::make_shared<linear_solver_mumps_sym<MATRIX, VECTOR>>();
       else
@@ -670,7 +670,7 @@ namespace getfem {
     else if (bgeot::casecmp(name, "dense_lu") == 0)
       return std::make_shared<linear_solver_dense_lu<MATRIX, VECTOR>>();
     else if (bgeot::casecmp(name, "mumps") == 0) {
-#ifdef GMM_USES_MUMPS
+#if defined(GMM_USES_MUMPS)
 # if GETFEM_PARA_LEVEL <= 1
       return std::make_shared<linear_solver_mumps<MATRIX, VECTOR>>();
 # else
diff --git a/src/gmm/gmm_blas.h b/src/gmm/gmm_blas.h
index 4426bb7d..b8390976 100644
--- a/src/gmm/gmm_blas.h
+++ b/src/gmm/gmm_blas.h
@@ -1568,7 +1568,8 @@ namespace gmm {
       if (it2 == ite2 || i1 < it2.index()) {
         l2[i1] = *it1; ++i1; ++it1;
         if (it1 == ite1) return;
-        it2 = vect_begin(l2); ite2 = vect_end(l2);
+        it2 = vect_begin(l2);
+        ite2 = vect_end(l2);
       }
       if (ie1 > ite2.index()) {
         --ite1; l2[ie1 - 1] = *ite1;
diff --git a/src/gmm/gmm_dense_Householder.h b/src/gmm/gmm_dense_Householder.h
index ea010ed5..31725cfc 100644
--- a/src/gmm/gmm_dense_Householder.h
+++ b/src/gmm/gmm_dense_Householder.h
@@ -245,7 +245,7 @@ namespace gmm {
 
   template <typename MAT1, typename MAT2>
   void Householder_tridiagonalization(const MAT1 &AA, const MAT2 &QQ,
-                                      bool compute_q) {
+                                      bool compute_Q) {
     MAT1 &A = const_cast<MAT1 &>(AA); MAT2 &Q = const_cast<MAT2 &>(QQ);
     typedef typename linalg_traits<MAT1>::value_type T;
     typedef typename number_traits<T>::magnitude_type R;
@@ -267,8 +267,8 @@ namespace gmm {
       gmm::add(p, gmm::scaled(v, -vect_hp(v, p) / norm), w);
       rank_two_update(sub_matrix(A, SUBI), v, w);
       // it should be possible to compute only the upper or lower part
-
-      if (compute_q) col_house_update(sub_matrix(Q, SUBK, SUBI), v, ww);
+      if (compute_Q)
+        col_house_update(sub_matrix(Q, SUBK, SUBI), v, ww);
     }
   }
 
diff --git a/src/gmm/gmm_dense_lu.h b/src/gmm/gmm_dense_lu.h
index 1a8a26bc..1dbb0195 100644
--- a/src/gmm/gmm_dense_lu.h
+++ b/src/gmm/gmm_dense_lu.h
@@ -87,10 +87,10 @@ namespace gmm {
     { return std::vector<size_type>::operator[](i); }
     size_type operator[] (size_type i) const
     { return std::vector<size_type>::operator[](i); }
-    void begin(void) const {}
-    void begin(void) {}
-    void end(void) const {}
-    void end(void) {}
+    void begin() const {}
+    void begin() {}
+    void end() const {}
+    void end() {}
     
   public:
     void set_to_int32() { is_int64 = false; }
diff --git a/src/gmm/gmm_dense_qr.h b/src/gmm/gmm_dense_qr.h
index 1fcf03f5..87611755 100644
--- a/src/gmm/gmm_dense_qr.h
+++ b/src/gmm/gmm_dense_qr.h
@@ -295,7 +295,7 @@ namespace gmm {
 
   template <typename MAT, typename Ttol> inline
   void symmetric_qr_stop_criterion(const MAT &AA, size_type &p, size_type &q,
-                                Ttol tol) {
+                                   Ttol tol) {
     typedef typename linalg_traits<MAT>::value_type T;
     typedef typename number_traits<T>::magnitude_type R;
     R rmin = default_min(R()) * R(2);
@@ -547,16 +547,17 @@ namespace gmm {
   // if A has complex eigenvalues. Complexity about 10n^3, 25n^3 if
   // eigenvectors are computed
   template <typename MAT1, typename VECT, typename MAT2>
-    void implicit_qr_algorithm(const MAT1 &A, const VECT &eigval_,
-                               const MAT2 &Q_,
-                               tol_type_for_qr tol = default_tol_for_qr,
-                               bool compvect = true) {
+  void implicit_qr_algorithm(const MAT1 &A, const VECT &eigval_,
+                             const MAT2 &Q_,
+                             tol_type_for_qr tol = default_tol_for_qr,
+                             bool compvect = true) {
     VECT &eigval = const_cast<VECT &>(eigval_);
     MAT2 &Q = const_cast<MAT2 &>(Q_);
-    typedef typename linalg_traits<MAT1>::value_type value_type;
+    typedef typename linalg_traits<MAT1>::value_type T;
+    typedef typename number_traits<T>::magnitude_type R;
 
     size_type n(mat_nrows(A)), q(0), q_old, p(0), ite(0), its(0);
-    dense_matrix<value_type> H(n,n);
+    dense_matrix<T> H(n,n);
     sub_interval SUBK(0,0);
 
     gmm::copy(A, H);
@@ -572,7 +573,7 @@ namespace gmm {
                                      sub_matrix(Q, SUBJ, SUBK),
                                      tol, (its == 10 || its == 20), compvect);
       q_old = q;
-      qr_stop_criterion(H, p, q, tol*2);
+      qr_stop_criterion(H, p, q, tol*R(2));
       if (q != q_old) its = 0;
       ++its; ++ite;
       GMM_ASSERT1(ite < n*100, "QR algorithm failed");
@@ -581,7 +582,6 @@ namespace gmm {
     extract_eig(H, eigval, tol);
   }
 
-
   template <typename MAT1, typename VECT>
     void implicit_qr_algorithm(const MAT1 &a, VECT &eigval,
                                tol_type_for_qr tol = default_tol_for_qr) {
@@ -594,8 +594,8 @@ namespace gmm {
   /* ********************************************************************* */
 
   template <typename MAT1, typename MAT2>
-    void symmetric_Wilkinson_qr_step(const MAT1& MM, const MAT2 &ZZ,
-                                     bool compute_z) {
+  void symmetric_Wilkinson_qr_step(const MAT1& MM, const MAT2 &ZZ,
+                                   bool compute_z) {
     MAT1& M = const_cast<MAT1&>(MM); MAT2& Z = const_cast<MAT2&>(ZZ);
     typedef typename linalg_traits<MAT1>::value_type T;
     typedef typename number_traits<T>::magnitude_type R;
@@ -631,7 +631,6 @@ namespace gmm {
       if (compute_z) col_rot(Z, c, s, k-1, k);
       if (k < n-1) { x = M(k, k-1); z = M(k+1, k-1); }
     }
-
   }
 
   template <typename VECT1, typename VECT2, typename MAT>
@@ -699,25 +698,23 @@ namespace gmm {
   // complexity about 4n^3/3, 9n^3 if eigenvectors are computed
   template <typename MAT1, typename VECT, typename MAT2>
   void symmetric_qr_algorithm_old(const MAT1 &A, const VECT &eigval_,
-                              const MAT2 &eigvect_,
-                              tol_type_for_qr tol = default_tol_for_qr,
-                              bool compvect = true) {
+                                  const MAT2 &eigvect_,
+                                  tol_type_for_qr tol = default_tol_for_qr,
+                                  bool compvect = true) {
     VECT &eigval = const_cast<VECT &>(eigval_);
     MAT2 &eigvect = const_cast<MAT2 &>(eigvect_);
     typedef typename linalg_traits<MAT1>::value_type T;
     typedef typename number_traits<T>::magnitude_type R;
 
-    if (compvect) gmm::copy(identity_matrix(), eigvect);
     size_type n = mat_nrows(A), q = 0, p, ite = 0;
     dense_matrix<T> Tri(n, n);
     gmm::copy(A, Tri);
 
+    if (compvect) gmm::copy(identity_matrix(), eigvect);
     Householder_tridiagonalization(Tri, eigvect, compvect);
-
     symmetric_qr_stop_criterion(Tri, p, q, tol);
 
     while (q < n) {
-
       sub_interval SUBI(p, n-p-q), SUBJ(0, mat_ncols(eigvect)), SUBK(p, n-p-q);
       if (!compvect) SUBK = sub_interval(0,0);
       symmetric_Wilkinson_qr_step(sub_matrix(Tri, SUBI),

Reply via email to