diff --git a/CMake/ARMA_FindACML.cmake b/CMake/ARMA_FindACML.cmake index 4241bf99f2d..42561cafda0 100644 --- a/CMake/ARMA_FindACML.cmake +++ b/CMake/ARMA_FindACML.cmake @@ -14,20 +14,20 @@ find_library(ACML_LIBRARY if (ACML_LIBRARY) set(ACML_LIBRARIES ${ACML_LIBRARY}) set(ACML_FOUND "YES") -else (ACML_LIBRARY) +else () set(ACML_FOUND "NO") -endif (ACML_LIBRARY) +endif () if (ACML_FOUND) if (NOT ACML_FIND_QUIETLY) message(STATUS "Found the ACML library: ${ACML_LIBRARIES}") - endif (NOT ACML_FIND_QUIETLY) -else (ACML_FOUND) + endif () +else () if (ACML_FIND_REQUIRED) message(FATAL_ERROR "Could not find the ACML library") - endif (ACML_FIND_REQUIRED) -endif (ACML_FOUND) + endif () +endif () # Deprecated declarations. get_filename_component (NATIVE_ACML_LIB_PATH ${ACML_LIBRARY} PATH) diff --git a/CMake/ARMA_FindACMLMP.cmake b/CMake/ARMA_FindACMLMP.cmake index 552103f7d29..47a192ced6f 100644 --- a/CMake/ARMA_FindACMLMP.cmake +++ b/CMake/ARMA_FindACMLMP.cmake @@ -14,20 +14,20 @@ find_library(ACMLMP_LIBRARY if (ACMLMP_LIBRARY) set(ACMLMP_LIBRARIES ${ACMLMP_LIBRARY}) set(ACMLMP_FOUND "YES") -else (ACMLMP_LIBRARY) +else () set(ACMLMP_FOUND "NO") -endif (ACMLMP_LIBRARY) +endif () if (ACMLMP_FOUND) if (NOT ACMLMP_FIND_QUIETLY) message(STATUS "Found the ACMLMP library: ${ACMLMP_LIBRARIES}") - endif (NOT ACMLMP_FIND_QUIETLY) -else (ACMLMP_FOUND) + endif () +else () if (ACMLMP_FIND_REQUIRED) message(FATAL_ERROR "Could not find the ACMLMP library") - endif (ACMLMP_FIND_REQUIRED) -endif (ACMLMP_FOUND) + endif () +endif () # Deprecated declarations. get_filename_component (NATIVE_ACMLMP_LIB_PATH ${ACMLMP_LIBRARY} PATH) diff --git a/CMake/ARMA_FindARPACK.cmake b/CMake/ARMA_FindARPACK.cmake index 7509d74b616..35edae7ccd5 100644 --- a/CMake/ARMA_FindARPACK.cmake +++ b/CMake/ARMA_FindARPACK.cmake @@ -31,9 +31,9 @@ endif () if (ARPACK_FOUND) if (NOT ARPACK_FIND_QUIETLY) message(STATUS "Found an ARPACK library: ${ARPACK_LIBRARY}") - endif (NOT ARPACK_FIND_QUIETLY) -else (ARPACK_FOUND) + endif () +else () if (ARPACK_FIND_REQUIRED) message(FATAL_ERROR "Could not find an ARPACK library") - endif (ARPACK_FIND_REQUIRED) -endif (ARPACK_FOUND) + endif () +endif () diff --git a/CMake/ARMA_FindBLAS.cmake b/CMake/ARMA_FindBLAS.cmake index b210804d36d..ff37b4fc79e 100644 --- a/CMake/ARMA_FindBLAS.cmake +++ b/CMake/ARMA_FindBLAS.cmake @@ -21,20 +21,20 @@ find_library(BLAS_LIBRARY if (BLAS_LIBRARY) set(BLAS_LIBRARIES ${BLAS_LIBRARY}) set(BLAS_FOUND "YES") -else (BLAS_LIBRARY) +else () set(BLAS_FOUND "NO") -endif (BLAS_LIBRARY) +endif () if (BLAS_FOUND) if (NOT BLAS_FIND_QUIETLY) message(STATUS "Found BLAS: ${BLAS_LIBRARIES}") - endif (NOT BLAS_FIND_QUIETLY) -else (BLAS_FOUND) + endif () +else () if (BLAS_FIND_REQUIRED) message(FATAL_ERROR "Could not find BLAS") - endif (BLAS_FIND_REQUIRED) -endif (BLAS_FOUND) + endif () +endif () # Deprecated declarations. get_filename_component (NATIVE_BLAS_LIB_PATH ${BLAS_LIBRARY} PATH) diff --git a/CMake/ARMA_FindCBLAS.cmake b/CMake/ARMA_FindCBLAS.cmake index 14d2cff02b4..da84c246b8f 100644 --- a/CMake/ARMA_FindCBLAS.cmake +++ b/CMake/ARMA_FindCBLAS.cmake @@ -22,20 +22,20 @@ find_library(CBLAS_LIBRARY if (CBLAS_LIBRARY AND CBLAS_INCLUDE_DIR) set(CBLAS_LIBRARIES ${CBLAS_LIBRARY}) set(CBLAS_FOUND "YES") -else (CBLAS_LIBRARY AND CBLAS_INCLUDE_DIR) +else () set(CBLAS_FOUND "NO") -endif (CBLAS_LIBRARY AND CBLAS_INCLUDE_DIR) +endif () if (CBLAS_FOUND) if (NOT CBLAS_FIND_QUIETLY) message(STATUS "Found a CBLAS library: ${CBLAS_LIBRARIES}") - endif (NOT CBLAS_FIND_QUIETLY) -else (CBLAS_FOUND) + endif () +else () if (CBLAS_FIND_REQUIRED) message(FATAL_ERROR "Could not find a CBLAS library") - endif (CBLAS_FIND_REQUIRED) -endif (CBLAS_FOUND) + endif () +endif () # Deprecated declarations. set (NATIVE_CBLAS_INCLUDE_PATH ${CBLAS_INCLUDE_DIR} ) diff --git a/CMake/ARMA_FindCLAPACK.cmake b/CMake/ARMA_FindCLAPACK.cmake index 21bedb46a0a..97a9792a318 100644 --- a/CMake/ARMA_FindCLAPACK.cmake +++ b/CMake/ARMA_FindCLAPACK.cmake @@ -23,20 +23,20 @@ find_library(CLAPACK_LIBRARY if (CLAPACK_LIBRARY AND CLAPACK_INCLUDE_DIR) set(CLAPACK_LIBRARIES ${CLAPACK_LIBRARY}) set(CLAPACK_FOUND "YES") -else (CLAPACK_LIBRARY AND CLAPACK_INCLUDE_DIR) +else () set(CLAPACK_FOUND "NO") -endif (CLAPACK_LIBRARY AND CLAPACK_INCLUDE_DIR) +endif () if (CLAPACK_FOUND) if (NOT CLAPACK_FIND_QUIETLY) message(STATUS "Found a CLAPACK library: ${CLAPACK_LIBRARIES}") - endif (NOT CLAPACK_FIND_QUIETLY) -else (CLAPACK_FOUND) + endif () +else () if (CLAPACK_FIND_REQUIRED) message(FATAL_ERROR "Could not find a CLAPACK library") - endif (CLAPACK_FIND_REQUIRED) -endif (CLAPACK_FOUND) + endif () +endif () # Deprecated declarations. set (NATIVE_CLAPACK_INCLUDE_PATH ${CLAPACK_INCLUDE_DIR} ) diff --git a/CMake/ARMA_FindLAPACK.cmake b/CMake/ARMA_FindLAPACK.cmake index 52e976e1fcd..b40d16d04c3 100644 --- a/CMake/ARMA_FindLAPACK.cmake +++ b/CMake/ARMA_FindLAPACK.cmake @@ -21,20 +21,20 @@ find_library(LAPACK_LIBRARY if (LAPACK_LIBRARY) set(LAPACK_LIBRARIES ${LAPACK_LIBRARY}) set(LAPACK_FOUND "YES") -else (LAPACK_LIBRARY) +else () set(LAPACK_FOUND "NO") -endif (LAPACK_LIBRARY) +endif () if (LAPACK_FOUND) if (NOT LAPACK_FIND_QUIETLY) message(STATUS "Found LAPACK: ${LAPACK_LIBRARIES}") - endif (NOT LAPACK_FIND_QUIETLY) -else (LAPACK_FOUND) + endif () +else () if (LAPACK_FIND_REQUIRED) message(FATAL_ERROR "Could not find LAPACK") - endif (LAPACK_FIND_REQUIRED) -endif (LAPACK_FOUND) + endif () +endif () # Deprecated declarations. get_filename_component (NATIVE_LAPACK_LIB_PATH ${LAPACK_LIBRARY} PATH) diff --git a/CMake/ARMA_FindMKL.cmake b/CMake/ARMA_FindMKL.cmake index f6615dd8f0e..452fa5a643c 100644 --- a/CMake/ARMA_FindMKL.cmake +++ b/CMake/ARMA_FindMKL.cmake @@ -13,9 +13,9 @@ set(MKL_NAMES ${MKL_NAMES} iomp5) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(MKL_NAMES ${MKL_NAMES} mkl_intel_lp64) -else(CMAKE_SIZEOF_VOID_P EQUAL 8) +else() set(MKL_NAMES ${MKL_NAMES} mkl_intel) -endif(CMAKE_SIZEOF_VOID_P EQUAL 8) +endif() foreach (MKL_NAME ${MKL_NAMES}) find_library(${MKL_NAME}_LIBRARY @@ -27,23 +27,23 @@ foreach (MKL_NAME ${MKL_NAMES}) if(TMP_LIBRARY) set(MKL_LIBRARIES ${MKL_LIBRARIES} ${TMP_LIBRARY}) - endif(TMP_LIBRARY) -endforeach(MKL_NAME) + endif() +endforeach() if (MKL_LIBRARIES) set(MKL_FOUND "YES") -else (MKL_LIBRARIES) +else () set(MKL_FOUND "NO") -endif (MKL_LIBRARIES) +endif () if (MKL_FOUND) if (NOT MKL_FIND_QUIETLY) message(STATUS "Found MKL libraries: ${MKL_LIBRARIES}") - endif (NOT MKL_FIND_QUIETLY) -else (MKL_FOUND) + endif () +else () if (MKL_FIND_REQUIRED) message(FATAL_ERROR "Could not find MKL libraries") - endif (MKL_FIND_REQUIRED) -endif (MKL_FOUND) + endif () +endif () # mark_as_advanced(MKL_LIBRARY) diff --git a/CMake/ARMA_FindOpenBLAS.cmake b/CMake/ARMA_FindOpenBLAS.cmake index 343c334b9ba..edfa27db83f 100644 --- a/CMake/ARMA_FindOpenBLAS.cmake +++ b/CMake/ARMA_FindOpenBLAS.cmake @@ -14,20 +14,20 @@ find_library(OpenBLAS_LIBRARY if (OpenBLAS_LIBRARY) set(OpenBLAS_LIBRARIES ${OpenBLAS_LIBRARY}) set(OpenBLAS_FOUND "YES") -else (OpenBLAS_LIBRARY) +else () set(OpenBLAS_FOUND "NO") -endif (OpenBLAS_LIBRARY) +endif () if (OpenBLAS_FOUND) if (NOT OpenBLAS_FIND_QUIETLY) message(STATUS "Found the OpenBLAS library: ${OpenBLAS_LIBRARIES}") - endif (NOT OpenBLAS_FIND_QUIETLY) -else (OpenBLAS_FOUND) + endif () +else () if (OpenBLAS_FIND_REQUIRED) message(FATAL_ERROR "Could not find the OpenBLAS library") - endif (OpenBLAS_FIND_REQUIRED) -endif (OpenBLAS_FOUND) + endif () +endif () # Deprecated declarations. get_filename_component (NATIVE_OpenBLAS_LIB_PATH ${OpenBLAS_LIBRARY} PATH) diff --git a/CMake/CreateArmaConfigInfo.cmake b/CMake/CreateArmaConfigInfo.cmake index 5860efa9a9e..ec9fdd6afe6 100644 --- a/CMake/CreateArmaConfigInfo.cmake +++ b/CMake/CreateArmaConfigInfo.cmake @@ -6,9 +6,9 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp") file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp" OLD_FILE_CONTENTS) -else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp") +else() set(OLD_FILE_CONTENTS "") -endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp") +endif() # If we are using Armadillo 5+, ARMA_64BIT_WORD is implicitly enabled. set(ARMA_HAS_64BIT_WORD 0) # This may be unnecessary. @@ -16,10 +16,10 @@ if(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5)) # ARMA_64BIT_WORD is only set if we are on a 64-bit system. if (CMAKE_SIZEOF_VOID_P EQUAL 8) set(ARMA_HAS_64BIT_WORD 1) - else (CMAKE_SIZEOF_VOID_P EQUAL 8) + else () set(ARMA_HAS_64BIT_WORD 0) - endif (CMAKE_SIZEOF_VOID_P EQUAL 8) -else(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5)) + endif () +else() # Otherwise, we'll need to open the config.hpp we are using and inspect the # setting of ARMA_64BIT_WORD. if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") @@ -33,19 +33,19 @@ else(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5)) "${ARMA_CONFIG}") string(LENGTH "${ARMA_HAS_64BIT_WORD_PRE}" ARMA_HAS_64BIT_WORD) - else(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") + else() # Assumes ARMA_64BIT_WORD is not set. message(WARNING "Armadillo configuration file (${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp) does not exist!") - endif(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") -endif(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5)) + endif() +endif() # Now use the value we gathered to generate the new file contents. if(ARMA_HAS_64BIT_WORD EQUAL 0) set(ARMA_64BIT_WORD_DEFINE "#define MLPACK_ARMA_NO64BIT_WORD") -else(ARMA_HAS_64BIT_WORD EQUAL 0) +else() set(ARMA_64BIT_WORD_DEFINE "#define MLPACK_ARMA_64BIT_WORD") -endif(ARMA_HAS_64BIT_WORD EQUAL 0) +endif() set(NEW_FILE_CONTENTS "/** @@ -77,7 +77,7 @@ if(NOT "${OLD_FILE_CONTENTS}" STREQUAL "${NEW_FILE_CONTENTS}") file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp") file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp" "${NEW_FILE_CONTENTS}") -endif(NOT "${OLD_FILE_CONTENTS}" STREQUAL "${NEW_FILE_CONTENTS}") +endif() diff --git a/CMake/CreateGitVersionHeader.cmake b/CMake/CreateGitVersionHeader.cmake index 1a7bad1a69c..a44e60face6 100644 --- a/CMake/CreateGitVersionHeader.cmake +++ b/CMake/CreateGitVersionHeader.cmake @@ -14,16 +14,16 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/gitversion.hpp) _OLD_GITVERSION_CONTENTS) string(REGEX REPLACE ".*return \"mlpack git-([0-9a-f]+)\".*" "\\1" OLD_GIT_REVISION ${_OLD_GITVERSION_CONTENTS}) -else(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/gitversion.hpp) +else() set(OLD_GIT_REVISION "notfound") -endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/gitversion.hpp) +endif() if("${OLD_GIT_REVISION}" STREQUAL "${NEW_GIT_REVISION}") message(STATUS "gitversion.hpp is already up to date.") -else("${OLD_GIT_REVISION}" STREQUAL "${NEW_GIT_REVISION}") +else() # Remove the old version. file(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/gitversion.hpp) file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/gitversion.hpp "return \"mlpack git-${NEW_GIT_REVISION}\";\n") message(STATUS "Updated gitversion.hpp.") -endif("${OLD_GIT_REVISION}" STREQUAL "${NEW_GIT_REVISION}") +endif() diff --git a/CMake/FindArmadillo.cmake b/CMake/FindArmadillo.cmake index 94e947fa2e6..1244f649363 100644 --- a/CMake/FindArmadillo.cmake +++ b/CMake/FindArmadillo.cmake @@ -60,10 +60,10 @@ if(ARMADILLO_INCLUDE_DIR) # WARNING: The number of spaces before the version name is not one. string(REGEX REPLACE ".*#define ARMA_VERSION_NAME\ +\"([0-9a-zA-Z\ _-]+)\".*" "\\1" ARMADILLO_VERSION_NAME "${_armadillo_HEADER_CONTENTS}") - endif(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/arma_version.hpp") + endif() set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}") -endif (ARMADILLO_INCLUDE_DIR) +endif () #====================== @@ -130,8 +130,7 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") set(HAVE_LAPACK true) set(HAVE_BLAS true) endif () - endif ((NOT "${ARMA_USE_LAPACK}" STREQUAL "") AND - (NOT "${ARMA_USE_BLAS}" STREQUAL "")) + endif () # If we haven't found BLAS, try. if (NOT "${ARMA_USE_BLAS}" STREQUAL "" AND NOT HAVE_BLAS) @@ -148,7 +147,7 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") if (CBLAS_FOUND) message(STATUS "Warning: both OpenBLAS and ATLAS have been found; " "ATLAS will not be used.") - endif (CBLAS_FOUND) + endif () message(STATUS "Using OpenBLAS for BLAS: ${OpenBLAS_LIBRARIES}") set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${OpenBLAS_LIBRARIES}") @@ -166,7 +165,7 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${BLAS_LIBRARIES}") set(HAVE_BLAS true) endif () - endif (NOT "${ARMA_USE_BLAS}" STREQUAL "" AND NOT HAVE_BLAS) + endif () # If we haven't found LAPACK, try. if (NOT "${ARMA_USE_LAPACK}" STREQUAL "" AND NOT HAVE_LAPACK) @@ -190,19 +189,19 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${LAPACK_LIBRARIES}") set(HAVE_LAPACK true) endif () - endif (NOT "${ARMA_USE_LAPACK}" STREQUAL "" AND NOT HAVE_LAPACK) + endif () if (NOT "${ARMA_USE_LAPACK}" STREQUAL "" AND NOT HAVE_LAPACK) message(FATAL_ERROR "Cannot find LAPACK library, but ARMA_USE_LAPACK is " "set. Try specifying LAPACK libraries manually by setting the " "LAPACK_LIBRARY variable.") - endif (NOT "${ARMA_USE_LAPACK}" STREQUAL "" AND NOT HAVE_LAPACK) + endif () if (NOT "${ARMA_USE_BLAS}" STREQUAL "" AND NOT HAVE_BLAS) message(FATAL_ERROR "Cannot find BLAS library, but ARMA_USE_BLAS is set. " "Try specifying BLAS libraries manually by setting the BLAS_LIBRARY " "variable.") - endif (NOT "${ARMA_USE_BLAS}" STREQUAL "" AND NOT HAVE_BLAS) + endif () # Search for ARPACK (or replacement). if (NOT "${ARMA_USE_ARPACK}" STREQUAL "") @@ -214,10 +213,10 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") message(FATAL_ERROR "ARMA_USE_ARPACK is defined in " "armadillo_bits/config.hpp, but ARPACK cannot be found. Try " "specifying ARPACK_LIBRARY.") - endif (NOT ARPACK_FOUND) + endif () set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${ARPACK_LIBRARY}") - endif (NOT "${ARMA_USE_ARPACK}" STREQUAL "") + endif () # Search for HDF5 (or replacement). if (NOT "${ARMA_USE_HDF5}" STREQUAL "") @@ -251,9 +250,9 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") set(SUPPORT_INCLUDE_DIRS "${SUPPORT_INCLUDE_DIRS}" "${HDF5_INCLUDE_DIRS}") set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${HDF5_LIBRARIES}") - endif (NOT "${ARMA_USE_HDF5}" STREQUAL "") + endif () - else("${ARMA_USE_WRAPPER}" STREQUAL "") + else() # Some older versions still require linking against HDF5 since they did not # wrap libhdf5. This was true for versions older than 4.300. if(NOT "${ARMA_USE_HDF5}" STREQUAL "" AND @@ -322,11 +321,11 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") set(SUPPORT_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS}") endif() - endif("${ARMA_USE_WRAPPER}" STREQUAL "") -else(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") + endif() +else() message(FATAL_ERROR "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp not " "found! Cannot determine what to link against.") -endif(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") +endif() if (ARMA_NEED_LIBRARY) # UNIX paths are standard, no need to write. @@ -341,13 +340,13 @@ if (ARMA_NEED_LIBRARY) REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR VERSION_VAR ARMADILLO_VERSION_STRING) # version_var fails with cmake < 2.8.4. -else (ARMA_NEED_LIBRARY) +else () # Checks 'REQUIRED', 'QUIET' and versions. include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Armadillo REQUIRED_VARS ARMADILLO_INCLUDE_DIR VERSION_VAR ARMADILLO_VERSION_STRING) -endif (ARMA_NEED_LIBRARY) +endif () if (ARMADILLO_FOUND) # Also include support include directories. @@ -355,11 +354,11 @@ if (ARMADILLO_FOUND) # Also include support libraries to link against. if (ARMA_NEED_LIBRARY) set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY} ${SUPPORT_LIBRARIES}) - else (ARMA_NEED_LIBRARY) + else () set(ARMADILLO_LIBRARIES ${SUPPORT_LIBRARIES}) - endif (ARMA_NEED_LIBRARY) + endif () message(STATUS "Armadillo libraries: ${ARMADILLO_LIBRARIES}") -endif (ARMADILLO_FOUND) +endif () # Hide internal variables diff --git a/CMake/FindBfd.cmake b/CMake/FindBfd.cmake index 19b1b5bd9c3..9f530bda211 100644 --- a/CMake/FindBfd.cmake +++ b/CMake/FindBfd.cmake @@ -18,7 +18,7 @@ if (LIBBFD_LIBRARIES AND LIBBFD_INCLUDE_DIRS) set (LIBBFD_FIND_QUIETLY TRUE) -endif (LIBBFD_LIBRARIES AND LIBBFD_INCLUDE_DIRS) +endif () find_path (LIBBFD_INCLUDE_DIRS NAMES diff --git a/CMake/FindMatlabMex.cmake b/CMake/FindMatlabMex.cmake index ec8b910a441..43b342c4a5b 100644 --- a/CMake/FindMatlabMex.cmake +++ b/CMake/FindMatlabMex.cmake @@ -21,16 +21,16 @@ if(WIN32) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${MATVER};MATLABROOT]" ABSOLUTE) set(MATLAB_VERSION ${MATVER}) - endif((NOT DEFINED MATLAB_ROOT) + endif() OR ("${MATLAB_ROOT}" STREQUAL "") OR ("${MATLAB_ROOT}" STREQUAL "/registry")) - endforeach(MATVER) + endforeach() find_program(MATLAB_MEX mex ${MATLAB_ROOT}/bin ) -else(WIN32) +else() # Check if this is a Mac. if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # This code is untested but taken from the older FindMatlab.cmake script as @@ -50,11 +50,11 @@ else(WIN32) if(EXISTS /Applications/MATLAB_${MATVER}.app) set(MATLAB_ROOT /Applications/MATLAB_${MATVER}.app) - endif(EXISTS /Applications/MATLAB_${MATVER}.app) - endif((NOT DEFINED MATLAB_ROOT) OR ("${MATLAB_ROOT}" STREQUAL "")) - endforeach(MATVER) + endif() + endif() + endforeach() - endif((NOT DEFINED MATLAB_ROOT) OR ("${MATLAB_ROOT}" STREQUAL "")) + endif() find_program(MATLAB_MEX mex @@ -62,7 +62,7 @@ else(WIN32) ${MATLAB_ROOT}/bin ) - else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + else() # On a Linux system. The goal is to find MATLAB_ROOT. set(LIBRARY_EXTENSION .so) @@ -89,18 +89,18 @@ else(WIN32) get_filename_component(MATLAB_BIN_ROOT "${MATLAB_MEX}" PATH) # Strip ./bin/. get_filename_component(MATLAB_ROOT "${MATLAB_BIN_ROOT}" PATH) - endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -endif(WIN32) + endif() +endif() if(NOT EXISTS "${MATLAB_MEX}" AND "${MatlabMex_FIND_REQUIRED}") message(FATAL_ERROR "Could not find MATLAB mex compiler; try specifying MATLAB_ROOT.") -else(NOT EXISTS "${MATLAB_MEX}" AND "${MatlabMex_FIND_REQUIRED}") +else() if(EXISTS "${MATLAB_MEX}") message(STATUS "Found MATLAB mex compiler: ${MATLAB_MEX}") message(STATUS "MATLAB root: ${MATLAB_ROOT}") set(MATLABMEX_FOUND 1) - endif(EXISTS "${MATLAB_MEX}") -endif(NOT EXISTS "${MATLAB_MEX}" AND "${MatlabMex_FIND_REQUIRED}") + endif() +endif() mark_as_advanced( MATLAB_MEX diff --git a/CMake/ModifyMatlabPathdef.cmake b/CMake/ModifyMatlabPathdef.cmake index 419c368e239..c05b3f89f61 100644 --- a/CMake/ModifyMatlabPathdef.cmake +++ b/CMake/ModifyMatlabPathdef.cmake @@ -19,7 +19,7 @@ if("${MLPACK_PATHDEF}" STREQUAL "") "${PATHDEF}") file(WRITE "${PATHDEF_OUTPUT_FILE}" "${MOD_PATHDEF}") -else("${MLPACK_PATHDEF}" STREQUAL "") +else() # Write unmodified file. file(WRITE "${PATHDEF_OUTPUT_FILE}" "${PATHDEF}") -endif("${MLPACK_PATHDEF}" STREQUAL "") +endif() diff --git a/CMake/TargetDistclean.cmake b/CMake/TargetDistclean.cmake index 87030d6c70e..2aad7e23b08 100644 --- a/CMake/TargetDistclean.cmake +++ b/CMake/TargetDistclean.cmake @@ -19,4 +19,4 @@ if (UNIX) COMMAND find ARGS ${FASTLIB_SOURCE_DIR} -depth -type d -iname CMakeFiles -exec rm -rf {} \; COMMAND rm ARGS -rf bin lib include VERBATIM ) -endif(UNIX) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index b29034dcf07..19cb67f3680 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ include(CMake/CXX11.cmake) check_for_cxx11_compiler(HAS_CXX11) if(NOT HAS_CXX11) message(FATAL_ERROR "No C++11 compiler available!") -endif(NOT HAS_CXX11) +endif() enable_cxx11() # First, define all the compilation options. @@ -29,7 +29,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake") if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -ftemplate-depth=1000") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") -endif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +endif() # If using clang, we have to link against libc++ depending on the # OS (at least on some systems). Further, gcc sometimes optimizes calls to @@ -53,13 +53,13 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") - endif(${MACOSX_VERSION} LESS 9) - endif(APPLE) + endif() + endif() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lm") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lm") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lm") -endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +endif() # Debugging CFLAGS. Turn optimizations off; turn debugging symbols on. if(DEBUG) @@ -76,33 +76,33 @@ if(DEBUG) include_directories(${LIBBFD_INCLUDE_DIRS}) include_directories(${LIBDL_INCLUDE_DIRS}) add_definitions(-DHAS_BFD_DL) - else(LIBBFD_FOUND AND LIBDL_FOUND) + else() message(WARNING "No libBFD and/or libDL has been found!") - endif(LIBBFD_FOUND AND LIBDL_FOUND) - endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + endif() + endif() else() add_definitions(-DARMA_NO_DEBUG) add_definitions(-DNDEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -O3") -endif(DEBUG) +endif() # Profiling CFLAGS. Turn profiling information on. if(CMAKE_COMPILER_IS_GNUCC AND PROFILE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") -endif(CMAKE_COMPILER_IS_GNUCC AND PROFILE) +endif() # If the user asked for running test cases with verbose output, turn that on. if(TEST_VERBOSE) add_definitions(-DTEST_VERBOSE) -endif(TEST_VERBOSE) +endif() # If the user asked for extra Armadillo debugging output, turn that on. if(ARMA_EXTRA_DEBUG) add_definitions(-DARMA_EXTRA_DEBUG) -endif(ARMA_EXTRA_DEBUG) +endif() # Now, find the libraries we need to compile against. Several variables can be # set to manually specify the directory in which each of these libraries @@ -125,12 +125,12 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(ARMA_HAS_64BIT_WORD 0) if(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5)) set(ARMA_HAS_64BIT_WORD 1) - else(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5)) + else() # Can we open the configuration file? If not, issue a warning. if(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") message(WARNING "Armadillo configuration file " "(${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp) does not exist!") - else(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") + else() # We are on a 64-bit system. Does Armadillo have ARMA_64BIT_WORD enabled? file(READ "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp" ARMA_CONFIG) string(REGEX MATCH @@ -139,8 +139,8 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) "${ARMA_CONFIG}") string(LENGTH "${ARMA_HAS_64BIT_WORD_PRE}" ARMA_HAS_64BIT_WORD) - endif(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp") - endif(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5)) + endif() + endif() if(ARMA_HAS_64BIT_WORD EQUAL 0) message(WARNING "This is a 64-bit system, but Armadillo was compiled " @@ -148,15 +148,15 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) "ARMA_64BIT_WORD to enable 64-bit indices (large matrix support). " "mlpack will still work without ARMA_64BIT_WORD defined, but will not " "scale to matrices with more than 4 billion elements.") - endif(ARMA_HAS_64BIT_WORD EQUAL 0) -else(CMAKE_SIZEOF_VOID_P EQUAL 8) + endif() +else() # If we are on a 32-bit system, we must manually specify the size of the word # to be 32 bits, since otherwise Armadillo will produce a warning that it is # disabling 64-bit support. if (CMAKE_SIZEOF_VOID_P EQUAL 4) add_definitions(-DARMA_32BIT_WORD) - endif (CMAKE_SIZEOF_VOID_P EQUAL 4) -endif(CMAKE_SIZEOF_VOID_P EQUAL 8) + endif () +endif() # On Windows, Armadillo should be using LAPACK and BLAS but we still need to # link against it. We don't want to use the FindLAPACK or FindBLAS modules @@ -171,7 +171,7 @@ if (WIN32) if (NOT LAPACK_LIBRARY) message(FATAL_ERROR "Cannot find LAPACK library (.lib)!") - endif (NOT LAPACK_LIBRARY) + endif () find_library(BLAS_LIBRARY NAMES blas libblas blas_win32_MT blas_win32 @@ -180,12 +180,12 @@ if (WIN32) if (NOT BLAS_LIBRARY) message(FATAL_ERROR "Cannot find BLAS library (.lib)!") - endif (NOT BLAS_LIBRARY) + endif () # Piggyback LAPACK and BLAS linking into Armadillo link. set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARIES} ${BLAS_LIBRARY} ${LAPACK_LIBRARY}) -endif (WIN32) +endif () # Include directories for the previous dependencies. include_directories(${ARMADILLO_INCLUDE_DIRS}) @@ -211,7 +211,7 @@ link_directories(${Boost_LIBRARY_DIRS}) if (MSVC) link_directories(${Boost_LIBRARY_DIRS}) set(Boost_LIBRARIES "") -endif (MSVC) +endif () # For Boost testing framework (will have no effect on non-testing executables). # This specifies to Boost that we are dynamically linking to the Boost test @@ -224,7 +224,7 @@ find_package(OpenMP) if (OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") -endif (OPENMP_FOUND) +endif () # Create a 'distclean' target in case the user is using an in-source build for # some reason. @@ -237,7 +237,7 @@ if (WIN32) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -else (WIN32) +else () # If not on Windows, put them under more standard UNIX-like places. This is # necessary, otherwise they would all end up in # ${CMAKE_BINARY_DIR}/src/mlpack/methods/... or somewhere else random like @@ -245,7 +245,7 @@ else (WIN32) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/) -endif (WIN32) +endif () # Determine whether or not this is a git repository, so that we can set the # version number if necessary. @@ -272,8 +272,8 @@ if (GIT_FOUND) # Add gitversion.hpp to the list of sources. set(MLPACK_SRCS ${MLPACK_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/gitversion.hpp") - endif (${MLPACK_TMP_REV_INFO_RESULT} EQUAL 0) -endif (GIT_FOUND) + endif () +endif () # Create a target to generate arma_config.hpp, which is used to warn the user # when they are doing something stupid when linking something against mlpack. @@ -296,7 +296,7 @@ add_subdirectory(src/mlpack) # depends on it. if (USING_GIT STREQUAL "YES") add_dependencies(mlpack mlpack_gitversion) -endif (USING_GIT STREQUAL "YES") +endif () # Make the mlpack_arma_config target depend on mlpack (we couldn't do this # before the add_subdirectory() call because the mlpack target didn't exist @@ -330,7 +330,7 @@ if (DOXYGEN_FOUND) COMPONENT doc OPTIONAL ) -endif (DOXYGEN_FOUND) +endif () # Make a target to generate the man page documentation, but only if we are on a # UNIX-like system. @@ -340,7 +340,7 @@ if (UNIX) # It's not a requirement that we make man pages. if (NOT TXT2MAN) message(WARNING "txt2man not found; man pages will not be generated.") - else (NOT TXT2MAN) + else () # We have the tools. We can make them. add_custom_target(man ALL ${CMAKE_CURRENT_SOURCE_DIR}/CMake/allexec2man.sh @@ -389,5 +389,5 @@ if (UNIX) # Set the rules to install the documentation. install(DIRECTORY ${CMAKE_BINARY_DIR}/share/man/ DESTINATION share/man/man1/) - endif (NOT TXT2MAN) -endif (UNIX) + endif () +endif () diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 8381e1c21a5..76e6f277258 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -51,6 +51,7 @@ Copyright: Copyright 2016, Barak Pearlmutter Copyright 2016, Ivari Horm Copyright 2016, Dhawal Arora + Copyright 2016, Alexander Leinoff License: BSD-3-clause All rights reserved. . diff --git a/src/mlpack/CMakeLists.txt b/src/mlpack/CMakeLists.txt index aace30fca42..df77a6d7339 100644 --- a/src/mlpack/CMakeLists.txt +++ b/src/mlpack/CMakeLists.txt @@ -21,9 +21,9 @@ endforeach() # every function signature. if (WIN32) add_library(mlpack ${MLPACK_SRCS}) -else (WIN32) +else () add_library(mlpack SHARED ${MLPACK_SRCS}) -endif (WIN32) +endif () target_link_libraries(mlpack ${ARMADILLO_LIBRARIES} ${Boost_LIBRARIES} @@ -39,15 +39,15 @@ set_target_properties(mlpack # rt: clock_gettime() if(UNIX AND NOT APPLE) target_link_libraries(mlpack rt) -endif(UNIX AND NOT APPLE) +endif() # Backtrace for Linux need those libs. if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(LIBBFD_FOUND AND LIBDL_FOUND AND DEBUG) target_link_libraries(mlpack ${LIBBFD_LIBRARIES}) target_link_libraries(mlpack ${LIBDL_LIBRARIES}) - endif(LIBBFD_FOUND AND LIBDL_FOUND AND DEBUG) -endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + endif() +endif() # Collect all header files in the library. file(GLOB_RECURSE INCLUDE_H_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) diff --git a/src/mlpack/bindings/CMakeLists.txt b/src/mlpack/bindings/CMakeLists.txt index 040456df09c..19aad5c2a75 100644 --- a/src/mlpack/bindings/CMakeLists.txt +++ b/src/mlpack/bindings/CMakeLists.txt @@ -1,4 +1,4 @@ # Recurse into individual binding subdirectories, if we are supposed to. if(MATLAB_BINDINGS) add_subdirectory(matlab) -endif(MATLAB_BINDINGS) +endif() diff --git a/src/mlpack/bindings/matlab/CMakeLists.txt b/src/mlpack/bindings/matlab/CMakeLists.txt index 6941c94e826..24ddbdec38a 100644 --- a/src/mlpack/bindings/matlab/CMakeLists.txt +++ b/src/mlpack/bindings/matlab/CMakeLists.txt @@ -41,7 +41,7 @@ if(UNIX) set(NEED_TO_WARN 0) endif(NOT ("${MEX_COMPILER_VERSION}" VERSION_LESS "${OTHER_COMPILER_VERSION}")) - endif(MEX_COMPILER_VERSION AND OTHER_COMPILER_VERSION) + endif() if(NEED_TO_WARN EQUAL 1) message(WARNING "The MATLAB runtime glibc is different than the system " @@ -55,16 +55,16 @@ if(UNIX) "an overly-detailed dissertation/rant on why it is not possible to " "work around this issue in any way, see\n" "http://www.mlpack.org/trac/ticket/253 for more information.") - endif(NEED_TO_WARN EQUAL 1) - endif(MEX_WARNING) -endif(UNIX) + endif() + endif() +endif() # Ignore the fact that we are setting CMAKE_SHARED_LIBRARY_CXX_FLAGS on CMake # 2.8.9 and newer. Because we are requiring at least CMake 2.8.5, we only have # to check the patch version. if(${CMAKE_PATCH_VERSION} GREATER 8) cmake_policy(SET CMP0018 OLD) -endif(${CMAKE_PATCH_VERSION} GREATER 8) +endif() # Use the mex compiler to compile. set(CMAKE_CXX_COMPILER "${MATLAB_MEX}") @@ -77,10 +77,10 @@ set(CMAKE_CXX_COMPILER "${MATLAB_MEX}") if(DEBUG) set(CMAKE_CXX_FLAGS "-g") set(CMAKE_C_FLAGS "-g") -else(DEBUG) +else() set(CMAKE_CXX_FLAGS "-O") set(CMAKE_C_FLAGS "-O") -endif(DEBUG) +endif() # Don't give -fPIC; mex will do that for us. set(CMAKE_SHARED_LIBRARY_C_FLAGS "") @@ -108,7 +108,7 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") set(CMAKE_SHARED_LIBRARY_SUFFIX ".mexglx") set(CMAKE_SHARED_MODULE_SUFFIX ".mexglx") -endif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") +endif() # Place MATLAB bindings in matlab/. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/matlab/) diff --git a/src/mlpack/core.hpp b/src/mlpack/core.hpp index 1e2965785ee..d762ea8585e 100644 --- a/src/mlpack/core.hpp +++ b/src/mlpack/core.hpp @@ -186,6 +186,7 @@ * - Barak Pearlmutter * - Ivari Horm * - Dhawal Arora + * - Alexander Leinoff */ // First, include all of the prerequisites.