diff --git a/mex/sources/bytecode/BasicSymbolTable.hh b/mex/sources/bytecode/BasicSymbolTable.hh
index 31a39ead4b0d81f091e561af891d2668774658e2..e578b3fd7fcc9140016cd160e6978fc9fe0bd292 100644
--- a/mex/sources/bytecode/BasicSymbolTable.hh
+++ b/mex/sources/bytecode/BasicSymbolTable.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _BASIC_SYMBOL_TABLE_HH
-#define _BASIC_SYMBOL_TABLE_HH
+#ifndef BASIC_SYMBOL_TABLE_HH
+#define BASIC_SYMBOL_TABLE_HH
 
 #include <map>
 #include <string>
@@ -44,4 +44,4 @@ private:
   map<string, pair<SymbolType, int>> name_to_id_and_type;
 };
 
-#endif // _BASIC_SYMBOL_TABLE_HH
+#endif
diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh
index 49ec933eb260c317bcfa83a4929741506c8f834d..066c4f79c266df24f6ff61cc7813bd3a76e6939f 100644
--- a/mex/sources/bytecode/ErrorHandling.hh
+++ b/mex/sources/bytecode/ErrorHandling.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2007-2022 Dynare Team
+ * Copyright © 2007-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _ERROR_HANDLING_HH
-#define _ERROR_HANDLING_HH
+#ifndef ERROR_HANDLING_HH
+#define ERROR_HANDLING_HH
 
 #include <cmath>
 #include <sstream>
@@ -111,4 +111,4 @@ test_mxMalloc(void* z, int line, const string& file, const string& func, int amo
 extern "C" bool utIsInterruptPending();
 #endif
 
-#endif // _ERROR_HANDLING_HH
+#endif
diff --git a/mex/sources/bytecode/Evaluate.hh b/mex/sources/bytecode/Evaluate.hh
index bb5d2a00830848bf99294c953f31a17b292153a6..0903dfd13eddc708fc8f8903981f8688af63bc70 100644
--- a/mex/sources/bytecode/Evaluate.hh
+++ b/mex/sources/bytecode/Evaluate.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _EVALUATE_HH
-#define _EVALUATE_HH
+#ifndef EVALUATE_HH
+#define EVALUATE_HH
 
 #include <deque>
 #include <filesystem>
@@ -170,4 +170,4 @@ public:
   }
 };
 
-#endif // _EVALUATE_HH
+#endif
diff --git a/mex/sources/bytecode/Interpreter.hh b/mex/sources/bytecode/Interpreter.hh
index 1a59c7535d9dc26ccdef60c6ca0c17cbabecd824..857b8584c29c8f128c77ede5ef0e99f996f445fc 100644
--- a/mex/sources/bytecode/Interpreter.hh
+++ b/mex/sources/bytecode/Interpreter.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _INTERPRETER_HH
-#define _INTERPRETER_HH
+#ifndef INTERPRETER_HH
+#define INTERPRETER_HH
 
 #include <cstddef>
 #include <fstream>
@@ -287,4 +287,4 @@ public:
   }
 };
 
-#endif // _INTERPRETER_HH
+#endif
diff --git a/mex/sources/bytecode/Mem_Mngr.hh b/mex/sources/bytecode/Mem_Mngr.hh
index 9ba250ca1bc3d039d14cfebadb655773856e67fd..7b0d0de65111b187f3cd553fae62f4c14603ebe4 100644
--- a/mex/sources/bytecode/Mem_Mngr.hh
+++ b/mex/sources/bytecode/Mem_Mngr.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2007-2021 Dynare Team
+ * Copyright © 2007-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _MEM_MNGR_HH
-#define _MEM_MNGR_HH
+#ifndef MEM_MNGR_HH
+#define MEM_MNGR_HH
 
 #include <fstream>
 #include <string>
@@ -61,4 +61,4 @@ private:
   string filename_mem;
 };
 
-#endif // _MEM_MNGR_HH
+#endif
diff --git a/mex/sources/dynblas.h b/mex/sources/dynblas.h
index 6956fd30e47703da2acc84b55b51a10faf1958e7..5c5c1aaa9dd2a96d4f2d4c1d621dc81413fbeb40 100644
--- a/mex/sources/dynblas.h
+++ b/mex/sources/dynblas.h
@@ -26,8 +26,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _DYNBLAS_H
-#define _DYNBLAS_H
+#ifndef DYNBLAS_H
+#define DYNBLAS_H
 
 #if defined(MATLAB_MEX_FILE) && __SIZEOF_POINTER__ == 8
 # ifdef __cplusplus
@@ -134,4 +134,4 @@ extern "C"
 } /* extern "C" */
 #endif
 
-#endif /* _DYNBLAS_H */
+#endif
diff --git a/mex/sources/dynlapack.h b/mex/sources/dynlapack.h
index d17ed955a059c3563bcf172b49ef213b6c155d0c..f9174381b223e1efae18f9c00e090fe45e3d71c8 100644
--- a/mex/sources/dynlapack.h
+++ b/mex/sources/dynlapack.h
@@ -26,8 +26,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _DYNLAPACK_H
-#define _DYNLAPACK_H
+#ifndef DYNLAPACK_H
+#define DYNLAPACK_H
 
 #if defined(MATLAB_MEX_FILE) && __SIZEOF_POINTER__ == 8
 # ifdef __cplusplus
@@ -231,4 +231,4 @@ extern "C"
 } /* extern "C" */
 #endif
 
-#endif /* _DYNLAPACK_H */
+#endif
diff --git a/mex/sources/dynmex.h b/mex/sources/dynmex.h
index c7a8395987af16115e68c2af482763cb3baba81c..f555615e7b20fed16e5f925943b040d53fdc7ee7 100644
--- a/mex/sources/dynmex.h
+++ b/mex/sources/dynmex.h
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _DYNMEX_H
-#define _DYNMEX_H
+#ifndef DYNMEX_H
+#define DYNMEX_H
 
 #if !defined(MATLAB_MEX_FILE) && !defined(OCTAVE_MEX_FILE)
 # error You must define either MATLAB_MEX_FILE or OCTAVE_MEX_FILE
diff --git a/mex/sources/dynumfpack.h b/mex/sources/dynumfpack.h
index 6597c2f2f10b39ae6710dd4ca35b04480596470d..ae3e11c94be51cbf9ee7249db80526712e55e469 100644
--- a/mex/sources/dynumfpack.h
+++ b/mex/sources/dynumfpack.h
@@ -21,8 +21,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _DYNUMFPACK_H
-#define _DYNUMFPACK_H
+#ifndef DYNUMFPACK_H
+#define DYNUMFPACK_H
 
 #ifdef OCTAVE_MEX_FILE
 # ifdef HAVE_SUITESPARSE_UMFPACK_H
@@ -108,4 +108,4 @@ typedef long SuiteSparse_long;
 # endif
 
 #endif // OCTAVE_MEX_FILE
-#endif /* DYNUMFPACK */
+#endif
diff --git a/mex/sources/k_order_welfare/approximation_welfare.hh b/mex/sources/k_order_welfare/approximation_welfare.hh
index 5fd4fcb6864c702640204a9746b7d30daed2d4b6..1badac67c69531c53406cf3d47fa2df0ec796eb6 100644
--- a/mex/sources/k_order_welfare/approximation_welfare.hh
+++ b/mex/sources/k_order_welfare/approximation_welfare.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef APPROXIMATION_WELFARE_H
-#define APPROXIMATION_WELFARE_H
+#ifndef APPROXIMATION_WELFARE_HH
+#define APPROXIMATION_WELFARE_HH
 
 #include "journal.hh"
 #include "k_ord_objective.hh"
