Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum Armadillo version to 10.8 #404

Merged
merged 18 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
environment:
ARMADILLO_DOWNLOAD: "https://sourceforge.net/projects/arma/files/armadillo-9.800.6.tar.xz"
ARMADILLO_DOWNLOAD: "https://sourceforge.net/projects/arma/files/armadillo-10.8.2.tar.xz"
BLAS_LIBRARY: "%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll.a"
BLAS_LIBRARY_DLL: "%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll"

Expand All @@ -26,7 +26,7 @@ build_script:
- cd ..
- appveyor DownloadFile %ARMADILLO_DOWNLOAD% -FileName armadillo.tar.xz
- 7z x armadillo.tar.xz -so -txz | 7z x -si -ttar > nul
- cd armadillo-9.800.6 && mkdir build && cd build
- cd armadillo-10.8.2 && mkdir build && cd build
- >
cmake -G "%VSVER%"
-DBLAS_LIBRARY:FILEPATH=%BLAS_LIBRARY%
Expand All @@ -43,7 +43,7 @@ build_script:
- cd ensmallen && mkdir build && cd build
- >
cmake -G "%VSVER%"
-DARMADILLO_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/../armadillo-9.800.6/include/
-DARMADILLO_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/../armadillo-10.8.2/include/
-DARMADILLO_LIBRARIES=%BLAS_LIBRARY%
-DLAPACK_LIBRARY=%BLAS_LIBRARY%
-DBLAS_LIBRARY=%BLAS_LIBRARY%
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ script:
- if [ $ARMADILLO == "latest" ]; then
curl https://ftp.fau.de/macports/distfiles/armadillo/`curl https://ftp.fau.de/macports/distfiles/armadillo/ -- | grep '.tar.xz' | sed 's/^.*<a href="\(armadillo-[0-9]*.[0-9]*.[0-9]*.tar.xz\)".*$/\1/' | tail -1` | tar xvJ && cd armadillo*;
else
curl -L https://sourceforge.net/projects/arma/files/armadillo-9.800.6.tar.xz | tar -xvJ && cd armadillo*;
curl -L https://sourceforge.net/projects/arma/files/armadillo-10.8.2.tar.xz | tar -xvJ && cd armadillo*;
fi
- cmake . && make && sudo make install && cd ..
- mkdir build && cd build && cmake .. && make ensmallen_tests -j2
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if(USE_OPENMP)
endif()

# Find Armadillo and link it.
find_package(Armadillo 9.800.0 REQUIRED)
find_package(Armadillo 10.8.2 REQUIRED)
target_link_libraries(ensmallen INTERFACE Armadillo::Armadillo)

# Set helper variables for creating the version, config and target files.
Expand Down
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Update to C++14 standard
([#400](https://github.com/mlpack/ensmallen/pull/400)).

* Bump minimum Armadillo version to 10.8
([#404](https://github.com/mlpack/ensmallen/pull/404)).

### ensmallen 2.21.1: "Bent Antenna"
###### 2024-02-15
* Fix numerical precision issues for small-gradient L-BFGS scaling factor
Expand Down
4 changes: 2 additions & 2 deletions include/ensmallen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

#include <armadillo>

#if ((ARMA_VERSION_MAJOR < 9) || ((ARMA_VERSION_MAJOR == 9) && (ARMA_VERSION_MINOR < 800)))
#error "need Armadillo version 9.800 or later"
#if ((ARMA_VERSION_MAJOR < 10) || ((ARMA_VERSION_MAJOR == 10) && (ARMA_VERSION_MINOR < 8)))
#error "need Armadillo version 10.8 or newer"
#endif

#include <cctype>
Expand Down
8 changes: 0 additions & 8 deletions include/ensmallen_bits/function/arma_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ struct MatTypeTraits<arma::SpSubview<eT>>
};


#if ((ARMA_VERSION_MAJOR >= 10) || \
((ARMA_VERSION_MAJOR == 9) && (ARMA_VERSION_MINOR >= 869)))

// Armadillo 9.869+ has SpSubview_col and SpSubview_row

template<typename eT>
struct MatTypeTraits<arma::SpSubview_col<eT>>
{
Expand All @@ -98,9 +93,6 @@ struct MatTypeTraits<arma::SpSubview_row<eT>>
"or a matrix alias instead!");
};

#endif


template<typename eT>
struct MatTypeTraits<arma::Cube<eT>>
{
Expand Down
29 changes: 10 additions & 19 deletions include/ensmallen_bits/utility/arma_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,17 @@ struct IsArmaType<arma::SpSubview<eT> >
const static bool value = true;
};

template<typename eT>
struct IsArmaType<arma::SpSubview_col<eT> >
{
const static bool value = true;
};

#if ((ARMA_VERSION_MAJOR >= 10) || \
((ARMA_VERSION_MAJOR == 9) && (ARMA_VERSION_MINOR >= 869)))

