Get rid of include directives inside namespace blocks (bug #339).
diff --git a/unsupported/Eigen/BVH b/unsupported/Eigen/BVH
index f307da2..d50b2bd 100644
--- a/unsupported/Eigen/BVH
+++ b/unsupported/Eigen/BVH
@@ -97,8 +97,9 @@
   * The following is a simple but complete example for how to use the BVH to accelerate the search for a closest red-blue point pair:
   * \include BVH_Example.cpp
   * Output: \verbinclude BVH_Example.out
-
   */
+}
+
 //@{
 
 #include "src/BVH/BVAlgorithms.h"
@@ -106,6 +107,4 @@
 
 //@}
 
-}
-
 #endif // EIGEN_BVH_MODULE_H
diff --git a/unsupported/Eigen/FFT b/unsupported/Eigen/FFT
index c56bd63..e2ec713 100644
--- a/unsupported/Eigen/FFT
+++ b/unsupported/Eigen/FFT
@@ -86,23 +86,23 @@
 #ifdef EIGEN_FFTW_DEFAULT
 // FFTW: faster, GPL -- incompatible with Eigen in LGPL form, bigger code size
 #  include <fftw3.h>
+#  include "src/FFT/ei_fftw_impl.h"
    namespace Eigen {
-#    include "src/FFT/ei_fftw_impl.h"
      //template <typename T> typedef struct internal::fftw_impl  default_fft_impl; this does not work
      template <typename T> struct default_fft_impl : public internal::fftw_impl<T> {};
    }
 #elif defined EIGEN_MKL_DEFAULT
 // TODO 
 // intel Math Kernel Library: fastest, commercial -- may be incompatible with Eigen in GPL form
+#  include "src/FFT/ei_imklfft_impl.h"
    namespace Eigen {
-#    include "src/FFT/ei_imklfft_impl.h"
      template <typename T> struct default_fft_impl : public internal::imklfft_impl {};
    }
 #else
 // internal::kissfft_impl:  small, free, reasonably efficient default, derived from kissfft
 //
+# include "src/FFT/ei_kissfft_impl.h"
   namespace Eigen {
-#   include "src/FFT/ei_kissfft_impl.h"
      template <typename T> 
        struct default_fft_impl : public internal::kissfft_impl<T> {};
   }
diff --git a/unsupported/Eigen/IterativeSolvers b/unsupported/Eigen/IterativeSolvers
index c8ec099..4645153 100644
--- a/unsupported/Eigen/IterativeSolvers
+++ b/unsupported/Eigen/IterativeSolvers
@@ -27,8 +27,6 @@
 
 #include <Eigen/Sparse>
 
-namespace Eigen {
-
 /** \ingroup Unsupported_modules
   * \defgroup IterativeSolvers_Module Iterative solvers module
   * This module aims to provide various iterative linear and non linear solver algorithms.
@@ -54,6 +52,4 @@
 
 //@}
 
-}
-
 #endif // EIGEN_ITERATIVE_SOLVERS_MODULE_H
diff --git a/unsupported/Eigen/KroneckerProduct b/unsupported/Eigen/KroneckerProduct
index 291c7fa..796e386 100644
--- a/unsupported/Eigen/KroneckerProduct
+++ b/unsupported/Eigen/KroneckerProduct
@@ -17,10 +17,10 @@
   * \endcode
   */
 
-#include "src/KroneckerProduct/KroneckerTensorProduct.h"
-
 } // namespace Eigen
 
+#include "src/KroneckerProduct/KroneckerTensorProduct.h"
+
 #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN_KRONECKER_PRODUCT_MODULE_H
diff --git a/unsupported/Eigen/MatrixFunctions b/unsupported/Eigen/MatrixFunctions
index ac58eec..13eda8f 100644
--- a/unsupported/Eigen/MatrixFunctions
+++ b/unsupported/Eigen/MatrixFunctions
@@ -34,8 +34,6 @@
 #include <Eigen/LU>
 #include <Eigen/Eigenvalues>
 
-namespace Eigen {
-
 /** \ingroup Unsupported_modules
   * \defgroup MatrixFunctions_Module Matrix functions module
   * \brief This module aims to provide various methods for the computation of
@@ -393,7 +391,5 @@
 
 */
 
-}
-
 #endif // EIGEN_MATRIX_FUNCTIONS
 