diff --git a/mex/sources/k_order_welfare/k_ord_objective.hh b/mex/sources/k_order_welfare/k_ord_objective.hh
index 288f39b69839108ffd72beae615e352f2435c8ea..71b0a38f56671f2e1f14ca3d56d6d6e916cb8fee 100644
--- a/mex/sources/k_order_welfare/k_ord_objective.hh
+++ b/mex/sources/k_order_welfare/k_ord_objective.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef K_ORD_OBJECTIVE_H
-#define K_ORD_OBJECTIVE_H
+#ifndef K_ORD_OBJECTIVE_HH
+#define K_ORD_OBJECTIVE_HH
 
 #include "k_ord_dynare.hh"
 #include "objective_abstract_class.hh"
diff --git a/mex/sources/k_order_welfare/objective_abstract_class.hh b/mex/sources/k_order_welfare/objective_abstract_class.hh
index 83a3ac98ac056eb8023fda48a48a702a2e689379..6dd7a3dfe87d5a2ccc966b3258a73bdc2cee5e1a 100644
--- a/mex/sources/k_order_welfare/objective_abstract_class.hh
+++ b/mex/sources/k_order_welfare/objective_abstract_class.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2021 Dynare Team
+ * Copyright © 2021-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _OBJECTIVEAC_HH
-#define _OBJECTIVEAC_HH
+#ifndef OBJECTIVE_ABSTRACT_CLASS_HH
+#define OBJECTIVE_ABSTRACT_CLASS_HH
 
 #include <vector>
 
diff --git a/mex/sources/k_order_welfare/objective_m.hh b/mex/sources/k_order_welfare/objective_m.hh
index fec3ce89ae2c2e6c494431a955353b3a6d1b51b3..4de2aec51c55ba0bf68c6d150804e8389e2e4ca4 100644
--- a/mex/sources/k_order_welfare/objective_m.hh
+++ b/mex/sources/k_order_welfare/objective_m.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _OBJECTIVE_M_HH
-#define _OBJECTIVE_M_HH
+#ifndef OBJECTIVE_M_HH
+#define OBJECTIVE_M_HH
 
 #include "objective_abstract_class.hh"
 
diff --git a/mex/sources/libkorder/dynamic_abstract_class.hh b/mex/sources/libkorder/dynamic_abstract_class.hh
index b4928010dcb1968bdc03d43623ebf6384057ec0d..951e845bfff3284255f9e704b3810e7ce49bd976 100644
--- a/mex/sources/libkorder/dynamic_abstract_class.hh
+++ b/mex/sources/libkorder/dynamic_abstract_class.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2019 Dynare Team
+ * Copyright © 2010-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _DYNAMICMODELAC_HH
-#define _DYNAMICMODELAC_HH
+#ifndef DYNAMIC_ABSTRACT_CLASS_HH
+#define DYNAMIC_ABSTRACT_CLASS_HH
 
 #include <vector>
 
diff --git a/mex/sources/libkorder/dynamic_dll.hh b/mex/sources/libkorder/dynamic_dll.hh
index 7b8af3f68b02beebc6fb30149d82e3cf043dcf07..8eca28d9caa257a752e2694e67b663c96602eb06 100644
--- a/mex/sources/libkorder/dynamic_dll.hh
+++ b/mex/sources/libkorder/dynamic_dll.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _DYNAMIC_DLL_HH
-#define _DYNAMIC_DLL_HH
+#ifndef DYNAMIC_DLL_HH
+#define DYNAMIC_DLL_HH
 
 #if defined(_WIN32) || defined(__CYGWIN32__)
 # ifndef NOMINMAX
diff --git a/mex/sources/libkorder/dynamic_m.hh b/mex/sources/libkorder/dynamic_m.hh
index 697686f0afb62d77bbafcdefc043d6667c01d279..bf89e984758a2906a9f2636a105c2d006331396d 100644
--- a/mex/sources/libkorder/dynamic_m.hh
+++ b/mex/sources/libkorder/dynamic_m.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _DYNAMIC_M_HH
-#define _DYNAMIC_M_HH
+#ifndef DYNAMIC_M_HH
+#define DYNAMIC_M_HH
 
 #include "dynamic_abstract_class.hh"
 
diff --git a/mex/sources/libkorder/k_ord_dynare.hh b/mex/sources/libkorder/k_ord_dynare.hh
index 0e7a53d42d8155899e1e2c473ceb96ec0a7fec0d..6d45ce82c340d1cbd572bc2f6c0a9fd0ca436784 100644
--- a/mex/sources/libkorder/k_ord_dynare.hh
+++ b/mex/sources/libkorder/k_ord_dynare.hh
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef K_ORD_DYNARE3_H
-#define K_ORD_DYNARE3_H
+#ifndef K_ORD_DYNARE_HH
+#define K_ORD_DYNARE_HH
 
 #include <memory>
 #include <string>
diff --git a/mex/sources/libkorder/kord/approximation.hh b/mex/sources/libkorder/kord/approximation.hh
index 4ffff1f10713e99c85684825f1fe6e85363b7397..48d58e035fbd5dbe45d38e7ed50a5ae1e740283c 100644
--- a/mex/sources/libkorder/kord/approximation.hh
+++ b/mex/sources/libkorder/kord/approximation.hh
@@ -61,8 +61,8 @@
    calculate also its unfolded versions, to be available for simulations
    and so on. */
 
-#ifndef APPROXIMATION_H
-#define APPROXIMATION_H
+#ifndef APPROXIMATION_HH
+#define APPROXIMATION_HH
 
 #include "decision_rule.hh"
 #include "dynamic_model.hh"
diff --git a/mex/sources/libkorder/kord/decision_rule.hh b/mex/sources/libkorder/kord/decision_rule.hh
index 4e712ea0d70faaa65c55c4c2e7efb1d2623ee9f8..877fd5e59b90a93e3957399358d0a183662a2d72 100644
--- a/mex/sources/libkorder/kord/decision_rule.hh
+++ b/mex/sources/libkorder/kord/decision_rule.hh
@@ -32,8 +32,8 @@
    DRFixPoint allows for calculation of the fix point of a given decision
    rule. */
 
-#ifndef DECISION_RULE_H
-#define DECISION_RULE_H
+#ifndef DECISION_RULE_HH
+#define DECISION_RULE_HH
 
 #include "kord_exception.hh"
 #include "korder.hh"
diff --git a/mex/sources/libkorder/kord/dynamic_model.hh b/mex/sources/libkorder/kord/dynamic_model.hh
index da1103468bce9b62f70a8952cd140bc1f9556da5..09b0d9632253a103a112513892a7e3de28d6c8f1 100644
--- a/mex/sources/libkorder/kord/dynamic_model.hh
+++ b/mex/sources/libkorder/kord/dynamic_model.hh
@@ -27,8 +27,8 @@
 
    The interface is defined via pure virtual class DynamicModel. */
 
-#ifndef DYNAMIC_MODEL_H
-#define DYNAMIC_MODEL_H
+#ifndef DYNAMIC_MODEL_HH
+#define DYNAMIC_MODEL_HH
 
 #include "sparse_tensor.hh"
 #include "t_container.hh"
diff --git a/mex/sources/libkorder/kord/faa_di_bruno.hh b/mex/sources/libkorder/kord/faa_di_bruno.hh
index 1e3902b8ad020e1d259ae620b3a2e838abff8b50..c9b320a535747cf22f5fb73c7f0b5b9b9cbb0304 100644
--- a/mex/sources/libkorder/kord/faa_di_bruno.hh
+++ b/mex/sources/libkorder/kord/faa_di_bruno.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2005 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -29,8 +29,8 @@
    where sᵏ is a general symmetry of dimension k and z is a stack of
    functions. */
 