// Armadillo 9.869+ has SpSubview_col and SpSubview_row

template<typename eT>
struct IsArmaType<arma::SpSubview_col<eT> >
{
const static bool value = true;
};

template<typename eT>
struct IsArmaType<arma::SpSubview_row<eT> >
{
const static bool value = true;
};

#endif

template<typename eT>
struct IsArmaType<arma::SpSubview_row<eT> >
{
const static bool value = true;
};

// template<>
template<typename eT>
Expand Down
5 changes: 0 additions & 5 deletions tests/ada_bound_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ TEST_CASE("AMSBoundphereFunctionTestFMat", "[AdaBoundTest]")
FunctionTest<SphereFunction, arma::fmat>(optimizer, 0.5, 0.1);
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Test the AdaBound optimizer on the Sphere function with arma::sp_mat.
*/
Expand Down Expand Up @@ -111,5 +108,3 @@ TEST_CASE("AMSBoundSphereFunctionTestSpMatDenseGradient", "[AdaBoundTest]")
REQUIRE(coordinates(0) == Approx(0.0).margin(0.1));
REQUIRE(coordinates(1) == Approx(0.0).margin(0.1));
}

#endif
15 changes: 0 additions & 15 deletions tests/adam_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ TEST_CASE("AdamSphereFunctionTestFMat", "[AdamTest]")
FunctionTest<SphereFunction, arma::fmat>(optimizer, 0.5, 0.2);
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Test the AMSGrad optimizer on the Sphere function with arma::sp_mat.
*/
Expand All @@ -66,8 +63,6 @@ TEST_CASE("AdamSphereFunctionTestSpMatDenseGradient", "[AdamTest]")
REQUIRE(coordinates(1) == Approx(0.0).margin(0.1));
}

#endif

/**
* Test the Adam optimizer on the Wood function.
*/
Expand Down Expand Up @@ -123,9 +118,6 @@ TEST_CASE("AMSGradSphereFunctionTestFMat", "[AdamTest]")
FunctionTest<SphereFunction, arma::fmat>(optimizer, 0.5, 0.1);
}

#if ARMA_VERSION_MAJOR > 9 || \
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Test the AMSGrad optimizer on the Sphere function with arma::sp_mat.
*/
Expand All @@ -151,8 +143,6 @@ TEST_CASE("AMSGradSphereFunctionTestSpMatDenseGradient", "[AdamTest]")
REQUIRE(coordinates(1) == Approx(0.0).margin(0.1));
}

#endif

/**
* Run Adam on logistic regression and make sure the results are acceptable.
*/
Expand Down Expand Up @@ -236,9 +226,6 @@ TEST_CASE("QHAdamLogisticRegressionFMatTest", "[AdamTest]")
LogisticRegressionFunctionTest<arma::fmat>(optimizer, 0.03, 0.06);
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run QHAdam on logistic regression and make sure the results are acceptable,
* using arma::sp_mat.
Expand All @@ -249,8 +236,6 @@ TEST_CASE("QHAdamLogisticRegressionSpMatTest", "[AdamTest]")
LogisticRegressionFunctionTest<arma::sp_mat>(optimizer, 0.003, 0.006);
}

#endif