diff --git a/unsupported/Eigen/MoreVectorization b/unsupported/Eigen/MoreVectorization
index 26a01cd..9f0a39f 100644
--- a/unsupported/Eigen/MoreVectorization
+++ b/unsupported/Eigen/MoreVectorization
@@ -9,8 +9,8 @@
   * \defgroup MoreVectorization More vectorization module
   */
 
-#include "src/MoreVectorization/MathFunctions.h"
-
 }
 
+#include "src/MoreVectorization/MathFunctions.h"
+
 #endif // EIGEN_MOREVECTORIZATION_MODULE_H
diff --git a/unsupported/Eigen/NonLinearOptimization b/unsupported/Eigen/NonLinearOptimization
index e19db33..0a384d6 100644
--- a/unsupported/Eigen/NonLinearOptimization
+++ b/unsupported/Eigen/NonLinearOptimization
@@ -32,8 +32,6 @@
 #include <Eigen/QR>
 #include <unsupported/Eigen/NumericalDiff>
 
-namespace Eigen {
-
 /** \ingroup Unsupported_modules
   * \defgroup NonLinearOptimization_Module Non linear optimization module
   *
@@ -147,8 +145,5 @@
 #include "src/NonLinearOptimization/HybridNonLinearSolver.h"
 #include "src/NonLinearOptimization/LevenbergMarquardt.h"
 
-}
-
-
 
 #endif // EIGEN_NONLINEAROPTIMIZATION_MODULE
diff --git a/unsupported/Eigen/NumericalDiff b/unsupported/Eigen/NumericalDiff
index 2a59c14..eebee07 100644
--- a/unsupported/Eigen/NumericalDiff
+++ b/unsupported/Eigen/NumericalDiff
@@ -59,12 +59,13 @@
   * package.
   *
   */
+}
+
 //@{
 
 #include "src/NumericalDiff/NumericalDiff.h"
 
 //@}
-}
 
 
 #endif // EIGEN_NUMERICALDIFF_MODULE
diff --git a/unsupported/Eigen/Polynomials b/unsupported/Eigen/Polynomials
index 2c2f3e1..fa58b00 100644
--- a/unsupported/Eigen/Polynomials
+++ b/unsupported/Eigen/Polynomials
@@ -16,8 +16,6 @@
   #undef EIGEN_HIDE_HEAVY_CODE
 #endif
 
-namespace Eigen {
-
 /** \ingroup Unsupported_modules
   * \defgroup Polynomials_Module Polynomials module
   *
@@ -129,8 +127,6 @@
   Output: \verbinclude PolynomialSolver1.out
 */
 
-} // namespace Eigen
-
 #include <Eigen/src/Core/util/ReenableStupidWarnings.h>
 
 #endif // EIGEN_POLYNOMIALS_MODULE_H
diff --git a/unsupported/Eigen/Skyline b/unsupported/Eigen/Skyline
index 5247b2e..c9823f3 100644
--- a/unsupported/Eigen/Skyline
+++ b/unsupported/Eigen/Skyline
@@ -11,15 +11,13 @@
 #include <cstring>
 #include <algorithm>
 
-namespace Eigen {
-
-    /** \ingroup Unsupported_modules
-     *  \defgroup Skyline_Module Skyline module
-     *
-     *
-     *
-     *
-     */
+/** \ingroup Unsupported_modules
+ *  \defgroup Skyline_Module Skyline module
+ *
+ *
+ *
+ *
+ */
 
 #include "src/Skyline/SkylineUtil.h"
 #include "src/Skyline/SkylineMatrixBase.h"
@@ -28,8 +26,6 @@
 #include "src/Skyline/SkylineInplaceLU.h"
 #include "src/Skyline/SkylineProduct.h"
 
-} // namespace Eigen
-
 #include "Eigen/src/Core/util/ReenableStupidWarnings.h"
 
 #endif // EIGEN_SKYLINE_MODULE_H
diff --git a/unsupported/Eigen/SparseExtra b/unsupported/Eigen/SparseExtra
index cc7c373..2cc14bb 100644
--- a/unsupported/Eigen/SparseExtra
+++ b/unsupported/Eigen/SparseExtra
@@ -17,8 +17,6 @@
   #include <google/dense_hash_map>
 #endif
 