-#ifndef FAA_DI_BRUNO_H
-#define FAA_DI_BRUNO_H
+#ifndef FAA_DI_BRUNO_HH
+#define FAA_DI_BRUNO_HH
 
 #include "gs_tensor.hh"
 #include "journal.hh"
diff --git a/mex/sources/libkorder/kord/first_order.hh b/mex/sources/libkorder/kord/first_order.hh
index fde9009b526294416ea38f73a2d39a2cb5496d89..5b6e9d1e49a1c63d6ca903a08586c5b79548566a 100644
--- a/mex/sources/libkorder/kord/first_order.hh
+++ b/mex/sources/libkorder/kord/first_order.hh
@@ -20,8 +20,8 @@
 
 // First order at deterministic steady state
 
-#ifndef FIRST_ORDER_H
-#define FIRST_ORDER_H
+#ifndef FIRST_ORDER_HH
+#define FIRST_ORDER_HH
 
 #include "korder.hh"
 
diff --git a/mex/sources/libkorder/kord/journal.hh b/mex/sources/libkorder/kord/journal.hh
index 5e18a54146c4043763e3bc97b2740e4f68dc5733..965dd25ff33ec2f0ea6ed40e2157c41c335c619c 100644
--- a/mex/sources/libkorder/kord/journal.hh
+++ b/mex/sources/libkorder/kord/journal.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 Ondra Kamenik
- * Copyright © 2019-2020 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -20,8 +20,8 @@
 
 // Resource usage journal
 
-#ifndef JOURNAL_H
-#define JOURNAL_H
+#ifndef JOURNAL_HH
+#define JOURNAL_HH
 
 #include "int_sequence.hh"
 
diff --git a/mex/sources/libkorder/kord/kord_exception.hh b/mex/sources/libkorder/kord/kord_exception.hh
index 343756e9c0f9380045b07f4e8fa777c9e650d0d3..83508ab924063d054df661360a71e48e7d75a38c 100644
--- a/mex/sources/libkorder/kord/kord_exception.hh
+++ b/mex/sources/libkorder/kord/kord_exception.hh
@@ -22,23 +22,23 @@
 
 /* This is a simple code defining an exception and two convenience macros. */
 
+#ifndef KORD_EXCEPTION_HH
+#define KORD_EXCEPTION_HH
+
 #include <iostream>
 #include <string>
 
-#ifndef KORD_EXCEPTION_H
-# define KORD_EXCEPTION_H
-
-# define KORD_RAISE(mes) throw KordException(__FILE__, __LINE__, mes);
+#define KORD_RAISE(mes) throw KordException(__FILE__, __LINE__, mes);
 
-# define KORD_RAISE_IF(expr, mes)                                                                  \
-  if (expr)                                                                                        \
-   throw KordException(__FILE__, __LINE__, mes);
+#define KORD_RAISE_IF(expr, mes)                                                                   \
+ if (expr)                                                                                         \
+  throw KordException(__FILE__, __LINE__, mes);
 
-# define KORD_RAISE_X(mes, c) throw KordException(__FILE__, __LINE__, mes, c);
+#define KORD_RAISE_X(mes, c) throw KordException(__FILE__, __LINE__, mes, c);
 
-# define KORD_RAISE_IF_X(expr, mes, c)                                                             \
-  if (expr)                                                                                        \
-   throw KordException(__FILE__, __LINE__, mes, c);
+#define KORD_RAISE_IF_X(expr, mes, c)                                                              \
+ if (expr)                                                                                         \
+  throw KordException(__FILE__, __LINE__, mes, c);
 
 class KordException
 {
diff --git a/mex/sources/libkorder/kord/korder.hh b/mex/sources/libkorder/kord/korder.hh
index d4d8b3c5ae7aad3ebeb068c9ef01a664575b93a3..5d6fd8c1a5083961f783c0c1686f62e779fbc64a 100644
--- a/mex/sources/libkorder/kord/korder.hh
+++ b/mex/sources/libkorder/kord/korder.hh
@@ -38,8 +38,8 @@
    PartitionY, MatrixA, MatrixS and MatrixB.
 */
 
-#ifndef KORDER_H
-#define KORDER_H
+#ifndef KORDER_HH
+#define KORDER_HH
 
 #include "faa_di_bruno.hh"
 #include "fs_tensor.hh"
diff --git a/mex/sources/libkorder/kord/korder_stoch.hh b/mex/sources/libkorder/kord/korder_stoch.hh
index 011f3f0150724b0696526fd005c6d0023a0e0406..48f324043d49904affd6160a22e795e67efa25a8 100644
--- a/mex/sources/libkorder/kord/korder_stoch.hh
+++ b/mex/sources/libkorder/kord/korder_stoch.hh
@@ -38,6 +38,9 @@
    h as an extrapolation based on an approximation to g at lower σ.
 */
 
+#ifndef KORDER_STOCH_HH
+#define KORDER_STOCH_HH
+
 #include <memory>
 
 #include "faa_di_bruno.hh"
@@ -573,3 +576,5 @@ KOrderStoch::performStep(int order)
         Gstack<t>().multAndAdd(1, h<t>(), *G_sym_ptr);
       }
 }
+
+#endif
diff --git a/mex/sources/libkorder/sylv/BlockDiagonal.hh b/mex/sources/libkorder/sylv/BlockDiagonal.hh
index 41e9522c36884c89032c64143ebaf0df05f07987..12dedecb6054aff15bd8e7e4dda4ed0820bc9f7e 100644
--- a/mex/sources/libkorder/sylv/BlockDiagonal.hh
+++ b/mex/sources/libkorder/sylv/BlockDiagonal.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef BLOCK_DIAGONAL_H
-#define BLOCK_DIAGONAL_H
+#ifndef BLOCK_DIAGONAL_HH
+#define BLOCK_DIAGONAL_HH
 
 #include <memory>
 #include <vector>
@@ -70,4 +70,4 @@ private:
                           Vector& work) const;
 };
 
-#endif /* BLOCK_DIAGONAL_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/GeneralMatrix.hh b/mex/sources/libkorder/sylv/GeneralMatrix.hh
index 097181b1a701e7efd42df24f5f051cc825cbcfb9..aec8c139e0a02b78a68aeea2b4dc46d606ae61ec 100644
--- a/mex/sources/libkorder/sylv/GeneralMatrix.hh
+++ b/mex/sources/libkorder/sylv/GeneralMatrix.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef GENERAL_MATRIX_H
-#define GENERAL_MATRIX_H
+#ifndef GENERAL_MATRIX_HH
+#define GENERAL_MATRIX_HH
 
 #include "SylvException.hh"
 #include "Vector.hh"
@@ -611,4 +611,4 @@ private:
   void construct(const GeneralMatrix& A);
 };
 
-#endif /* GENERAL_MATRIX_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/GeneralSylvester.hh b/mex/sources/libkorder/sylv/GeneralSylvester.hh
index 76d626a2edf0a88f6daf4313fb646a1d8a453026..910311ab28eee2af8790cc1cb04d3b55b305a112 100644
--- a/mex/sources/libkorder/sylv/GeneralSylvester.hh
+++ b/mex/sources/libkorder/sylv/GeneralSylvester.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef GENERAL_SYLVESTER_H
-#define GENERAL_SYLVESTER_H
+#ifndef GENERAL_SYLVESTER_HH
+#define GENERAL_SYLVESTER_HH
 
 #include "SimilarityDecomp.hh"
 #include "SylvMatrix.hh"
