Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sriram
2019-09-15 10:18:46 +05:30
9 changed files with 208 additions and 115 deletions
+11 -11
View File
@@ -11,9 +11,8 @@ environment:
boost_serialization-vc140.1.60.0.0/lib/native/address-model-64/lib/*.*"
BOOST_UNIT_TEST : "C:/projects/mlpack/\
boost_unit_test_framework-vc140.1.60.0.0/lib/native/address-model-64/lib/*.*"
ARMADILLO_DOWNLOAD : "http://sourceforge.net/projects/arma/files/\
armadillo-7.800.2.tar.xz"
ARMADILLO_LIBRARY : "C:/projects/mlpack/armadillo-7.800.2/\
ARMADILLO_DOWNLOAD : "http://ftp.fau.de/macports/distfiles/armadillo/armadillo-8.400.0.tar.xz"
ARMADILLO_LIBRARY : "C:/projects/mlpack/armadillo-8.400.0/\
build/Debug/armadillo.lib"
BLAS_LIBRARY : "%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/\
libopenblas.dll.a"
@@ -29,9 +28,11 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VSVER: Visual Studio 15 2017 Win64
MSBUILD: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
VSVER: Visual Studio 16 2019
MSBUILD: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
# Currently, the VS2019 build seems to always time out. This seems to be an
# AppVeyor issue.
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
# VSVER: Visual Studio 16 2019
# MSBUILD: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
configuration: Release
@@ -67,11 +68,10 @@ build_script:
- ps: cp ${env:BOOST_UNIT_TEST} C:\projects\mlpack\boost_libs\
- echo TEST_ARMA is %ARMADILLO_DOWNLOAD%
- >
if not exist armadillo.tar.xz
appveyor DownloadFile %ARMADILLO_DOWNLOAD%
-FileName armadillo.tar.xz
- 7z x armadillo.tar.xz -so | 7z x -si -ttar > nul
- cd armadillo-7.800.2 && mkdir build && cd build
- 7z x armadillo.tar.xz -so -txz | 7z x -si -ttar > nul
- cd armadillo-8.400.0 && mkdir build && cd build
- >
cmake -G "%VSVER%"
-DBLAS_LIBRARY:FILEPATH=%BLAS_LIBRARY%
@@ -80,14 +80,14 @@ build_script:
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=Release ..
- >
"%MSBUILD%" "C:\projects\mlpack\armadillo-7.800.2\build\armadillo.sln"
"%MSBUILD%" "C:\projects\mlpack\armadillo-8.400.0\build\armadillo.sln"
/m /verbosity:quiet /p:Configuration=Release;Platform=x64
- cd C:\projects\mlpack && mkdir build && cd build
- >
cmake -G "%VSVER%"
-DBLAS_LIBRARY:FILEPATH=%BLAS_LIBRARY%
-DLAPACK_LIBRARY:FILEPATH=%BLAS_LIBRARY%
-DARMADILLO_INCLUDE_DIR="C:/projects/mlpack/armadillo-7.800.2/include"
-DARMADILLO_INCLUDE_DIR="C:/projects/mlpack/armadillo-8.400.0/include"
-DARMADILLO_LIBRARY:FILEPATH=%ARMADILLO_LIBRARY%
-DBOOST_INCLUDEDIR:PATH=%BOOST_INCLUDE%
-DBOOST_LIBRARYDIR:PATH="C:/projects/mlpack/boost_libs"
+6 -6
View File
@@ -7,9 +7,9 @@ matrix:
env: CMAKE_OPTIONS="-DDEBUG=OFF -DPROFILE=OFF -DPYTHON_EXECUTABLE=/usr/bin/python"
before_install:
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated libopenblas-dev liblapack-dev g++ libboost-all-dev python-pip cython python-numpy python-pandas
- sudo apt-get install -y --allow-unauthenticated libopenblas-dev liblapack-dev g++ libboost-all-dev python-pip cython python-numpy python-pandas xz-utils
- sudo pip install --upgrade --ignore-installed setuptools cython
- curl https://ftp.fau.de/macports/distfiles/armadillo/armadillo-6.500.5.tar.gz | tar xvz && cd armadillo*
- curl https://ftp.fau.de/macports/distfiles/armadillo/armadillo-8.400.0.tar.xz | tar -xvJ && cd armadillo*
- cmake . && make && sudo make install && cd ..
- sudo cp .travis/config.hpp /usr/include/armadillo_bits/config.hpp
@@ -18,9 +18,9 @@ matrix:
env: CMAKE_OPTIONS="-DDEBUG=OFF -DPROFILE=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3"
before_install:
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated libopenblas-dev liblapack-dev g++ libboost-all-dev python3-pip cython3 python3-numpy
- sudo apt-get install -y --allow-unauthenticated libopenblas-dev liblapack-dev g++ libboost-all-dev python3-pip cython3 python3-numpy xz-utils
- sudo pip3 install --upgrade --ignore-installed setuptools cython pandas
- curl https://ftp.fau.de/macports/distfiles/armadillo/armadillo-6.500.5.tar.gz | tar xvz && cd armadillo*
- curl https://ftp.fau.de/macports/distfiles/armadillo/armadillo-8.400.0.tar.xz | tar -xvJ && cd armadillo*
- cmake . && make && sudo make install && cd ..
- sudo cp .travis/config.hpp /usr/include/armadillo_bits/config.hpp
@@ -29,8 +29,8 @@ matrix:
env: CMAKE_OPTIONS="-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF"
before_install:
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated libopenblas-dev liblapack-dev g++ libboost-all-dev
- curl https://ftp.fau.de/macports/distfiles/armadillo/armadillo-6.500.5.tar.gz | tar xvz && cd armadillo*
- sudo apt-get install -y --allow-unauthenticated libopenblas-dev liblapack-dev g++ libboost-all-dev xz-utils
- curl https://ftp.fau.de/macports/distfiles/armadillo/armadillo-8.400.0.tar.xz | tar -xvJ && cd armadillo*
- cmake . && make && sudo make install && cd ..
- sudo cp .travis/config.hpp /usr/include/armadillo_bits/config.hpp
+177 -49
View File
@@ -1,35 +1,65 @@
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2012 Conrad Sanderson
//
// This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness
// for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3
// of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info)
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 National ICT Australia (NICTA)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------------
#if !defined(ARMA_USE_LAPACK)
#define ARMA_USE_LAPACK
//// Uncomment the above line if you have LAPACK or a high-speed replacement for LAPACK,
//// such as Intel's MKL, AMD's ACML, or the Accelerate framework.
//// Comment out the above line if you don't have LAPACK or a high-speed replacement for LAPACK,
//// such as Intel MKL, AMD ACML, or the Accelerate framework.
//// LAPACK is required for matrix decompositions (eg. SVD) and matrix inverse.
#endif
#if !defined(ARMA_USE_BLAS)
#define ARMA_USE_BLAS
//// Uncomment the above line if you have BLAS or a high-speed replacement for BLAS,
//// such as GotoBLAS, Intel's MKL, AMD's ACML, or the Accelerate framework.
//// Comment out the above line if you don't have BLAS or a high-speed replacement for BLAS,
//// such as OpenBLAS, GotoBLAS, Intel MKL, AMD ACML, or the Accelerate framework.
//// BLAS is used for matrix multiplication.
//// Without BLAS, matrix multiplication will still work, but might be slower.
#endif
#if !defined(ARMA_USE_NEWARP)
#define ARMA_USE_NEWARP
//// Uncomment the above line to enable the built-in partial emulation of ARPACK.
//// This is used for eigen decompositions of real (non-complex) sparse matrices, eg. eigs_sym(), svds()
#endif
#if !defined(ARMA_USE_ARPACK)
// #define ARMA_USE_ARPACK
//// Uncomment the above line if you have ARPACK or a high-speed replacement for ARPACK.
//// ARPACK is required for eigen decompositions of complex sparse matrices
#endif
#if !defined(ARMA_USE_SUPERLU)
// #define ARMA_USE_SUPERLU
//// Uncomment the above line if you have SuperLU.
//// SuperLU is used for solving sparse linear systems via spsolve()
//// Caveat: only SuperLU version 5.2 can be used!
#endif
#if !defined(ARMA_SUPERLU_INCLUDE_DIR)
// #define ARMA_SUPERLU_INCLUDE_DIR /usr/include/
//// If you're using SuperLU and want to explicitly include the SuperLU headers,
//// uncomment the above define and specify the appropriate include directory.
//// Make sure the directory has a trailing /
#endif
#define ARMA_USE_WRAPPER
//// Comment out the above line if you prefer to directly link with LAPACK and/or BLAS (eg. -llapack -lblas)
//// instead of linking indirectly with LAPACK and/or BLAS via Armadillo's run-time wrapper library.
//// Comment out the above line if you're getting linking errors when compiling your programs,
//// or if you prefer to directly link with LAPACK, BLAS + etc instead of the Armadillo runtime library.
//// You will then need to link your programs directly with -llapack -lblas instead of -larmadillo
// #define ARMA_BLAS_CAPITALS
//// Uncomment the above line if your BLAS and LAPACK libraries have capitalised function names (eg. ACML on 64-bit Windows)
@@ -45,31 +75,49 @@
//// Uncomment the above line if your BLAS and LAPACK libraries use "long long" instead of "int"
// #define ARMA_USE_TBB_ALLOC
//// Uncomment the above line if you want to use Intel TBB scalable_malloc() and scalable_free() instead of standard new[] and delete[]
//// Uncomment the above line if you want to use Intel TBB scalable_malloc() and scalable_free() instead of standard malloc() and free()
// #define ARMA_USE_MKL_ALLOC
//// Uncomment the above line if you want to use Intel MKL mkl_malloc() and mkl_free() instead of standard new[] and delete[]
//// Uncomment the above line if you want to use Intel MKL mkl_malloc() and mkl_free() instead of standard malloc() and free()
/* #undef ARMA_USE_ATLAS */
#define ARMA_ATLAS_INCLUDE_DIR /
// #define ARMA_USE_ATLAS
// #define ARMA_ATLAS_INCLUDE_DIR /usr/include/
//// If you're using ATLAS and the compiler can't find cblas.h and/or clapack.h
//// uncomment the above define and specify the appropriate include directory.
//// Make sure the directory has a trailing /
#define ARMA_64BIT_WORD
//// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements.
//// Your machine and compiler must have support for 64 bit integers (eg. via "long" or "long long")
#if !defined(ARMA_USE_CXX11)
#define ARMA_USE_CXX11
//// Uncomment the above line if you have a C++ compiler that supports the C++11 standard
//// This will enable additional features, such as use of initialiser lists
//// Uncomment the above line to forcefully enable use of C++11 features (eg. initialiser lists).
//// Note that ARMA_USE_CXX11 is automatically enabled when a C++11 compiler is detected.
#endif
#if !defined(ARMA_USE_OPENMP)
// #define ARMA_USE_OPENMP
//// Uncomment the above line to forcefully enable use of OpenMP for parallelisation.
//// Note that ARMA_USE_OPENMP is automatically enabled when a compiler supporting OpenMP 3.1 is detected.
#endif
#if !defined(ARMA_64BIT_WORD)
#define ARMA_64BIT_WORD
//// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements.
//// Your machine and compiler must have support for 64 bit integers (eg. via "long" or "long long").
//// Note that ARMA_64BIT_WORD is automatically enabled when a C++11 compiler is detected.
#endif
#if !defined(ARMA_USE_HDF5)
/* #undef ARMA_USE_HDF5 */
//// Uncomment the above line if you want the ability to save and load matrices stored in the HDF5 format;
//// the hdf5.h header file must be available on your system and you will need to link with the hdf5 library (eg. -lhdf5)
// #define ARMA_USE_HDF5
//// Uncomment the above line to allow the ability to save and load matrices stored in HDF5 format;
//// the hdf5.h header file must be available on your system,
//// and you will need to link with the hdf5 library (eg. -lhdf5)
#endif
// #define ARMA_USE_HDF5_ALT
#if defined(ARMA_USE_HDF5_ALT) && defined(ARMA_USE_WRAPPER)
#undef ARMA_USE_HDF5
#define ARMA_USE_HDF5
// #define ARMA_HDF5_INCLUDE_DIR /usr/include/
#endif
#if !defined(ARMA_MAT_PREALLOC)
@@ -80,6 +128,18 @@
//// If you mainly use lots of very small vectors (eg. <= 4 elements),
//// change the number to the size of your vectors.
#if !defined(ARMA_OPENMP_THRESHOLD)
#define ARMA_OPENMP_THRESHOLD 320
#endif
//// The minimum number of elements in a matrix to allow OpenMP based parallelisation;
//// it must be an integer that is at least 1.
#if !defined(ARMA_OPENMP_THREADS)
#define ARMA_OPENMP_THREADS 10
#endif
//// The maximum number of threads to use for OpenMP based parallelisation;
//// it must be an integer that is at least 1.
#if !defined(ARMA_SPMAT_CHUNKSIZE)
#define ARMA_SPMAT_CHUNKSIZE 256
#endif
@@ -99,27 +159,39 @@
//// This is mainly useful for debugging of the library.
// #define ARMA_USE_BOOST
// #define ARMA_USE_BOOST_DATE
#if !defined(ARMA_DEFAULT_OSTREAM)
#define ARMA_DEFAULT_OSTREAM std::cout
#if defined(ARMA_DEFAULT_OSTREAM)
#pragma message ("WARNING: support for ARMA_DEFAULT_OSTREAM is deprecated and will be removed;")
#pragma message ("WARNING: use ARMA_COUT_STREAM and ARMA_CERR_STREAM instead")
#endif
#define ARMA_PRINT_LOGIC_ERRORS
#define ARMA_PRINT_RUNTIME_ERRORS
//#define ARMA_PRINT_HDF5_ERRORS
#define ARMA_HAVE_STD_ISFINITE
#define ARMA_HAVE_STD_ISINF
#define ARMA_HAVE_STD_ISNAN
#define ARMA_HAVE_STD_SNPRINTF
#if !defined(ARMA_COUT_STREAM)
#if defined(ARMA_DEFAULT_OSTREAM)
// for compatibility with earlier versions of Armadillo
#define ARMA_COUT_STREAM ARMA_DEFAULT_OSTREAM
#else
#define ARMA_COUT_STREAM std::cout
#endif
#endif
#define ARMA_HAVE_LOG1P
#define ARMA_HAVE_GETTIMEOFDAY
#if !defined(ARMA_CERR_STREAM)
#if defined(ARMA_DEFAULT_OSTREAM)
// for compatibility with earlier versions of Armadillo
#define ARMA_CERR_STREAM ARMA_DEFAULT_OSTREAM
#else
#define ARMA_CERR_STREAM std::cerr
#endif
#endif
#if !defined(ARMA_PRINT_ERRORS)
#define ARMA_PRINT_ERRORS
//// Comment out the above line if you don't want errors and warnings printed (eg. failed decompositions)
#endif
#if !defined(ARMA_PRINT_HDF5_ERRORS)
// #define ARMA_PRINT_HDF5_ERRORS
#endif
#if defined(ARMA_DONT_USE_LAPACK)
#undef ARMA_USE_LAPACK
@@ -129,15 +201,71 @@
#undef ARMA_USE_BLAS
#endif
#if defined(ARMA_DONT_USE_NEWARP) || !defined(ARMA_USE_LAPACK)
#undef ARMA_USE_NEWARP
#endif
#if defined(ARMA_DONT_USE_ARPACK)
#undef ARMA_USE_ARPACK
#endif
#if defined(ARMA_DONT_USE_SUPERLU)
#undef ARMA_USE_SUPERLU
#undef ARMA_SUPERLU_INCLUDE_DIR
#endif
#if defined(ARMA_DONT_USE_ATLAS)
#undef ARMA_USE_ATLAS
#undef ARMA_ATLAS_INCLUDE_DIR
#endif
#if defined(ARMA_DONT_PRINT_LOGIC_ERRORS)
#undef ARMA_PRINT_LOGIC_ERRORS
#if defined(ARMA_DONT_USE_WRAPPER)
#undef ARMA_USE_WRAPPER
#undef ARMA_USE_HDF5_ALT
#endif
#if defined(ARMA_DONT_PRINT_RUNTIME_ERRORS)
#undef ARMA_PRINT_RUNTIME_ERRORS
#if defined(ARMA_DONT_USE_CXX11)
#undef ARMA_USE_CXX11
#undef ARMA_USE_EXTERN_CXX11_RNG
#endif
#if defined(ARMA_DONT_USE_OPENMP)
#undef ARMA_USE_OPENMP
#endif
#if defined(ARMA_USE_WRAPPER)
#if defined(ARMA_USE_CXX11)
#if !defined(ARMA_USE_EXTERN_CXX11_RNG)
// #define ARMA_USE_EXTERN_CXX11_RNG
#endif
#endif
#endif
#if defined(ARMA_DONT_USE_EXTERN_CXX11_RNG)
#undef ARMA_USE_EXTERN_CXX11_RNG
#endif
#if defined(ARMA_32BIT_WORD)
#undef ARMA_64BIT_WORD
#endif
#if defined(ARMA_DONT_USE_HDF5)
#undef ARMA_USE_HDF5
#undef ARMA_USE_HDF5_ALT
#endif
#if defined(ARMA_DONT_PRINT_ERRORS)
#undef ARMA_PRINT_ERRORS
#endif
#if defined(ARMA_DONT_PRINT_HDF5_ERRORS)
#undef ARMA_PRINT_HDF5_ERRORS
#endif
// if Armadillo was installed on this system via CMake and ARMA_USE_WRAPPER is not defined,
// ARMA_AUX_LIBS lists the libraries required by Armadillo on this system, and
// ARMA_AUX_INCDIRS lists the include directories required by Armadillo on this system.
// Do not use these unless you know what you are doing.
#define ARMA_AUX_LIBS
#define ARMA_AUX_INCDIRS
+3
View File
@@ -35,6 +35,9 @@
* Add `kmeans_max_iterations` option to GMM training binding `gmm_train_main`.
* Bump minimum Armadillo version to 8.400.0 due to ensmallen dependency
requirement (#2015).
### mlpack 3.1.1
###### 2019-05-26
* Fix random forest bug for numerical-only data (#1887).
+1 -1
View File
@@ -83,7 +83,7 @@ Citations are beneficial for the growth and improvement of mlpack.
mlpack has the following dependencies:
Armadillo >= 6.500.0
Armadillo >= 8.400.0
Boost (program_options, math_c99, unit_test_framework, serialization,
spirit)
CMake >= 3.3.2
+1 -1
View File
@@ -76,7 +76,7 @@ The directory can have any name, not just 'build', but 'build' is sufficient.
mlpack depends on the following libraries, which need to be installed on the
system and have headers present:
- Armadillo >= 6.500.0 (with LAPACK support)
- Armadillo >= 8.400.0 (with LAPACK support)
- Boost (math_c99, program_options, serialization, unit_test_framework, heap,
spirit) >= 1.49
- ensmallen (will be downloaded if not found)
+8 -14
View File
@@ -36,28 +36,22 @@ ARMA_64BIT_WORD disabled."
#endif
#endif
// Check if OpenMP was enabled when mlpack was built. This only matters for
// Armadillo 8.300.1 and newer.
#if (ARMA_VERSION_MAJOR > 8) || \
((ARMA_VERSION_MAJOR == 8) && (ARMA_VERSION_MINOR > 300)) || \
((ARMA_VERSION_MAJOR == 8) && (ARMA_VERSION_MINOR == 300) && \
(ARMA_VERSION_PATCH >= 1))
#ifdef ARMA_USE_OPENMP
#ifdef MLPACK_ARMA_DONT_USE_OPENMP
#pragma message "mlpack was compiled without OpenMP support, but you are \
// Check if OpenMP was enabled when mlpack was built.
#ifdef ARMA_USE_OPENMP
#ifdef MLPACK_ARMA_DONT_USE_OPENMP
#pragma message "mlpack was compiled without OpenMP support, but you are \
compiling with OpenMP support (either -fopenmp or another option). This will \
almost certainly cause irreparable disaster. Either compile your application \
*without* OpenMP support (i.e. remove -fopenmp or another flag), or, recompile \
mlpack with OpenMP support."
#endif
#else
#ifdef MLPACK_ARMA_USE_OPENMP
#pragma message "mlpack was compiled with OpenMP support, but you are \
#endif
#else
#ifdef MLPACK_ARMA_USE_OPENMP
#pragma message "mlpack was compiled with OpenMP support, but you are \
compiling without OpenMP support. This will almost certainly cause \
irreparable disaster. Either enable OpenMP support in your application (e.g., \
add -fopenmp to your compiler command line), or, recompile mlpack *without* \
OpenMP support."
#endif
#endif
#endif
@@ -93,41 +93,11 @@ void LinearSVM<MatType>::Classify(
{
Classify(data, scores);
#if ARMA_VERSION_MAJOR > 7 || \
(ARMA_VERSION_MAJOR == 7 && \
ARMA_VERSION_MINOR >= 300)
// Prepare necessary data
// Prepare necessary data.
labels.zeros(data.n_cols);
labels = arma::conv_to<arma::Row<size_t>>::from(
arma::index_max(scores));
#else
// Once the minimum version is Armadillo is increased, remove this part.
// Prepare necessary data
labels.zeros(data.n_cols);
double maxScore = 0;
// For each test input.
for (size_t i = 0; i < data.n_cols; ++i)
{
// For each class.
for (size_t j = 0; j < numClasses; ++j)
{
// If a higher class probability is encountered, change score.
if (scores(j, i) > maxScore)
{
maxScore = scores(j, i);
labels(i) = j;
}
}
// Set maximum probability to zero for next input.
maxScore = 0;
}
#endif
}
template <typename MatType>
-2
View File
@@ -477,9 +477,7 @@ void Serialization()
cBinary.CleanedData().n_nonzero);
BOOST_REQUIRE_EQUAL(c.CleanedData().n_nonzero, cText.CleanedData().n_nonzero);
#if ARMA_VERSION_MAJOR >= 8
c.CleanedData().sync();
#endif
for (size_t i = 0; i <= c.CleanedData().n_cols; ++i)
{