-namespace Eigen {
-
 /** \ingroup Unsupported_modules
   * \defgroup SparseExtra_Module SparseExtra module
   *
@@ -38,7 +36,6 @@
 #include "src/SparseExtra/RandomSetter.h"
 
 #include "src/SparseExtra/MarketIO.h"
-} // namespace Eigen
 
 #if !defined(_WIN32)
 #include <dirent.h>
diff --git a/unsupported/Eigen/Splines b/unsupported/Eigen/Splines
index 3622741..33769b0 100644
--- a/unsupported/Eigen/Splines
+++ b/unsupported/Eigen/Splines
@@ -37,16 +37,10 @@
   * #include <unsupported/Eigen/Splines>
   * \endcode
   */
-//@{
 }
 
 #include "src/Splines/SplineFwd.h"
 #include "src/Splines/Spline.h"
 #include "src/Splines/SplineFitting.h"
 
-namespace Eigen 
-{
-//@}
-}
-
 #endif // EIGEN_SPLINES_MODULE_H
diff --git a/unsupported/Eigen/src/BVH/BVAlgorithms.h b/unsupported/Eigen/src/BVH/BVAlgorithms.h
index d65a977..6cba656 100644
--- a/unsupported/Eigen/src/BVH/BVAlgorithms.h
+++ b/unsupported/Eigen/src/BVH/BVAlgorithms.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_BVALGORITHMS_H
 #define EIGEN_BVALGORITHMS_H
 