@@ -87,4 +87,4 @@ private:
   void init();
 };
 
-#endif /* GENERAL_SYLVESTER_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/IterativeSylvester.hh b/mex/sources/libkorder/sylv/IterativeSylvester.hh
index 85ad47a0d49ec0e4a731101198b2cc08fb5d03bc..acc58a247f6aa97fc76b3b6b43fab7293c941c9e 100644
--- a/mex/sources/libkorder/sylv/IterativeSylvester.hh
+++ b/mex/sources/libkorder/sylv/IterativeSylvester.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004-2011 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef ITERATIVE_SYLVESTER_H
-#define ITERATIVE_SYLVESTER_H
+#ifndef ITERATIVE_SYLVESTER_HH
+#define ITERATIVE_SYLVESTER_HH
 
 #include "KronVector.hh"
 #include "QuasiTriangular.hh"
@@ -47,4 +47,4 @@ private:
   static double performStep(const QuasiTriangular& k, const QuasiTriangular& f, KronVector& x);
 };
 
-#endif /* ITERATIVE_SYLVESTER_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/KronUtils.hh b/mex/sources/libkorder/sylv/KronUtils.hh
index cfa1d1bc96b72f67d0eaeabfd11e412e07ca9da0..3125c88bc82142bd722f19908ce157a44862e450 100644
--- a/mex/sources/libkorder/sylv/KronUtils.hh
+++ b/mex/sources/libkorder/sylv/KronUtils.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004-2011 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef KRON_UTILS_H
-#define KRON_UTILS_H
+#ifndef KRON_UTILS_HH
+#define KRON_UTILS_HH
 
 #include "KronVector.hh"
 #include "QuasiTriangular.hh"
@@ -38,4 +38,4 @@ public:
   static void multKron(const QuasiTriangular& f, const QuasiTriangular& k, KronVector& x);
 };
 
-#endif /* KRON_UTILS_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/KronVector.hh b/mex/sources/libkorder/sylv/KronVector.hh
index 054053994510164631cf52af07c4046c66446d0f..6cb0bb1ddb3a54d0d7ea713e41533c2c864d61f1 100644
--- a/mex/sources/libkorder/sylv/KronVector.hh
+++ b/mex/sources/libkorder/sylv/KronVector.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef KRON_VECTOR_H
-#define KRON_VECTOR_H
+#ifndef KRON_VECTOR_HH
+#define KRON_VECTOR_HH
 
 #include "Vector.hh"
 
@@ -101,4 +101,4 @@ public:
   }
 };
 
-#endif /* KRON_VECTOR */
+#endif
diff --git a/mex/sources/libkorder/sylv/QuasiTriangular.hh b/mex/sources/libkorder/sylv/QuasiTriangular.hh
index 6b46a4d7c4c782368f5a97b30f321ad797ae82b8..a719a0408f6053ea13029608414c2628f8fae72e 100644
--- a/mex/sources/libkorder/sylv/QuasiTriangular.hh
+++ b/mex/sources/libkorder/sylv/QuasiTriangular.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef QUASI_TRIANGULAR_H
-#define QUASI_TRIANGULAR_H
+#ifndef QUASI_TRIANGULAR_HH
+#define QUASI_TRIANGULAR_HH
 
 #include "KronVector.hh"
 #include "SylvMatrix.hh"
@@ -472,4 +472,4 @@ private:
   void multsVecTrans(Vector& x, const ConstVector& d) const;
 };
 
-#endif /* QUASI_TRIANGULAR_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/QuasiTriangularZero.hh b/mex/sources/libkorder/sylv/QuasiTriangularZero.hh
index bea53024fdc4e1b886faa97db6e342310b0388d8..acc0b1eeaf1714711e5270310c0d750b9bc45fd2 100644
--- a/mex/sources/libkorder/sylv/QuasiTriangularZero.hh
+++ b/mex/sources/libkorder/sylv/QuasiTriangularZero.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef QUASI_TRIANGULAR_ZERO_H
-#define QUASI_TRIANGULAR_ZERO_H
+#ifndef QUASI_TRIANGULAR_ZERO_HH
+#define QUASI_TRIANGULAR_ZERO_HH
 
 #include "GeneralMatrix.hh"
 #include "QuasiTriangular.hh"
@@ -84,4 +84,4 @@ public:
   void print() const override;
 };
 
-#endif /* QUASI_TRIANGULAR_ZERO_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SchurDecomp.hh b/mex/sources/libkorder/sylv/SchurDecomp.hh
index ee3ffc60836537646649ed3616b6031d5fe3ab28..0c5b9d9672ad91bc89b8a88346f501c753950b4d 100644
--- a/mex/sources/libkorder/sylv/SchurDecomp.hh
+++ b/mex/sources/libkorder/sylv/SchurDecomp.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef SCHUR_DECOMP_H
-#define SCHUR_DECOMP_H
+#ifndef SCHUR_DECOMP_HH
+#define SCHUR_DECOMP_HH
 
 #include "QuasiTriangular.hh"
 #include "SylvMatrix.hh"
@@ -80,4 +80,4 @@ public:
   }
 };
 
-#endif /* SCHUR_DECOMP_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SchurDecompEig.hh b/mex/sources/libkorder/sylv/SchurDecompEig.hh
index 63967d769bd1bb756b9aebc0983f0efedf541a9a..c5a74c47bada0e0f4d6f432e6c57f302be5582fc 100644
--- a/mex/sources/libkorder/sylv/SchurDecompEig.hh
+++ b/mex/sources/libkorder/sylv/SchurDecompEig.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004-2011 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -20,8 +20,8 @@
 
 // contains algorithms for eigenvalue reordering
 
-#ifndef SCHUR_DECOMP_EIG_H
-#define SCHUR_DECOMP_EIG_H
+#ifndef SCHUR_DECOMP_EIG_HH
+#define SCHUR_DECOMP_EIG_HH
 
 #include "QuasiTriangular.hh"
 #include "SchurDecomp.hh"
@@ -44,4 +44,4 @@ protected:
   bool tryToSwap(diag_iter& it, diag_iter& itadd);
 };
 
-#endif /* SCHUR_DECOMP_EIG_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SimilarityDecomp.hh b/mex/sources/libkorder/sylv/SimilarityDecomp.hh
index 77e8bdf0ba664cad78d287ada9f7305255e1ea0a..dabbd395d91d42fc090fa14642cf024a8bbb2e3d 100644
--- a/mex/sources/libkorder/sylv/SimilarityDecomp.hh
+++ b/mex/sources/libkorder/sylv/SimilarityDecomp.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef SIMILARITY_DECOMP_H
-#define SIMILARITY_DECOMP_H
+#ifndef SIMILARITY_DECOMP_HH
+#define SIMILARITY_DECOMP_HH
 
 #include "BlockDiagonal.hh"
 #include "SylvMatrix.hh"
@@ -63,4 +63,4 @@ protected:
   void diagonalize(double norm);
 };
 
-#endif /* SIMILARITY_DECOMP_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SylvException.hh b/mex/sources/libkorder/sylv/SylvException.hh
index c7fd0c422f5e56af1af391132cc7f4c6d2156a1a..b18bf53e58d3dbc0c62030898ca810b579d071d6 100644
--- a/mex/sources/libkorder/sylv/SylvException.hh
+++ b/mex/sources/libkorder/sylv/SylvException.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef SYLV_EXCEPTION_H
-#define SYLV_EXCEPTION_H
+#ifndef SYLV_EXCEPTION_HH
+#define SYLV_EXCEPTION_HH
 
 #include <string>
 