/**
* Test the Adam optimizer on the Ackley function.
* This is to test the Ackley function and not Adam.
Expand Down
5 changes: 0 additions & 5 deletions tests/bigbatch_sgd_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ TEST_CASE("BBSArmijoLogisticRegressionFMatTest", "[BigBatchSGDTest]")
}
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run big-batch SGD using BBS_BB on logistic regression and make sure the
* results are acceptable. Use arma::sp_mat as the objective type.
Expand Down Expand Up @@ -102,5 +99,3 @@ TEST_CASE("BBSArmijoLogisticRegressionSpMatTest", "[BigBatchSGDTest]")
LogisticRegressionFunctionTest<arma::sp_mat>(bbsgd, 0.003, 0.006, 3);
}
}

#endif
5 changes: 0 additions & 5 deletions tests/eve_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ TEST_CASE("EveStyblinskiTangFunctionFMatTest","[EveTest]")
FunctionTest<StyblinskiTangFunction, arma::fmat>(optimizer, 0.5, 0.1);
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Test the Eve optimizer on the Styblinski-Tang function, using arma::sp_mat as
* the objective type.
Expand All @@ -66,5 +63,3 @@ TEST_CASE("EveStyblinskiTangFunctionSpMatTest","[EveTest]")
Eve optimizer(1e-3, 2, 0.9, 0.999, 0.999, 1e-8, 10000, 500000, 1e-9, true);
FunctionTest<StyblinskiTangFunction, arma::sp_mat>(optimizer, 0.5, 0.1);
}

#endif
5 changes: 0 additions & 5 deletions tests/katyusha_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ TEST_CASE("KatyushaProximalLogisticRegressionFMatTest", "[KatyushaTest]")
}
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run Katyusha on logistic regression and make sure the results are acceptable.
* Use arma::sp_mat.
Expand Down Expand Up @@ -101,5 +98,3 @@ TEST_CASE("KatyushaProximalLogisticRegressionSpMatTest", "[KatyushaTest]")
LogisticRegressionFunctionTest<arma::sp_mat>(optimizer, 0.015, 0.015);
}
}

#endif
5 changes: 0 additions & 5 deletions tests/rmsprop_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ TEST_CASE("RMSPropLogisticRegressionFMatTest", "[rmsprop]")
LogisticRegressionFunctionTest<arma::fmat>(optimizer, 0.003, 0.006);
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run RMSProp on logistic regression and make sure the results are acceptable.
* Use arma::sp_mat.
Expand All @@ -47,5 +44,3 @@ TEST_CASE("RMSPropLogisticRegressionSpMatTest", "[rmsprop]")
RMSProp optimizer;
LogisticRegressionFunctionTest<arma::sp_mat>(optimizer, 0.003, 0.006);
}

#endif
5 changes: 0 additions & 5 deletions tests/sarah_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ TEST_CASE("SARAHPlusLogisticRegressionFMatTest","[SARAHTest]")
}
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run SARAH on logistic regression and make sure the results are
* acceptable. Use arma::sp_mat.
Expand Down Expand Up @@ -102,5 +99,3 @@ TEST_CASE("SARAHPlusLogisticRegressionSpMatTest","[SARAHTest]")
LogisticRegressionFunctionTest<arma::sp_mat>(optimizer, 0.015, 0.015);
}
}

#endif
5 changes: 0 additions & 5 deletions tests/sgdr_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ TEST_CASE("SGDRLogisticRegressionFMatTest","[SGDRTest]")
}
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run SGDR on logistic regression and make sure the results are acceptable.
* Use arma::sp_mat.
Expand All @@ -97,5 +94,3 @@ TEST_CASE("SGDRLogisticRegressionSpMatTest","[SGDRTest]")
LogisticRegressionFunctionTest<arma::sp_mat>(sgdr, 0.003, 0.006);
}
}

#endif
5 changes: 0 additions & 5 deletions tests/snapshot_ensembles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ TEST_CASE("SnapshotEnsemblesLogisticRegressionFMatTest","[SnapshotEnsemblesTest]
}
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run SGDR with snapshot ensembles on logistic regression and make sure the
* results are acceptable. Use arma::sp_mat.
Expand All @@ -102,5 +99,3 @@ TEST_CASE("SnapshotEnsemblesLogisticRegressionSpMatTest",
LogisticRegressionFunctionTest<arma::sp_mat>(sgdr, 0.003, 0.006);
}
}

#endif
5 changes: 0 additions & 5 deletions tests/svrg_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ TEST_CASE("SVRGBBLogisticRegressionFMatTest", "[SVRGTest]")
}
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Run SVRG on logistic regression and make sure the results are acceptable.
* Use arma::sp_mat.
Expand Down Expand Up @@ -103,5 +100,3 @@ TEST_CASE("SVRGBBLogisticRegressionSpMatTest", "[SVRGTest]")
LogisticRegressionFunctionTest<arma::sp_mat>(optimizer, 0.015, 0.015);
}
}

#endif
5 changes: 0 additions & 5 deletions tests/swats_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ TEST_CASE("SWATSStyblinskiTangFunctionFMatTest", "[SWATSTest]")
FunctionTest<StyblinskiTangFunction, arma::fmat>(optimizer, 3.0, 0.3);
}

#if ARMA_VERSION_MAJOR > 9 ||\
(ARMA_VERSION_MAJOR == 9 && ARMA_VERSION_MINOR >= 400)

/**
* Test the SWATS optimizer on the Styblinski-Tang function. Use arma::sp_mat.
*/
Expand All @@ -65,5 +62,3 @@ TEST_CASE("SWATSStyblinskiTangFunctionSpMatTest", "[SWATSTest]")
SWATS optimizer(1e-3, 2, 0.9, 0.999, 1e-6, 500000, 1e-9, true);
FunctionTest<StyblinskiTangFunction, arma::sp_mat>(optimizer, 0.3, 0.03);
}

#endif