+namespace Eigen { 
+
 namespace internal {
 
 #ifndef EIGEN_PARSED_BY_DOXYGEN
@@ -301,4 +303,6 @@
   return minimum;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_BVALGORITHMS_H
diff --git a/unsupported/Eigen/src/BVH/KdBVH.h b/unsupported/Eigen/src/BVH/KdBVH.h
index 028b481..a0f6660 100644
--- a/unsupported/Eigen/src/BVH/KdBVH.h
+++ b/unsupported/Eigen/src/BVH/KdBVH.h
@@ -25,6 +25,8 @@
 #ifndef KDBVH_H_INCLUDED
 #define KDBVH_H_INCLUDED
 
+namespace Eigen { 
+
 namespace internal {
 
 //internal pair class for the BVH--used instead of std::pair because of alignment
@@ -230,4 +232,6 @@
   ObjectList objects;
 };
 
+} // end namespace Eigen
+
 #endif //KDBVH_H_INCLUDED
diff --git a/unsupported/Eigen/src/FFT/ei_fftw_impl.h b/unsupported/Eigen/src/FFT/ei_fftw_impl.h
index a06f673..5c36db7 100644
--- a/unsupported/Eigen/src/FFT/ei_fftw_impl.h
+++ b/unsupported/Eigen/src/FFT/ei_fftw_impl.h
@@ -22,6 +22,8 @@
 // License and a copy of the GNU General Public License along with
 // Eigen. If not, see <http://www.gnu.org/licenses/>.
 
+namespace Eigen { 
+
 namespace internal {
 
   // FFTW uses non-const arguments
@@ -269,4 +271,6 @@
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 /* vim: set filetype=cpp et sw=2 ts=2 ai: */
diff --git a/unsupported/Eigen/src/FFT/ei_kissfft_impl.h b/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
index 04b98b0..c3cbb7f 100644
--- a/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
+++ b/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
@@ -22,6 +22,8 @@
 // License and a copy of the GNU General Public License along with
 // Eigen. If not, see <http://www.gnu.org/licenses/>.
 
+namespace Eigen { 
+
 namespace internal {
 
   // This FFT implementation was derived from kissfft http:sourceforge.net/projects/kissfft
@@ -426,5 +428,6 @@
 
 } // end namespace internal
 
-/* vim: set filetype=cpp et sw=2 ts=2 ai: */
+} // end namespace Eigen
 
+/* vim: set filetype=cpp et sw=2 ts=2 ai: */
diff --git a/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h b/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
index 4d8e183..f8a5505 100644
--- a/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
+++ b/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
@@ -50,6 +50,8 @@
 
 #include <Eigen/Core>
 
+namespace Eigen { 
+
 namespace internal {
 
 /** \ingroup IterativeSolvers_Module
@@ -195,4 +197,6 @@
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_CONSTRAINEDCG_H
diff --git a/unsupported/Eigen/src/IterativeSolvers/GMRES.h b/unsupported/Eigen/src/IterativeSolvers/GMRES.h
index 9bebae9..3b74e44 100644
--- a/unsupported/Eigen/src/IterativeSolvers/GMRES.h
+++ b/unsupported/Eigen/src/IterativeSolvers/GMRES.h
@@ -26,6 +26,8 @@
 #ifndef EIGEN_GMRES_H
 #define EIGEN_GMRES_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /**
@@ -385,6 +387,8 @@
   }
 };
 
-}
+} // end namespace internal
+
+} // end namespace Eigen
 
 #endif // EIGEN_GMRES_H
diff --git a/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h b/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h
index d8d4469..e02f1f0 100644
--- a/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h
+++ b/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_INCOMPLETE_LU_H
 #define EIGEN_INCOMPLETE_LU_H
 
+namespace Eigen { 
+
 template <typename _Scalar>
 class IncompleteLU
 {
@@ -119,6 +121,8 @@
   }
 };
 
-}
+} // end namespace internal
+
+} // end namespace Eigen
 
 #endif // EIGEN_INCOMPLETE_LU_H
diff --git a/unsupported/Eigen/src/IterativeSolvers/IterationController.h b/unsupported/Eigen/src/IterativeSolvers/IterationController.h
index a65793c..dfb97e2 100644
--- a/unsupported/Eigen/src/IterativeSolvers/IterationController.h
+++ b/unsupported/Eigen/src/IterativeSolvers/IterationController.h
@@ -75,6 +75,8 @@
 #ifndef EIGEN_ITERATION_CONTROLLER_H
 #define EIGEN_ITERATION_CONTROLLER_H
 
+namespace Eigen { 
+
 /** \ingroup IterativeSolvers_Module
   * \class IterationController
   *
@@ -163,4 +165,6 @@
 
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_ITERATION_CONTROLLER_H
diff --git a/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h b/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
index cc5f271..4627705 100644
--- a/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
+++ b/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
@@ -28,6 +28,8 @@
 #define KRONECKER_TENSOR_PRODUCT_H
 
 
+namespace Eigen { 
+
 namespace internal {
 
 /*!
@@ -165,4 +167,6 @@
   internal::kroneckerProduct_sparse(a.derived(), b.derived(), c.derived());
 }
 
+} // end namespace Eigen
+
 #endif // KRONECKER_TENSOR_PRODUCT_H
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
index c9aeb33..6cdd657 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -28,6 +28,8 @@
 
 #include "StemFunction.h"
 
+namespace Eigen { 
+
 #if defined(_MSC_VER) || defined(__FreeBSD__)
   template <typename Scalar> Scalar log2(Scalar v) { using std::log; return log(v)/log(Scalar(2)); }
 #endif
@@ -462,4 +464,6 @@
   return MatrixExponentialReturnValue<Derived>(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATRIX_EXPONENTIAL
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
index 6970b3a..859de72 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
@@ -29,6 +29,8 @@
 #include "MatrixFunctionAtomic.h"
 
 
+namespace Eigen { 
+
 /** \ingroup MatrixFunctions_Module
   * \brief Class for computing matrix functions.
   * \tparam  MatrixType  type of the argument of the matrix function,
@@ -598,4 +600,6 @@
   return MatrixFunctionReturnValue<Derived>(derived(), StdStemFunctions<ComplexScalar>::cosh);
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATRIX_FUNCTION
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
index d087669..97ab662 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_MATRIX_FUNCTION_ATOMIC
 #define EIGEN_MATRIX_FUNCTION_ATOMIC
 
+namespace Eigen { 
+
 /** \ingroup MatrixFunctions_Module
   * \class MatrixFunctionAtomic
   * \brief Helper class for computing matrix functions of atomic matrices.
@@ -139,4 +141,6 @@
   return false;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATRIX_FUNCTION_ATOMIC
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
index e575be0..4a40d6a 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
@@ -30,6 +30,8 @@
 #define M_PI 3.141592653589793238462643383279503L
 #endif
 
+namespace Eigen { 
+
 /** \ingroup MatrixFunctions_Module
   * \class MatrixLogarithmAtomic
   * \brief Helper class for computing matrix logarithm of atomic matrices.
@@ -503,4 +505,6 @@
   return MatrixLogarithmReturnValue<Derived>(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATRIX_LOGARITHM
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
index ed1b5ee..658cd33 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_MATRIX_SQUARE_ROOT
 #define EIGEN_MATRIX_SQUARE_ROOT
 
+namespace Eigen { 
+
 /** \ingroup MatrixFunctions_Module
   * \brief Class for computing matrix square roots of upper quasi-triangular matrices.
   * \tparam  MatrixType  type of the argument of the matrix square root,
@@ -492,4 +494,6 @@
   return MatrixSquareRootReturnValue<Derived>(derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_MATRIX_FUNCTION
diff --git a/unsupported/Eigen/src/MatrixFunctions/StemFunction.h b/unsupported/Eigen/src/MatrixFunctions/StemFunction.h
index 260690b..3de68ec 100644
--- a/unsupported/Eigen/src/MatrixFunctions/StemFunction.h
+++ b/unsupported/Eigen/src/MatrixFunctions/StemFunction.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_STEM_FUNCTION
 #define EIGEN_STEM_FUNCTION
 
+namespace Eigen { 
+
 /** \ingroup MatrixFunctions_Module 
   * \brief Stem functions corresponding to standard mathematical functions.
   */
@@ -113,4 +115,6 @@
 
 }; // end of class StdStemFunctions
 
+} // end namespace Eigen
+
 #endif // EIGEN_STEM_FUNCTION
diff --git a/unsupported/Eigen/src/MoreVectorization/MathFunctions.h b/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
index bc948d0..123f401 100644
--- a/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
+++ b/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
@@ -26,6 +26,8 @@
 #ifndef EIGEN_MOREVECTORIZATION_MATHFUNCTIONS_H
 #define EIGEN_MOREVECTORIZATION_MATHFUNCTIONS_H
 
+namespace Eigen { 
+
 namespace internal {
 
 /** \internal \returns the arcsin of \a a (coeff-wise) */
@@ -99,8 +101,10 @@
   return _mm_xor_ps(z, sign_bit);
 }
 
+#endif // EIGEN_VECTORIZE_SSE
+
 } // end namespace internal
 
-#endif
+} // end namespace Eigen
 
 #endif // EIGEN_MOREVECTORIZATION_MATHFUNCTIONS_H
diff --git a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
index 37abb61..aa94303 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
@@ -28,6 +28,8 @@
 #ifndef EIGEN_HYBRIDNONLINEARSOLVER_H
 #define EIGEN_HYBRIDNONLINEARSOLVER_H
 
+namespace Eigen { 
+
 namespace HybridNonLinearSolverSpace { 
     enum Status {
         Running = -1,
@@ -602,6 +604,8 @@
     return status;
 }
 
-//vim: ai ts=4 sts=4 et sw=4
+} // end namespace Eigen
+
 #endif // EIGEN_HYBRIDNONLINEARSOLVER_H
 
+//vim: ai ts=4 sts=4 et sw=4
diff --git a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
index 0ae681b..2fc50fb 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
@@ -28,6 +28,7 @@
 #ifndef EIGEN_LEVENBERGMARQUARDT__H
 #define EIGEN_LEVENBERGMARQUARDT__H
 
+namespace Eigen { 
 
 namespace LevenbergMarquardtSpace {
     enum Status {
@@ -651,6 +652,8 @@
     return info;
 }
 
-//vim: ai ts=4 sts=4 et sw=4
+} // end namespace Eigen
+
 #endif // EIGEN_LEVENBERGMARQUARDT__H
 
+//vim: ai ts=4 sts=4 et sw=4
diff --git a/unsupported/Eigen/src/NonLinearOptimization/chkder.h b/unsupported/Eigen/src/NonLinearOptimization/chkder.h
index bc0cb18..fd3e0bc 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/chkder.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/chkder.h
@@ -2,6 +2,8 @@
 #define chkder_log10e 0.43429448190325182765
 #define chkder_factor 100.
 
+namespace Eigen { 
+
 namespace internal {
 
 template<typename Scalar>
@@ -58,3 +60,4 @@
 
 } // end namespace internal
 
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/covar.h b/unsupported/Eigen/src/NonLinearOptimization/covar.h
index 6c77916..c73a096 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/covar.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/covar.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 template <typename Scalar>
@@ -63,3 +65,5 @@
 }
 
 } // end namespace internal
+
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/dogleg.h b/unsupported/Eigen/src/NonLinearOptimization/dogleg.h
index cbdcf4b..4fbc98b 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/dogleg.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/dogleg.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 template <typename Scalar>
@@ -98,3 +100,5 @@
 }
 
 } // end namespace internal
+
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h b/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h
index 0a26c20..1cabe69 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 template<typename FunctorType, typename Scalar>
@@ -70,3 +72,5 @@
 }
 
 } // end namespace internal