@@ -48,4 +48,4 @@ public:
 // define macros:
 #define SYLV_MES_EXCEPTION(mes) (SylvExceptionMessage(__FILE__, __LINE__, mes))
 
-#endif /* SYLV_EXCEPTION_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SylvMatrix.hh b/mex/sources/libkorder/sylv/SylvMatrix.hh
index c5ae4185b0cdc2907d83fd52ce027d78ab8f90cb..eaaa0500ba451dd8dd2d70f959726d2ffc143fab 100644
--- a/mex/sources/libkorder/sylv/SylvMatrix.hh
+++ b/mex/sources/libkorder/sylv/SylvMatrix.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004-2011 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef SYLV_MATRIX_H
-#define SYLV_MATRIX_H
+#ifndef SYLV_MATRIX_HH
+#define SYLV_MATRIX_HH
 
 #include "GeneralMatrix.hh"
 #include "KronVector.hh"
@@ -105,4 +105,4 @@ public:
   void setUnit();
 };
 
-#endif /* SYLV_MATRIX_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SylvParams.hh b/mex/sources/libkorder/sylv/SylvParams.hh
index 0f4204bf78ca2db1c57a665f2cbc6c91b1b0ecca..21e6a800c534f88712d956d4fa98d0deddb43b15 100644
--- a/mex/sources/libkorder/sylv/SylvParams.hh
+++ b/mex/sources/libkorder/sylv/SylvParams.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef SYLV_PARAMS_H
-#define SYLV_PARAMS_H
+#ifndef SYLV_PARAMS_HH
+#define SYLV_PARAMS_HH
 
 #include <ostream>
 #include <string>
@@ -235,4 +235,4 @@ operator<<(std::ostream& out, SylvParams::solve_method m)
   return out;
 }
 
-#endif /* SYLV_PARAMS_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SylvesterSolver.hh b/mex/sources/libkorder/sylv/SylvesterSolver.hh
index 9543ffce6d78a15f8892a4a61a37524312d55ebe..d5de5cb23265db7bcb48064d2fb2470f0b53e5b4 100644
--- a/mex/sources/libkorder/sylv/SylvesterSolver.hh
+++ b/mex/sources/libkorder/sylv/SylvesterSolver.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004-2011 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef SYLVESTER_SOLVER_H
-#define SYLVESTER_SOLVER_H
+#ifndef SYLVESTER_SOLVER_HH
+#define SYLVESTER_SOLVER_HH
 
 #include "KronVector.hh"
 #include "QuasiTriangular.hh"
@@ -66,4 +66,4 @@ public:
   virtual void solve(SylvParams& pars, KronVector& x) const = 0;
 };
 
-#endif /* SYLVESTER_SOLVER_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/SymSchurDecomp.hh b/mex/sources/libkorder/sylv/SymSchurDecomp.hh
index 6460155c6724366e5cecee256e5772c42ccbe303..ac558792ed36b7000ae0420b3a9a61b29d028d18 100644
--- a/mex/sources/libkorder/sylv/SymSchurDecomp.hh
+++ b/mex/sources/libkorder/sylv/SymSchurDecomp.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef SYM_SCHUR_DECOMP_H
-#define SYM_SCHUR_DECOMP_H
+#ifndef SYM_SCHUR_DECOMP_HH
+#define SYM_SCHUR_DECOMP_HH
 
 #include "SylvMatrix.hh"
 
diff --git a/mex/sources/libkorder/sylv/TriangularSylvester.hh b/mex/sources/libkorder/sylv/TriangularSylvester.hh
index 60d6b01873febc80a54afe6bb00d25f512444851..d5949b05a8dc3d82824322c3d749141c778d1741 100644
--- a/mex/sources/libkorder/sylv/TriangularSylvester.hh
+++ b/mex/sources/libkorder/sylv/TriangularSylvester.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef TRIANGULAR_SYLVESTER_H
-#define TRIANGULAR_SYLVESTER_H
+#ifndef TRIANGULAR_SYLVESTER_HH
+#define TRIANGULAR_SYLVESTER_HH
 
 #include "KronVector.hh"
 #include "QuasiTriangular.hh"
@@ -113,4 +113,4 @@ private:
   static constexpr double diag_zero_sq = diag_zero * diag_zero;
 };
 
-#endif /* TRIANGULAR_SYLVESTER_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/Vector.hh b/mex/sources/libkorder/sylv/Vector.hh
index 49b2f892f1ef890da94d8091cf5c0fb33e851cba..1168ff0bb8f99939e0ebcd5777b33e8100889c7e 100644
--- a/mex/sources/libkorder/sylv/Vector.hh
+++ b/mex/sources/libkorder/sylv/Vector.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef VECTOR_H
-#define VECTOR_H
+#ifndef VECTOR_HH
+#define VECTOR_HH
 
 /* NOTE: Vector and ConstVector have not common super class in order
    to avoid running virtual method invokation mechanism. Some
@@ -251,4 +251,4 @@ public:
   void print() const;
 };
 
-#endif /* VECTOR_H */
+#endif
diff --git a/mex/sources/libkorder/sylv/tests/MMMatrix.hh b/mex/sources/libkorder/sylv/tests/MMMatrix.hh
index b08f41276cca8b59aa1a28da4033658eb6c4caa5..67985f710a1c84052c89fa2d06a654d6a5749ba2 100644
--- a/mex/sources/libkorder/sylv/tests/MMMatrix.hh
+++ b/mex/sources/libkorder/sylv/tests/MMMatrix.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef MM_MATRIX_H
-#define MM_MATRIX_H
+#ifndef MM_MATRIX_HH
+#define MM_MATRIX_HH
 
 #include "GeneralMatrix.hh"
 
@@ -79,4 +79,4 @@ public:
   static void write(const std::string& fname, const GeneralMatrix& m);
 };
 
-#endif /* MM_MATRIX_H */
+#endif
diff --git a/mex/sources/libkorder/tl/equivalence.hh b/mex/sources/libkorder/tl/equivalence.hh
index df639c519a713d72ebd60d268a79e815e73336c5..1ff89fc77c6da19438a93c68017d1c617562250d 100644
--- a/mex/sources/libkorder/tl/equivalence.hh
+++ b/mex/sources/libkorder/tl/equivalence.hh
@@ -50,8 +50,8 @@
    classes according to their averages, and according to the smallest
    equivalence class element if the averages are the same. */
 
-#ifndef EQUIVALENCE_H
-#define EQUIVALENCE_H
+#ifndef EQUIVALENCE_HH
+#define EQUIVALENCE_HH
 
 #include "int_sequence.hh"
 
diff --git a/mex/sources/libkorder/tl/fine_container.hh b/mex/sources/libkorder/tl/fine_container.hh
index b71f8c290643a77374c09acbf641b93f81044034..d2a07f33bae62390a0a571646d58186dde988281 100644
--- a/mex/sources/libkorder/tl/fine_container.hh
+++ b/mex/sources/libkorder/tl/fine_container.hh
@@ -42,8 +42,8 @@
    similar thing for tensor multidimensional index. Thus, the abstraction
    is not currently used, but it might be useful in future. */
 
-#ifndef FINE_CONTAINER_H
-#define FINE_CONTAINER_H
+#ifndef FINE_CONTAINER_HH
+#define FINE_CONTAINER_HH
 
 #include "stack_container.hh"
 
