Skip to content

Commit adf2fc8

Browse files
authored
avoid deprecation warnings in armadillo 11.2+ (#347)
avoid deprecation warnings in armadillo 11.2+
1 parent f974ea0 commit adf2fc8

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
### ensmallen ?.??.?: "???"
22
###### ????-??-??
3+
* Avoid deprecation warnings in Armadillo 11.2+
4+
([#347](https://github.com/mlpack/ensmallen/pull/347)).
35

46
### ensmallen 2.19.0: "Eight Ball Deluxe"
57
###### 2022-04-06

tests/frankwolfe_test.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ TEST_CASE("FWOMPTest", "[FrankWolfeTest]")
2828
mat B1 = eye(3, 3);
2929
mat B2 = 0.1 * randn(3, k);
3030
mat A = join_horiz(B1, B2); // The dictionary is input as columns of A.
31-
vec b;
32-
b << 1 << 1 << 0; // Vector to be sparsely approximated.
31+
vec b = {1.0, 1.0, 0.0}; // Vector to be sparsely approximated.
3332

3433
FuncSq f(A, b);
3534
ConstrLpBallSolver linearConstrSolver(1);
@@ -85,14 +84,12 @@ TEST_CASE("FWPruneSupportOMP", "[FrankWolfeTest]")
8584
{
8685
// The dictionary is input as columns of A.
8786
const int k = 3;
88-
mat B1;
89-
B1 << 1 << 0 << 1 << endr
90-
<< 0 << 1 << 1 << endr
91-
<< 0 << 0 << 1 << endr;
87+
mat B1 = { { 1.0, 0.0, 1.0 },
88+
{ 0.0, 1.0, 1.0 },
89+
{ 0.0, 0.0, 1.0 } };
9290
mat B2 = randu(k, k);
9391
mat A = join_horiz(B1, B2); // The dictionary is input as columns of A.
94-
vec b;
95-
b << 1 << 1 << 0; // Vector to be sparsely approximated.
92+
vec b = { 1.0, 1.0, 0.0 }; // Vector to be sparsely approximated.
9693

9794
FuncSq f(A, b);
9895
ConstrLpBallSolver linearConstrSolver(1);
@@ -115,8 +112,7 @@ TEST_CASE("FWAtomNormConstraint", "[FrankWolfeTest]")
115112
mat B1 = eye(3, 3);
116113
mat B2 = 0.1 * randn(3, k);
117114
mat A = join_horiz(B1, B2); // The dictionary is input as columns of A.
118-
vec b;
119-
b << 1 << 1 << 0; // Vector to be sparsely approximated.
115+
vec b = { 1.0, 1.0, 0.0 }; // Vector to be sparsely approximated.
120116

121117
FuncSq f(A, b);
122118
ConstrLpBallSolver linearConstrSolver(1);

tests/line_search_test.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ using namespace ens::test;
2323
TEST_CASE("FuncFWTest", "[LineSearchTest]")
2424
{
2525
mat x1 = zeros<mat>(3, 1);
26-
mat x2;
27-
x2 << 0.2 << 0.4 << 0.6;
26+
mat x2 = { 0.2, 0.4, 0.6 };
2827
x2 = x2.t();
2928

3029
TestFuncFW<> f;
@@ -44,8 +43,7 @@ TEST_CASE("FuncFWTest", "[LineSearchTest]")
4443
TEST_CASE("FuncFWFMatTest", "[LineSearchTest]")
4544
{
4645
fmat x1 = zeros<fmat>(3, 1);
47-
fmat x2;
48-
x2 << 0.2 << 0.4 << 0.6;
46+
fmat x2 = { 0.2, 0.4, 0.6 };
4947
x2 = x2.t();
5048

5149
TestFuncFW<arma::fmat> f;

tests/sdp_primal_dual_test.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
1111
*/
1212

13-
#define ARMA_DONT_PRINT_ERRORS
13+
#if (ARMA_VERSION_MAJOR < 11)
14+
#define ARMA_DONT_PRINT_ERRORS
15+
#endif
16+
1417
#include <ensmallen.hpp>
1518
#include "catch.hpp"
1619

0 commit comments

Comments
 (0)