+
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h
index 62f4aab..cc1ca53 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/lmpar.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/lmpar.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 template <typename Scalar>
@@ -288,3 +290,5 @@
 }
 
 } // end namespace internal
+
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h b/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h
index cb1764a..feafd62 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 // TODO : once qrsolv2 is removed, use ColPivHouseholderQR or PermutationMatrix instead of ipvt
@@ -85,3 +87,5 @@
 }
 
 } // end namespace internal
+
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h b/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h
index ffe505c..36ff700 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 // TODO : move this to GivensQR once there's such a thing in Eigen
@@ -24,3 +26,5 @@
 }
 
 } // end namespace internal
+
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/r1updt.h b/unsupported/Eigen/src/NonLinearOptimization/r1updt.h
index 528f8ee..55fae5a 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/r1updt.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/r1updt.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 template <typename Scalar>
@@ -93,3 +95,5 @@
 }
 
 } // end namespace internal
+
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h b/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h
index ab83f9b..9ce079e 100644
--- a/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h
+++ b/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h
@@ -1,3 +1,5 @@
+namespace Eigen { 
+
 namespace internal {
 
 template <typename Scalar>
@@ -44,3 +46,4 @@
 
 } // end namespace internal
 
+} // end namespace Eigen
diff --git a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h
index 52dc0ec..36df9f5 100644
--- a/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h
+++ b/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h
@@ -28,6 +28,8 @@
 #ifndef EIGEN_NUMERICAL_DIFF_H
 #define EIGEN_NUMERICAL_DIFF_H
 