diff --git a/mex/sources/libkorder/tl/fs_tensor.hh b/mex/sources/libkorder/tl/fs_tensor.hh
index 5bb9554b1e4b8df1eaa644d8246344bf46d4784e..2aaa6099ad497c03fd7d02fa62b247574c51dd5c 100644
--- a/mex/sources/libkorder/tl/fs_tensor.hh
+++ b/mex/sources/libkorder/tl/fs_tensor.hh
@@ -24,8 +24,8 @@
    tensors from here are identifying the multidimensional index with
    columns. */
 
-#ifndef FS_TENSOR_H
-#define FS_TENSOR_H
+#ifndef FS_TENSOR_HH
+#define FS_TENSOR_HH
 
 #include "int_power.hh"
 #include "symmetry.hh"
diff --git a/mex/sources/libkorder/tl/gs_tensor.hh b/mex/sources/libkorder/tl/gs_tensor.hh
index ebc0a71fdd38ddf27652809a0a9d7118e8c6e250..966ecb111543784c385507cfa754ee790a2a54fe 100644
--- a/mex/sources/libkorder/tl/gs_tensor.hh
+++ b/mex/sources/libkorder/tl/gs_tensor.hh
@@ -34,8 +34,8 @@
    also by number of variables for each group. This is dealt in the class
    for tensor dimensions defined also here. */
 
-#ifndef GS_TENSOR_H
-#define GS_TENSOR_H
+#ifndef GS_TENSOR_HH
+#define GS_TENSOR_HH
 
 #include "fs_tensor.hh"
 #include "rfs_tensor.hh"
diff --git a/mex/sources/libkorder/tl/int_sequence.hh b/mex/sources/libkorder/tl/int_sequence.hh
index 33101668eae911d3ab4a212084975689cef3782d..d43d82d8e6a8a40fc9fe350ef5feff5c446e4210 100644
--- a/mex/sources/libkorder/tl/int_sequence.hh
+++ b/mex/sources/libkorder/tl/int_sequence.hh
@@ -39,8 +39,8 @@
 
    Also, we need to construct a subsequence of a sequence. */
 
-#ifndef INT_SEQUENCE_H
-#define INT_SEQUENCE_H
+#ifndef INT_SEQUENCE_HH
+#define INT_SEQUENCE_HH
 
 #include <algorithm>
 #include <initializer_list>
diff --git a/mex/sources/libkorder/tl/kron_prod.hh b/mex/sources/libkorder/tl/kron_prod.hh
index 106a7404f7a73d7a62234cdef40d8f5f4026b3eb..f76e1621ddda77ec5f89bd7a4775cbf8b4abd954 100644
--- a/mex/sources/libkorder/tl/kron_prod.hh
+++ b/mex/sources/libkorder/tl/kron_prod.hh
@@ -37,8 +37,8 @@
    For this multiplication, we also need to represent products of type A⊗I,
    I⊗A⊗I and I⊗A. */
 
-#ifndef KRON_PROD_H
-#define KRON_PROD_H
+#ifndef KRON_PROD_HH
+#define KRON_PROD_HH
 
 #include <memory>
 #include <utility>
diff --git a/mex/sources/libkorder/tl/normal_moments.hh b/mex/sources/libkorder/tl/normal_moments.hh
index 856a2fbc4c12fad23c1a8ff5481351d4d40bea9c..909457ab52178dc7c598195a5b5d1a088bd79747 100644
--- a/mex/sources/libkorder/tl/normal_moments.hh
+++ b/mex/sources/libkorder/tl/normal_moments.hh
@@ -113,8 +113,8 @@
    exactly 2 elements.
 */
 
-#ifndef NORMAL_MOMENTS_H
-#define NORMAL_MOMENTS_H
+#ifndef NORMAL_MOMENTS_HH
+#define NORMAL_MOMENTS_HH
 
 #include "t_container.hh"
 
diff --git a/mex/sources/libkorder/tl/permutation.hh b/mex/sources/libkorder/tl/permutation.hh
index 3995f0ece676064b18fee3cac92b6f611b0cee4d..a799532a0ea3ded51e6464e54760e6889e2b032b 100644
--- a/mex/sources/libkorder/tl/permutation.hh
+++ b/mex/sources/libkorder/tl/permutation.hh
@@ -45,8 +45,8 @@
    which contains all permutation sets up to a given number.
 */
 
-#ifndef PERMUTATION_H
-#define PERMUTATION_H
+#ifndef PERMUTATION_HH
+#define PERMUTATION_HH
 
 #include "equivalence.hh"
 #include "int_sequence.hh"
diff --git a/mex/sources/libkorder/tl/ps_tensor.hh b/mex/sources/libkorder/tl/ps_tensor.hh
index 8ea80a52e4050dbd14c1ad3b39748ec3e9eab5c3..143ca2a34ad098f91007b82bccc08915162da869 100644
--- a/mex/sources/libkorder/tl/ps_tensor.hh
+++ b/mex/sources/libkorder/tl/ps_tensor.hh
@@ -54,8 +54,8 @@
    dimensions is described by PerTensorDimens2. The tensor holding the
    underlying data is FPSTensor. */
 
-#ifndef PS_TENSOR_H
-#define PS_TENSOR_H
+#ifndef PS_TENSOR_HH
+#define PS_TENSOR_HH
 
 #include "equivalence.hh"
 #include "gs_tensor.hh"
diff --git a/mex/sources/libkorder/tl/pyramid_prod.hh b/mex/sources/libkorder/tl/pyramid_prod.hh
index 1372e3ef93cca1d0d3d124fc914ac13023840362..04150411431576de3cc649f03d75f2f8d6cdd2d0 100644
--- a/mex/sources/libkorder/tl/pyramid_prod.hh
+++ b/mex/sources/libkorder/tl/pyramid_prod.hh
@@ -66,8 +66,8 @@
    implemented in FGSContainer::multAndAdd() unfolded code or
    FGSContainer::multAndAdd() folded code. */
 
-#ifndef PYRAMID_PROD_H
-#define PYRAMID_PROD_H
+#ifndef PYRAMID_PROD_HH
+#define PYRAMID_PROD_HH
 
 #include "gs_tensor.hh"
 #include "int_sequence.hh"
diff --git a/mex/sources/libkorder/tl/pyramid_prod2.hh b/mex/sources/libkorder/tl/pyramid_prod2.hh
index 3ba18636329b2387d1b70712c7b2f9449deb2b75..f741f702a6c5dfcf03b15464abea1af81e47c129 100644
--- a/mex/sources/libkorder/tl/pyramid_prod2.hh
+++ b/mex/sources/libkorder/tl/pyramid_prod2.hh
@@ -67,8 +67,8 @@
    only through the ‘index’. Note that this does not matter, since
    [f_zˡ] are sparse. */
 
-#ifndef PYRAMID_PROD2_H
-#define PYRAMID_PROD2_H
+#ifndef PYRAMID_PROD2_HH
+#define PYRAMID_PROD2_HH
 
 #include "permutation.hh"
 #include "rfs_tensor.hh"
diff --git a/mex/sources/libkorder/tl/rfs_tensor.hh b/mex/sources/libkorder/tl/rfs_tensor.hh
index 851d99470a829dc4de10d5b4076aa99ec8e38b86..f08f4c345b1a97fe95fdf444242225470c23e7d4 100644
--- a/mex/sources/libkorder/tl/rfs_tensor.hh
+++ b/mex/sources/libkorder/tl/rfs_tensor.hh
@@ -52,8 +52,8 @@
    implement getOffset(). Process of unfolding is not used, so we implemented
    it so that unfolding and then folding a tensor would yield the same data. */
 
