Squashed 'third_party/eigen/' content from commit 61d72f6

Change-Id: Iccc90fa0b55ab44037f018046d2fcffd90d9d025
git-subtree-dir: third_party/eigen
git-subtree-split: 61d72f6383cfa842868c53e30e087b0258177257
diff --git a/bench/btl/cmake/FindACML.cmake b/bench/btl/cmake/FindACML.cmake
new file mode 100644
index 0000000..f45ae1b
--- /dev/null
+++ b/bench/btl/cmake/FindACML.cmake
@@ -0,0 +1,49 @@
+
+if (ACML_LIBRARIES)
+  set(ACML_FIND_QUIETLY TRUE)
+endif (ACML_LIBRARIES)
+
+find_library(ACML_LIBRARIES
+  NAMES
+  acml_mp acml_mv
+  PATHS
+  $ENV{ACMLDIR}/lib
+  $ENV{ACML_DIR}/lib
+  ${LIB_INSTALL_DIR}
+)
+
+find_file(ACML_LIBRARIES
+  NAMES
+  libacml_mp.so
+  PATHS
+  /usr/lib
+  $ENV{ACMLDIR}/lib
+  ${LIB_INSTALL_DIR}
+)
+
+if(NOT ACML_LIBRARIES)
+    message(STATUS "Multi-threaded library not found, looking for single-threaded")
+    find_library(ACML_LIBRARIES
+        NAMES
+        acml acml_mv
+        PATHS
+        $ENV{ACMLDIR}/lib
+        $ENV{ACML_DIR}/lib
+        ${LIB_INSTALL_DIR}
+        )
+    find_file(ACML_LIBRARIES
+        libacml.so libacml_mv.so
+        PATHS
+        /usr/lib
+        $ENV{ACMLDIR}/lib
+        ${LIB_INSTALL_DIR}
+        )
+endif()
+
+
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ACML DEFAULT_MSG ACML_LIBRARIES)
+
+mark_as_advanced(ACML_LIBRARIES)
diff --git a/bench/btl/cmake/FindATLAS.cmake b/bench/btl/cmake/FindATLAS.cmake
new file mode 100644
index 0000000..6b90652
--- /dev/null
+++ b/bench/btl/cmake/FindATLAS.cmake
@@ -0,0 +1,39 @@
+
+if (ATLAS_LIBRARIES)
+  set(ATLAS_FIND_QUIETLY TRUE)
+endif (ATLAS_LIBRARIES)
+
+find_file(ATLAS_LIB libatlas.so.3 PATHS /usr/lib $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+find_library(ATLAS_LIB atlas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+
+find_file(ATLAS_CBLAS libcblas.so.3 PATHS /usr/lib $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+find_library(ATLAS_CBLAS cblas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+
+find_file(ATLAS_LAPACK liblapack_atlas.so.3 PATHS /usr/lib $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+find_library(ATLAS_LAPACK lapack_atlas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+
+if(NOT ATLAS_LAPACK)
+  find_file(ATLAS_LAPACK liblapack.so.3 PATHS /usr/lib/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+  find_library(ATLAS_LAPACK lapack PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+endif(NOT ATLAS_LAPACK)
+
+find_file(ATLAS_F77BLAS libf77blas.so.3 PATHS /usr/lib $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+find_library(ATLAS_F77BLAS f77blas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR})
+
+if(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS)
+
+  set(ATLAS_LIBRARIES ${ATLAS_LAPACK} ${ATLAS_CBLAS}  ${ATLAS_F77BLAS} ${ATLAS_LIB})
+  
+  # search the default lapack lib link to it
+  find_file(ATLAS_REFERENCE_LAPACK liblapack.so.3 PATHS /usr/lib /usr/lib64)
+  find_library(ATLAS_REFERENCE_LAPACK NAMES lapack)
+  if(ATLAS_REFERENCE_LAPACK)
+    set(ATLAS_LIBRARIES ${ATLAS_LIBRARIES} ${ATLAS_REFERENCE_LAPACK})
+  endif()
+  
+endif(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ATLAS DEFAULT_MSG ATLAS_LIBRARIES)
+
+mark_as_advanced(ATLAS_LIBRARIES)
diff --git a/bench/btl/cmake/FindBlitz.cmake b/bench/btl/cmake/FindBlitz.cmake
new file mode 100644
index 0000000..92880bb
--- /dev/null
+++ b/bench/btl/cmake/FindBlitz.cmake
@@ -0,0 +1,40 @@
+# - Try to find blitz lib
+# Once done this will define
+#
+#  BLITZ_FOUND - system has blitz lib
+#  BLITZ_INCLUDES - the blitz include directory
+#  BLITZ_LIBRARIES - The libraries needed to use blitz
+
+# Copyright (c) 2006, Montel Laurent, <montel@kde.org>
+# Copyright (c) 2007, Allen Winter, <winter@kde.org>
+# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# include(FindLibraryWithDebug)
+
+if (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
+  set(Blitz_FIND_QUIETLY TRUE)
+endif (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
+
+find_path(BLITZ_INCLUDES
+  NAMES
+  blitz/array.h
+  PATH_SUFFIXES blitz*
+  PATHS
+  $ENV{BLITZDIR}/include
+  ${INCLUDE_INSTALL_DIR}
+)
+
+find_library(BLITZ_LIBRARIES
+  blitz
+  PATHS
+  $ENV{BLITZDIR}/lib
+  ${LIB_INSTALL_DIR}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Blitz DEFAULT_MSG
+                                  BLITZ_INCLUDES BLITZ_LIBRARIES)
+
+mark_as_advanced(BLITZ_INCLUDES BLITZ_LIBRARIES)
diff --git a/bench/btl/cmake/FindCBLAS.cmake b/bench/btl/cmake/FindCBLAS.cmake
new file mode 100644
index 0000000..554f029
--- /dev/null
+++ b/bench/btl/cmake/FindCBLAS.cmake
@@ -0,0 +1,34 @@
+# include(FindLibraryWithDebug)
+
+if (CBLAS_INCLUDES AND CBLAS_LIBRARIES)
+  set(CBLAS_FIND_QUIETLY TRUE)
+endif (CBLAS_INCLUDES AND CBLAS_LIBRARIES)
+
+find_path(CBLAS_INCLUDES
+  NAMES
+  cblas.h
+  PATHS
+  $ENV{CBLASDIR}/include
+  ${INCLUDE_INSTALL_DIR}
+)
+
+find_library(CBLAS_LIBRARIES
+  cblas
+  PATHS
+  $ENV{CBLASDIR}/lib
+  ${LIB_INSTALL_DIR}
+)
+
+find_file(CBLAS_LIBRARIES
+  libcblas.so.3
+  PATHS
+  /usr/lib
+  $ENV{CBLASDIR}/lib
+  ${LIB_INSTALL_DIR}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CBLAS DEFAULT_MSG
+                                  CBLAS_INCLUDES CBLAS_LIBRARIES)
+
+mark_as_advanced(CBLAS_INCLUDES CBLAS_LIBRARIES)
diff --git a/bench/btl/cmake/FindGMM.cmake b/bench/btl/cmake/FindGMM.cmake
new file mode 100644
index 0000000..5049c64
--- /dev/null
+++ b/bench/btl/cmake/FindGMM.cmake
@@ -0,0 +1,17 @@
+if (GMM_INCLUDE_DIR)
+  # in cache already
+  set(GMM_FOUND TRUE)
+else (GMM_INCLUDE_DIR)
+
+find_path(GMM_INCLUDE_DIR NAMES gmm/gmm.h
+     PATHS
+     ${INCLUDE_INSTALL_DIR}
+     ${GMM_INCLUDE_PATH}
+   )
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMM DEFAULT_MSG GMM_INCLUDE_DIR )
+
+mark_as_advanced(GMM_INCLUDE_DIR)
+
+endif(GMM_INCLUDE_DIR)
diff --git a/bench/btl/cmake/FindGOTO.cmake b/bench/btl/cmake/FindGOTO.cmake
new file mode 100644
index 0000000..67ea093
--- /dev/null
+++ b/bench/btl/cmake/FindGOTO.cmake
@@ -0,0 +1,15 @@
+
+if (GOTO_LIBRARIES)
+  set(GOTO_FIND_QUIETLY TRUE)
+endif (GOTO_LIBRARIES)
+
+find_library(GOTO_LIBRARIES goto PATHS $ENV{GOTODIR} ${LIB_INSTALL_DIR})
+
+if(GOTO_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
+  set(GOTO_LIBRARIES ${GOTO_LIBRARIES} "-lpthread -lgfortran")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GOTO DEFAULT_MSG GOTO_LIBRARIES)
+
+mark_as_advanced(GOTO_LIBRARIES)
diff --git a/bench/btl/cmake/FindGOTO2.cmake b/bench/btl/cmake/FindGOTO2.cmake
new file mode 100644
index 0000000..baa68d2
--- /dev/null
+++ b/bench/btl/cmake/FindGOTO2.cmake
@@ -0,0 +1,25 @@
+
+if (GOTO2_LIBRARIES)
+  set(GOTO2_FIND_QUIETLY TRUE)
+endif (GOTO2_LIBRARIES)
+# 
+# find_path(GOTO_INCLUDES
+#   NAMES
+#   cblas.h
+#   PATHS
+#   $ENV{GOTODIR}/include
+#   ${INCLUDE_INSTALL_DIR}
+# )
+
+find_file(GOTO2_LIBRARIES libgoto2.so PATHS /usr/lib $ENV{GOTO2DIR} ${LIB_INSTALL_DIR})
+find_library(GOTO2_LIBRARIES goto2 PATHS $ENV{GOTO2DIR} ${LIB_INSTALL_DIR})
+
+if(GOTO2_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
+  set(GOTO2_LIBRARIES ${GOTO2_LIBRARIES} "-lpthread -lgfortran")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GOTO2 DEFAULT_MSG
+                                  GOTO2_LIBRARIES)
+
+mark_as_advanced(GOTO2_LIBRARIES)
diff --git a/bench/btl/cmake/FindMKL.cmake b/bench/btl/cmake/FindMKL.cmake
new file mode 100644
index 0000000..f4d7c6e
--- /dev/null
+++ b/bench/btl/cmake/FindMKL.cmake
@@ -0,0 +1,65 @@
+
+if (MKL_LIBRARIES)
+  set(MKL_FIND_QUIETLY TRUE)
+endif (MKL_LIBRARIES)
+
+if(CMAKE_MINOR_VERSION GREATER 4)
+
+if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+
+find_library(MKL_LIBRARIES
+  mkl_core
+  PATHS
+  $ENV{MKLLIB}
+  /opt/intel/mkl/*/lib/em64t
+  /opt/intel/Compiler/*/*/mkl/lib/em64t
+  ${LIB_INSTALL_DIR}
+)
+
+find_library(MKL_GUIDE
+  guide
+  PATHS
+  $ENV{MKLLIB}
+  /opt/intel/mkl/*/lib/em64t
+  /opt/intel/Compiler/*/*/mkl/lib/em64t
+  /opt/intel/Compiler/*/*/lib/intel64
+  ${LIB_INSTALL_DIR}
+)
+
+if(MKL_LIBRARIES AND MKL_GUIDE)
+  set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel_lp64 mkl_sequential ${MKL_GUIDE} pthread)
+endif()
+
+else(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+
+find_library(MKL_LIBRARIES
+  mkl_core
+  PATHS
+  $ENV{MKLLIB}
+  /opt/intel/mkl/*/lib/32
+  /opt/intel/Compiler/*/*/mkl/lib/32
+  ${LIB_INSTALL_DIR}
+)
+
+find_library(MKL_GUIDE
+  guide
+  PATHS
+  $ENV{MKLLIB}
+  /opt/intel/mkl/*/lib/32
+  /opt/intel/Compiler/*/*/mkl/lib/32
+  /opt/intel/Compiler/*/*/lib/intel32
+  ${LIB_INSTALL_DIR}
+)
+
+if(MKL_LIBRARIES AND MKL_GUIDE)
+  set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel mkl_sequential ${MKL_GUIDE} pthread)
+endif()
+
+endif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+
+endif(CMAKE_MINOR_VERSION GREATER 4)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES)
+
+mark_as_advanced(MKL_LIBRARIES)
diff --git a/bench/btl/cmake/FindMTL4.cmake b/bench/btl/cmake/FindMTL4.cmake
new file mode 100644
index 0000000..3de4909
--- /dev/null
+++ b/bench/btl/cmake/FindMTL4.cmake
@@ -0,0 +1,31 @@
+# - Try to find eigen2 headers
+# Once done this will define
+#
+#  MTL4_FOUND - system has eigen2 lib
+#  MTL4_INCLUDE_DIR - the eigen2 include directory
+#
+# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
+# Adapted from FindEigen.cmake:
+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (MTL4_INCLUDE_DIR)
+
+  # in cache already
+  set(MTL4_FOUND TRUE)
+
+else (MTL4_INCLUDE_DIR)
+
+find_path(MTL4_INCLUDE_DIR NAMES boost/numeric/mtl/mtl.hpp
+     PATHS
+     ${INCLUDE_INSTALL_DIR}
+   )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MTL4 DEFAULT_MSG MTL4_INCLUDE_DIR)
+
+mark_as_advanced(MTL4_INCLUDE_DIR)
+
+endif(MTL4_INCLUDE_DIR)
+
diff --git a/bench/btl/cmake/FindPackageHandleStandardArgs.cmake b/bench/btl/cmake/FindPackageHandleStandardArgs.cmake
new file mode 100644
index 0000000..7f122ed
--- /dev/null
+++ b/bench/btl/cmake/FindPackageHandleStandardArgs.cmake
@@ -0,0 +1,60 @@
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
+#
+# This macro is intended to be used in FindXXX.cmake modules files.
+# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
+# it also sets the <UPPERCASED_NAME>_FOUND variable.
+# The package is found if all variables listed are TRUE.
+# Example:
+#
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
+#
+# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and 
+# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
+# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, 
+# independent whether QUIET was used or not.
+#
+# If it is found, the location is reported using the VAR1 argument, so 
+# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
+# If the second argument is DEFAULT_MSG, the message in the failure case will 
+# be "Could NOT find LibXml2", if you don't like this message you can specify
+# your own custom failure message there.
+
+MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
+
+  IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    IF (${_NAME}_FIND_REQUIRED)
+      SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}")
+    ELSE (${_NAME}_FIND_REQUIRED)
+      SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}")
+    ENDIF (${_NAME}_FIND_REQUIRED)
+  ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    SET(_FAIL_MESSAGE "${_FAIL_MSG}")
+  ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+
+  STRING(TOUPPER ${_NAME} _NAME_UPPER)
+
+  SET(${_NAME_UPPER}_FOUND TRUE)
+  IF(NOT ${_VAR1})
+    SET(${_NAME_UPPER}_FOUND FALSE)
+  ENDIF(NOT ${_VAR1})
+
+  FOREACH(_CURRENT_VAR ${ARGN})
+    IF(NOT ${_CURRENT_VAR})
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ENDIF(NOT ${_CURRENT_VAR})
+  ENDFOREACH(_CURRENT_VAR)
+
+  IF (${_NAME_UPPER}_FOUND)
+    IF (NOT ${_NAME}_FIND_QUIETLY)
+        MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
+    ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+  ELSE (${_NAME_UPPER}_FOUND)
+    IF (${_NAME}_FIND_REQUIRED)
+        MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")
+    ELSE (${_NAME}_FIND_REQUIRED)
+      IF (NOT ${_NAME}_FIND_QUIETLY)
+        MESSAGE(STATUS "${_FAIL_MESSAGE}")
+      ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+    ENDIF (${_NAME}_FIND_REQUIRED)
+  ENDIF (${_NAME_UPPER}_FOUND)
+ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
diff --git a/bench/btl/cmake/FindTvmet.cmake b/bench/btl/cmake/FindTvmet.cmake
new file mode 100644
index 0000000..26a29d9
--- /dev/null
+++ b/bench/btl/cmake/FindTvmet.cmake
@@ -0,0 +1,32 @@
+# - Try to find tvmet headers
+# Once done this will define
+#
+#  TVMET_FOUND - system has tvmet lib
+#  TVMET_INCLUDE_DIR - the tvmet include directory
+#
+# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
+# Adapted from FindEigen.cmake:
+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (TVMET_INCLUDE_DIR)
+
+  # in cache already
+  set(TVMET_FOUND TRUE)
+
+else (TVMET_INCLUDE_DIR)
+
+find_path(TVMET_INCLUDE_DIR NAMES tvmet/tvmet.h
+     PATHS
+     ${TVMETDIR}/
+     ${INCLUDE_INSTALL_DIR}
+   )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Tvmet DEFAULT_MSG TVMET_INCLUDE_DIR)
+
+mark_as_advanced(TVMET_INCLUDE_DIR)
+
+endif(TVMET_INCLUDE_DIR)
+
diff --git a/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake b/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake
new file mode 100644
index 0000000..545048b
--- /dev/null
+++ b/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake
@@ -0,0 +1,31 @@
+# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
+# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
+# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(),
+# this will have two effects
+# 1 - CMake will not complain if the directory doesn't exist
+#     This makes sense if you want to distribute just one of the subdirs
+#     in a source package, e.g. just one of the subdirs in kdeextragear.
+# 2 - If the directory exists, it will offer an option to skip the 
+#     subdirectory.
+#     This is useful if you want to compile only a subset of all
+#     directories.
+
+# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
+   GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
+   IF(EXISTS ${_fullPath})
+      IF(${ARGC} EQUAL 2)
+        OPTION(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1})
+      ELSE(${ARGC} EQUAL 2)
+        OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE)
+      ENDIF(${ARGC} EQUAL 2)
+      IF(BUILD_${_dir})
+         ADD_SUBDIRECTORY(${_dir})
+      ENDIF(BUILD_${_dir})
+   ENDIF(EXISTS ${_fullPath})
+ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)