+namespace Eigen { 
+
 enum NumericalDiffMode {
     Forward,
     Central
@@ -134,6 +136,8 @@
     NumericalDiff& operator=(const NumericalDiff&);
 };
 
+} // end namespace Eigen
+
 //vim: ai ts=4 sts=4 et sw=4
 #endif // EIGEN_NUMERICAL_DIFF_H
 
diff --git a/unsupported/Eigen/src/Polynomials/Companion.h b/unsupported/Eigen/src/Polynomials/Companion.h
index 608951d..8936b8f 100644
--- a/unsupported/Eigen/src/Polynomials/Companion.h
+++ b/unsupported/Eigen/src/Polynomials/Companion.h
@@ -29,10 +29,12 @@
 // * Eigen/Core
 // * Eigen/src/PolynomialSolver.h
 
-#ifndef EIGEN_PARSED_BY_DOXYGEN
+namespace Eigen { 
 
 namespace internal {
 
+#ifndef EIGEN_PARSED_BY_DOXYGEN
+
 template <typename T>
 T radix(){ return 2; }
 
@@ -283,4 +285,6 @@
 
 } // end namespace internal
 
+} // end namespace Eigen
+
 #endif // EIGEN_COMPANION_H
diff --git a/unsupported/Eigen/src/Polynomials/PolynomialSolver.h b/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
index 417b93d..71295a1 100644
--- a/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
+++ b/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_POLYNOMIAL_SOLVER_H
 #define EIGEN_POLYNOMIAL_SOLVER_H
 