-#ifndef RFS_TENSOR_H
-#define RFS_TENSOR_H
+#ifndef RFS_TENSOR_HH
+#define RFS_TENSOR_HH
 
 #include "fs_tensor.hh"
 #include "symmetry.hh"
diff --git a/mex/sources/libkorder/tl/sparse_tensor.hh b/mex/sources/libkorder/tl/sparse_tensor.hh
index e2604aed171fea70f1b3a8e22f041c1523dcbe4d..b04ab17cf2c8fd4c63982261474b0229a2609bcc 100644
--- a/mex/sources/libkorder/tl/sparse_tensor.hh
+++ b/mex/sources/libkorder/tl/sparse_tensor.hh
@@ -39,8 +39,8 @@
    the only constructor of general symmetry sparse tensor is slicing from
    the full symmetry sparse. */
 
-#ifndef SPARSE_TENSOR_H
-#define SPARSE_TENSOR_H
+#ifndef SPARSE_TENSOR_HH
+#define SPARSE_TENSOR_HH
 
 #include "Vector.hh"
 #include "gs_tensor.hh"
diff --git a/mex/sources/libkorder/tl/stack_container.hh b/mex/sources/libkorder/tl/stack_container.hh
index 9b3496bdefb292d60c72d18baf64d95fa431cc83..30a2e9806b41a87003e098f5bc387bd10a2773a6 100644
--- a/mex/sources/libkorder/tl/stack_container.hh
+++ b/mex/sources/libkorder/tl/stack_container.hh
@@ -75,8 +75,8 @@
    We have also two supporting classes StackProduct and KronProdStack
    and a number of worker classes used as threads. */
 
-#ifndef STACK_CONTAINER_H
-#define STACK_CONTAINER_H
+#ifndef STACK_CONTAINER_HH
+#define STACK_CONTAINER_HH
 
 #include "equivalence.hh"
 #include "int_sequence.hh"
diff --git a/mex/sources/libkorder/tl/symmetry.hh b/mex/sources/libkorder/tl/symmetry.hh
index 4750aa11568622145364b5244ff098c032d5ec6c..b5b1c51ba03fb8f264af123ec434e7dd3a2d1b06 100644
--- a/mex/sources/libkorder/tl/symmetry.hh
+++ b/mex/sources/libkorder/tl/symmetry.hh
@@ -48,8 +48,8 @@
    The symmetry is implemented as IntSequence, in fact, it inherits
    from it. */
 
-#ifndef SYMMETRY_H
-#define SYMMETRY_H
+#ifndef SYMMETRY_HH
+#define SYMMETRY_HH
 
 #include "equivalence.hh"
 #include "int_sequence.hh"
diff --git a/mex/sources/libkorder/tl/t_container.hh b/mex/sources/libkorder/tl/t_container.hh
index 8adb19acc15d47f20dfeb3382fb28856f345e358..7f5f41b9a730bd6d7784cd86c36074d240c865f8 100644
--- a/mex/sources/libkorder/tl/t_container.hh
+++ b/mex/sources/libkorder/tl/t_container.hh
@@ -58,8 +58,8 @@
    multiplied by folded tensors g yielding folded tensor B, but unfolded tensor
    h is multiplied by unfolded tensors g yielding unfolded tensor B. */
 
-#ifndef T_CONTAINER_H
-#define T_CONTAINER_H
+#ifndef T_CONTAINER_HH
+#define T_CONTAINER_HH
 
 #include "Vector.hh"
 #include "equivalence.hh"
diff --git a/mex/sources/libkorder/tl/t_polynomial.hh b/mex/sources/libkorder/tl/t_polynomial.hh
index 800348dc6c411f2af1ea2fd9f7ece9835eaca237..058344ac54e380fcfa0c64bb97871fcbae265936 100644
--- a/mex/sources/libkorder/tl/t_polynomial.hh
+++ b/mex/sources/libkorder/tl/t_polynomial.hh
@@ -51,6 +51,9 @@
    compactification of the polynomial. The class derives from the tensor
    and has a eval method. */
 
+#ifndef T_POLYNOMIAL_HH
+#define T_POLYNOMIAL_HH
+
 #include "fs_tensor.hh"
 #include "pascal_triangle.hh"
 #include "rfs_tensor.hh"
@@ -555,3 +558,5 @@ public:
   {
   }
 };
+
+#endif
diff --git a/mex/sources/libkorder/tl/tensor.hh b/mex/sources/libkorder/tl/tensor.hh
index 74ee6423e54e621abc0a0ab69c3718f813da5a3e..5a326a4fa9d6c85a8e85c5d25351f71a04913249 100644
--- a/mex/sources/libkorder/tl/tensor.hh
+++ b/mex/sources/libkorder/tl/tensor.hh
@@ -57,8 +57,8 @@
    objects are not used very often. They have limited usage due to their
    specialized constructor. */
 
-#ifndef TENSOR_H
-#define TENSOR_H
+#ifndef TENSOR_HH
+#define TENSOR_HH
 
 #include "int_sequence.hh"
 #include "twod_matrix.hh"
diff --git a/mex/sources/libkorder/tl/tests/factory.hh b/mex/sources/libkorder/tl/tests/factory.hh
index b369c2404b8ce0b25883becbd31a3eaaea7ae11e..a3cf7cef634b2be19c1fad44afb78e1331f4d6e2 100644
--- a/mex/sources/libkorder/tl/tests/factory.hh
+++ b/mex/sources/libkorder/tl/tests/factory.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef FACTORY_H
-#define FACTORY_H
+#ifndef FACTORY_HH
+#define FACTORY_HH
 
 #include <memory>
 #include <random>
diff --git a/mex/sources/libkorder/tl/tests/monoms.hh b/mex/sources/libkorder/tl/tests/monoms.hh
index 55dfcc212815c22f4e5c38fda1aa06c3e859b80b..d4523f2919de255609014fad417806120835a1f3 100644
--- a/mex/sources/libkorder/tl/tests/monoms.hh
+++ b/mex/sources/libkorder/tl/tests/monoms.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef MONOMS_H
-#define MONOMS_H
+#ifndef MONOMS_HH
+#define MONOMS_HH
 
 #include <memory>
 #include <random>
diff --git a/mex/sources/libkorder/tl/tl_exception.hh b/mex/sources/libkorder/tl/tl_exception.hh
index b67441518b219e8c99c292392f3b4032ffa14085..ff5adc8061c986965e4bcfc5e525ad7de748b6df 100644
--- a/mex/sources/libkorder/tl/tl_exception.hh
+++ b/mex/sources/libkorder/tl/tl_exception.hh
@@ -27,8 +27,8 @@
    some higher level. This header file defines a simple infrastructure
    for this. */
 
-#ifndef TL_EXCEPTION_H
-#define TL_EXCEPTION_H
+#ifndef TL_EXCEPTION_HH
+#define TL_EXCEPTION_HH
 
 #include <iostream>
 #include <string>
diff --git a/mex/sources/libkorder/tl/tl_static.hh b/mex/sources/libkorder/tl/tl_static.hh
index 55a1aef001d773f3d0487b4e2008a6abd4ac60e9..07cd05372c85d51e84aee00c1f7a29c2e8f7832c 100644
--- a/mex/sources/libkorder/tl/tl_static.hh
+++ b/mex/sources/libkorder/tl/tl_static.hh
@@ -29,8 +29,8 @@
    TLStatic::init() must be called at the beginning of the program, as
    soon as dimension and number of variables is known. */
 
-#ifndef TL_STATIC_H
-#define TL_STATIC_H
+#ifndef TL_STATIC_HH
+#define TL_STATIC_HH
 
 #include "equivalence.hh"
 #include "permutation.hh"
