Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / math / gmxcomplex.h
index 3faa4b960bdd45329b99e36be8e9759deac02c79..b329647bf1d5af2f5e90a28e838d1e1f8000ee43 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2017,2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -42,7 +42,8 @@
 #include "gromacs/math/vectypes.h"
 #include "gromacs/utility/real.h"
 
-struct t_complex{
+struct t_complex
+{
     real re, im;
 };
 
@@ -52,8 +53,8 @@ static t_complex rcmul(real r, t_complex c)
 {
     t_complex d;
 
-    d.re = r*c.re;
-    d.im = r*c.im;
+    d.re = r * c.re;
+    d.im = r * c.im;
 
     return d;
 }
@@ -73,8 +74,8 @@ static inline t_complex cadd(t_complex a, t_complex b)
 {
     t_complex c;
 
-    c.re = a.re+b.re;
-    c.im = a.im+b.im;
+    c.re = a.re + b.re;
+    c.im = a.im + b.im;
 
     return c;
 }
@@ -83,8 +84,8 @@ static inline t_complex csub(t_complex a, t_complex b)
 {
     t_complex c;
 
-    c.re = a.re-b.re;
-    c.im = a.im-b.im;
+    c.re = a.re - b.re;
+    c.im = a.im - b.im;
 
     return c;
 }
@@ -93,8 +94,8 @@ static t_complex cmul(t_complex a, t_complex b)
 {
     t_complex c;
 
-    c.re = a.re*b.re - a.im*b.im;
-    c.im = a.re*b.im + a.im*b.re;
+    c.re = a.re * b.re - a.im * b.im;
+    c.im = a.re * b.im + a.im * b.re;
 
     return c;
 }
@@ -103,7 +104,7 @@ static t_complex conjugate(t_complex c)
 {
     t_complex d;
 
-    d.re =  c.re;
+    d.re = c.re;
     d.im = -c.im;
 
     return d;
@@ -112,7 +113,7 @@ static t_complex conjugate(t_complex c)
 static inline real cabs2(t_complex c)
 {
     real abs2;
-    abs2 = (c.re*c.re)+(c.im*c.im);
+    abs2 = (c.re * c.re) + (c.im * c.im);
 
     return abs2;
 }
@@ -124,10 +125,16 @@ static inline t_complex cdiv(t_complex teller, t_complex noemer)
     anoemer = cmul(conjugate(noemer), noemer);
     res     = cmul(teller, conjugate(noemer));
 
-    return rcmul(1.0/anoemer.re, res);
+    return rcmul(1.0 / anoemer.re, res);
 }
 
-inline bool operator==(const t_complex &lhs, const t_complex &rhs){ return (lhs.re == rhs.re) && (lhs.im == rhs.im); }
-inline bool operator!=(const t_complex &lhs, const t_complex &rhs){ return !(lhs == rhs); }
+inline bool operator==(const t_complex& lhs, const t_complex& rhs)
+{
+    return (lhs.re == rhs.re) && (lhs.im == rhs.im);
+}
+inline bool operator!=(const t_complex& lhs, const t_complex& rhs)
+{
+    return !(lhs == rhs);
+}
 
 #endif