+namespace Eigen { 
+
 /** \ingroup Polynomials_Module
  *  \class PolynomialSolverBase.
  *
@@ -394,4 +396,6 @@
     using                   PS_Base::m_roots;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_POLYNOMIAL_SOLVER_H
diff --git a/unsupported/Eigen/src/Polynomials/PolynomialUtils.h b/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
index 65942c5..1fb1ed1 100644
--- a/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
+++ b/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_POLYNOMIAL_UTILS_H
 #define EIGEN_POLYNOMIAL_UTILS_H
 
+namespace Eigen { 
+
 /** \ingroup Polynomials_Module
  * \returns the evaluation of the polynomial at x using Horner algorithm.
  *
@@ -149,5 +151,6 @@
   }
 }
 
+} // end namespace Eigen
 
 #endif // EIGEN_POLYNOMIAL_UTILS_H
diff --git a/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h b/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h
index 5153740..ef36ac9 100644
--- a/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h
+++ b/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_SKYLINEINPLACELU_H
 #define EIGEN_SKYLINEINPLACELU_H
 
+namespace Eigen { 
+
 /** \ingroup Skyline_Module
  *
  * \class SkylineInplaceLU
@@ -360,4 +362,6 @@
     return true;
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_SKYLINELU_H
diff --git a/unsupported/Eigen/src/Skyline/SkylineMatrix.h b/unsupported/Eigen/src/Skyline/SkylineMatrix.h
index 31810df..98a19ce 100644
--- a/unsupported/Eigen/src/Skyline/SkylineMatrix.h
+++ b/unsupported/Eigen/src/Skyline/SkylineMatrix.h
@@ -28,6 +28,8 @@
 #include "SkylineStorage.h"
 #include "SkylineMatrixBase.h"
 
+namespace Eigen { 
+
 /** \ingroup Skyline_Module
  *
  * \class SkylineMatrix
@@ -870,4 +872,6 @@
     const Index m_end;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_SkylineMatrix_H
diff --git a/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h b/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h
index 4d0c239..72131eb 100644
--- a/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h
+++ b/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h
@@ -27,6 +27,8 @@
 
 #include "SkylineUtil.h"
 
+namespace Eigen { 
+
 /** \ingroup Skyline_Module
  *
  * \class SkylineMatrixBase
@@ -220,4 +222,6 @@
     bool m_isRValue;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_SkylineMatrixBase_H
diff --git a/unsupported/Eigen/src/Skyline/SkylineProduct.h b/unsupported/Eigen/src/Skyline/SkylineProduct.h
index aeedc47..fb653b4 100644
--- a/unsupported/Eigen/src/Skyline/SkylineProduct.h
+++ b/unsupported/Eigen/src/Skyline/SkylineProduct.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_SKYLINEPRODUCT_H
 #define EIGEN_SKYLINEPRODUCT_H
 
+namespace Eigen { 
+
 template<typename Lhs, typename Rhs, int ProductMode>
 struct SkylineProductReturnType {
     typedef const typename internal::nested<Lhs, Rhs::RowsAtCompileTime>::type LhsNested;
@@ -303,4 +305,6 @@
     return typename SkylineProductReturnType<Derived, OtherDerived>::Type(derived(), other.derived());
 }
 
+} // end namespace Eigen
+
 #endif // EIGEN_SKYLINEPRODUCT_H
diff --git a/unsupported/Eigen/src/Skyline/SkylineStorage.h b/unsupported/Eigen/src/Skyline/SkylineStorage.h
index 62806bf..5721dee 100644
--- a/unsupported/Eigen/src/Skyline/SkylineStorage.h
+++ b/unsupported/Eigen/src/Skyline/SkylineStorage.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_SKYLINE_STORAGE_H
 #define EIGEN_SKYLINE_STORAGE_H
 
+namespace Eigen { 
+
 /** Stores a skyline set of values in three structures :
  * The diagonal elements
  * The upper elements
@@ -267,4 +269,6 @@
 
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_COMPRESSED_STORAGE_H
diff --git a/unsupported/Eigen/src/Skyline/SkylineUtil.h b/unsupported/Eigen/src/Skyline/SkylineUtil.h
index e051247..5c5bd8b 100644
--- a/unsupported/Eigen/src/Skyline/SkylineUtil.h
+++ b/unsupported/Eigen/src/Skyline/SkylineUtil.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_SKYLINEUTIL_H
 #define EIGEN_SKYLINEUTIL_H
 
+namespace Eigen { 
+
 #ifdef NDEBUG
 #define EIGEN_DBG_SKYLINE(X)
 #else
@@ -97,5 +99,6 @@
 
 } // end namespace internal
 
+} // end namespace Eigen
 
 #endif // EIGEN_SKYLINEUTIL_H
diff --git a/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h b/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h
index 7536437..0cc6e3a 100644
--- a/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h
+++ b/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h
@@ -25,6 +25,7 @@
 #ifndef EIGEN_SPARSE_BLOCKFORDYNAMICMATRIX_H
 #define EIGEN_SPARSE_BLOCKFORDYNAMICMATRIX_H
 
+namespace Eigen { 
 
 /***************************************************************************
 * specialisation for DynamicSparseMatrix
@@ -123,5 +124,6 @@
 
 };
 
+} // end namespace Eigen
 
 #endif // EIGEN_SPARSE_BLOCKFORDYNAMICMATRIX_H
diff --git a/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h b/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
index d43149a..151d465 100644
--- a/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
+++ b/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_DYNAMIC_SPARSEMATRIX_H
 #define EIGEN_DYNAMIC_SPARSEMATRIX_H
 
+namespace Eigen { 
+
 /** \deprecated use a SparseMatrix in an uncompressed mode
   *
   * \class DynamicSparseMatrix
@@ -365,4 +367,6 @@
     const Index m_outer;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_DYNAMIC_SPARSEMATRIX_H
diff --git a/unsupported/Eigen/src/SparseExtra/MarketIO.h b/unsupported/Eigen/src/SparseExtra/MarketIO.h
index 3b10391..d034d8e 100644
--- a/unsupported/Eigen/src/SparseExtra/MarketIO.h
+++ b/unsupported/Eigen/src/SparseExtra/MarketIO.h
@@ -25,6 +25,9 @@
 
 #ifndef EIGEN_SPARSE_MARKET_IO_H
 #define EIGEN_SPARSE_MARKET_IO_H
+
+namespace Eigen { 
+
 namespace internal 
 {
   template <typename Scalar>
@@ -274,4 +277,7 @@
   out.close();
   return true; 
 }
+
+} // end namespace Eigen
+
 #endif // EIGEN_SPARSE_MARKET_IO_H
diff --git a/unsupported/Eigen/src/SparseExtra/RandomSetter.h b/unsupported/Eigen/src/SparseExtra/RandomSetter.h
index b4e6afb..9328c60 100644
--- a/unsupported/Eigen/src/SparseExtra/RandomSetter.h
+++ b/unsupported/Eigen/src/SparseExtra/RandomSetter.h
@@ -25,6 +25,8 @@
 #ifndef EIGEN_RANDOMSETTER_H
 #define EIGEN_RANDOMSETTER_H
 
+namespace Eigen { 
+
 /** Represents a std::map
   *
   * \see RandomSetter
@@ -335,4 +337,6 @@
     unsigned char m_keyBitsOffset;
 };
 
+} // end namespace Eigen
+
 #endif // EIGEN_RANDOMSETTER_H
diff --git a/unsupported/doc/Doxyfile.in b/unsupported/doc/Doxyfile.in
index bb9da3b..1facf29 100644
--- a/unsupported/doc/Doxyfile.in
+++ b/unsupported/doc/Doxyfile.in
@@ -552,7 +552,6 @@
 # with spaces.
 
 INPUT                  = "${Eigen_SOURCE_DIR}/unsupported/Eigen" \
-                         "${Eigen_SOURCE_DIR}/unsupported/Eigen/src/Splines" \
                          "${Eigen_SOURCE_DIR}/unsupported/doc"
 
 # This tag can be used to specify the character encoding of the source files
@@ -576,13 +575,14 @@
 # should be searched for input files as well. Possible values are YES and NO.
 # If left blank NO is used.
 
-RECURSIVE              = NO
+RECURSIVE              = YES
 
 # The EXCLUDE tag can be used to specify files and/or directories that should
 # excluded from the INPUT source files. This way you can easily exclude a
 # subdirectory from a directory tree whose root is specified with the INPUT tag.
 
-EXCLUDE                =
+EXCLUDE                = "${Eigen_SOURCE_DIR}/unsupported/doc/examples" \
+                         "${Eigen_SOURCE_DIR}/unsupported/doc/snippets" 
 
 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
 # directories that are symbolic links (a Unix filesystem feature) are excluded