diff --git a/mex/sources/libkorder/tl/twod_matrix.hh b/mex/sources/libkorder/tl/twod_matrix.hh
index 23998e1f5cc5284f44065b4ac0e22346df970620..7c53e661ed8c1a902316960ed76ec0554739efda 100644
--- a/mex/sources/libkorder/tl/twod_matrix.hh
+++ b/mex/sources/libkorder/tl/twod_matrix.hh
@@ -29,8 +29,8 @@
    ConstTwoDMatrix. The only purpose of the latter is to allow submatrix
    construction from const reference arguments. */
 
-#ifndef TWOD_MATRIX_H
-#define TWOD_MATRIX_H
+#ifndef TWOD_MATRIX_HH
+#define TWOD_MATRIX_HH
 
 #include "GeneralMatrix.hh"
 
diff --git a/mex/sources/libkorder/utils/dynare_exception.hh b/mex/sources/libkorder/utils/dynare_exception.hh
index 6e4fc370ee58f2d33f686f8e64d8993251377990..2e105a9a6f7375ff39f77f71e9a11aab1ad8f005 100644
--- a/mex/sources/libkorder/utils/dynare_exception.hh
+++ b/mex/sources/libkorder/utils/dynare_exception.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef DYNARE_EXCEPTION_H
-#define DYNARE_EXCEPTION_H
+#ifndef DYNARE_EXCEPTION_HH
+#define DYNARE_EXCEPTION_HH
 
 #include <string>
 #include <utility>
diff --git a/mex/sources/libkorder/utils/exception.hh b/mex/sources/libkorder/utils/exception.hh
index cb04df44effd2224694dcb87a6541677562d9f49..d726743b5e6c95a0abd7f33f477de5cee205dbe6 100644
--- a/mex/sources/libkorder/utils/exception.hh
+++ b/mex/sources/libkorder/utils/exception.hh
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef OGU_EXCEPTION_H
-#define OGU_EXCEPTION_H
+#ifndef EXCEPTION_HH
+#define EXCEPTION_HH
 
 #include <iostream>
 #include <string>
diff --git a/mex/sources/libkorder/utils/int_power.hh b/mex/sources/libkorder/utils/int_power.hh
index 4c647c832c27b6f4f3693b9a3ab74caa7b6eaa8b..4668d191d29861e5f2e5313410ffb477d3614dd2 100644
--- a/mex/sources/libkorder/utils/int_power.hh
+++ b/mex/sources/libkorder/utils/int_power.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -17,5 +17,10 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+#ifndef INT_POWER_HH
+#define INT_POWER_HH
+
 // Integer exponentiation (by squaring)
 int power(int a, int b);
+
+#endif
diff --git a/mex/sources/libkorder/utils/pascal_triangle.hh b/mex/sources/libkorder/utils/pascal_triangle.hh
index 736a46b0dddff2e5766901bbb9fcd1ce47f87c77..e93d2f7be49739078ab247a9f69e9e5e107fe7a5 100644
--- a/mex/sources/libkorder/utils/pascal_triangle.hh
+++ b/mex/sources/libkorder/utils/pascal_triangle.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2005 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -18,8 +18,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef PASCAL_TRIANGLE_H
-#define PASCAL_TRIANGLE_H
+#ifndef PASCAL_TRIANGLE_HH
+#define PASCAL_TRIANGLE_HH
 
 #include <vector>
 
diff --git a/mex/sources/libkorder/utils/sthread.hh b/mex/sources/libkorder/utils/sthread.hh
index 77813a57f1409c09ff0f007950932d1371a0c8c0..70a76aead9376187e81076c7bdba8bc66a4e5b79 100644
--- a/mex/sources/libkorder/utils/sthread.hh
+++ b/mex/sources/libkorder/utils/sthread.hh
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 Ondra Kamenik
- * Copyright © 2019 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -38,8 +38,8 @@
    The number of maximum parallel threads is controlled via a static member of
    the detach_thread_group class. */
 
-#ifndef STHREAD_H
-#define STHREAD_H
+#ifndef STHREAD_HH
+#define STHREAD_HH
 
 #include <condition_variable>
 #include <map>
diff --git a/mex/sources/ms-sbvar/modify_for_mex.h b/mex/sources/ms-sbvar/modify_for_mex.h
index 27f18432b6b3c7451d97b372ba3c07570a31b13a..e5655fdf609d075dc4dd5d84689eabea740f1be6 100644
--- a/mex/sources/ms-sbvar/modify_for_mex.h
+++ b/mex/sources/ms-sbvar/modify_for_mex.h
@@ -17,8 +17,8 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-#ifndef _MODIFY_FOR_MEX_H
-#define _MODIFY_FOR_MEX_H
+#ifndef MODIFY_FOR_MEX_H
+#define MODIFY_FOR_MEX_H
 
 #include <dynblas.h>
 #include <dynlapack.h>
@@ -56,4 +56,4 @@ _Noreturn
     void
     msExit(int status);
 
-#endif // _MODIFY_FOR_MEX_H
+#endif
diff --git a/mex/sources/perfect_foresight_problem/DynamicModelCaller.hh b/mex/sources/perfect_foresight_problem/DynamicModelCaller.hh
index b157c2c6e920e8e4f23080886f5a13f8c3340873..d4891e57ce427f1a60253c6a02a84b15ea92d975 100644
--- a/mex/sources/perfect_foresight_problem/DynamicModelCaller.hh
+++ b/mex/sources/perfect_foresight_problem/DynamicModelCaller.hh
@@ -17,6 +17,9 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+#ifndef DYNAMIC_MODEL_CALLER_HH
+#define DYNAMIC_MODEL_CALLER_HH
+
 #include <algorithm>
 #include <limits>
 #include <memory>
@@ -185,3 +188,5 @@ DynamicModelMatlabCaller::cmplxToReal(mxArray* cmplx_mx)
   mxDestroyArray(cmplx_mx);
   return real_mx;
 }
+
+#endif
diff --git a/mex/sources/sobol/gaussian.hh b/mex/sources/sobol/gaussian.hh
index 12af57a3e4a80b2dc34f642f42d9c48185633f18..4e709cccdcfaa45076ddef65e9d0bf6bc7d20877 100644
--- a/mex/sources/sobol/gaussian.hh
+++ b/mex/sources/sobol/gaussian.hh
@@ -22,6 +22,9 @@
 ** AUTHOR(S): stephane DOT adjemian AT univ DASH lemans DOT fr
 */
 
+#ifndef GAUSSIAN_HH
+#define GAUSSIAN_HH
+
 #include <algorithm>
 #include <array>
 #include <cmath>
@@ -162,3 +165,5 @@ usphereRadius(int d, int n, double radius, T* U)
         U[k + i] = radius * U[k + i] / norm;
     }
 }
+
+#endif
diff --git a/mex/sources/sobol/sobol.hh b/mex/sources/sobol/sobol.hh
index 2531d40f68f1879c45310d74e73d95b526d06a20..026ccfa261df279efc8ef555b8861753d195d4cd 100644
--- a/mex/sources/sobol/sobol.hh
+++ b/mex/sources/sobol/sobol.hh
@@ -18,6 +18,9 @@
  * along with Dynare.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+#ifndef SOBOL_HH
+#define SOBOL_HH
+
 #include <cstdint>
 #include <dynblas.h> // For the FORTRAN_WRAPPER macro
 
@@ -63,3 +66,5 @@ expand_unit_hypercube(int dimension, int block_size, T* block, const T* lower_bo
     }
   delete[] hypercube_length;
 }
+
+#endif