Skip to content

Commit

Permalink
Armadillo 14.2.1 bug fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Nov 24, 2024
1 parent 7b4bd34 commit 5f8ba6e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 49 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-11-24 Dirk Eddelbuettel <[email protected]>

* inst/include/armadillo_bits/: Armadillo 14.2.1 bug fixes

2024-11-16 Dirk Eddelbuettel <[email protected]>

* DESCRIPTION (Version, Date): RcppArmadillo 14.2.0-1
Expand Down
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/Base_bones.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ struct Base
arma_frown("use .index_min() instead") inline elem_type min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline elem_type max(uword& index_of_max_val) const;

arma_deprecated inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_deprecated inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;

arma_warn_unused inline uword index_min() const;
arma_warn_unused inline uword index_max() const;
Expand Down
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/Cube_bones.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ class Cube : public BaseCube< eT, Cube<eT> >
arma_frown("use .index_min() instead") inline eT min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline eT max(uword& index_of_max_val) const;

arma_deprecated inline eT min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const;
arma_deprecated inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline eT min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const;

arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const;
arma_cold inline bool save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
Expand Down
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/Mat_bones.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ class Mat : public Base< eT, Mat<eT> >
arma_frown("use .index_min() instead") inline eT min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline eT max(uword& index_of_max_val) const;

arma_deprecated inline eT min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_deprecated inline eT max(uword& row_of_max_val, uword& col_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline eT min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline eT max(uword& row_of_max_val, uword& col_of_max_val) const;


arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const;
Expand Down
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/SpBase_bones.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ struct SpBase
arma_frown("use .index_min() instead") inline elem_type min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline elem_type max(uword& index_of_max_val) const;

arma_deprecated inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_deprecated inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;

arma_warn_unused inline uword index_min() const;
arma_warn_unused inline uword index_max() const;
Expand Down
2 changes: 1 addition & 1 deletion inst/include/armadillo_bits/arma_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#define ARMA_VERSION_MAJOR 14
#define ARMA_VERSION_MINOR 2
#define ARMA_VERSION_PATCH 0
#define ARMA_VERSION_PATCH 1
#define ARMA_VERSION_NAME "Smooth Caffeine"


Expand Down
35 changes: 15 additions & 20 deletions inst/include/armadillo_bits/op_max_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,32 +393,19 @@ op_max::direct_max(const eT* const X, const uword n_elem, uword& index_of_max_va
{
arma_debug_sigprint();

eT max_val_i = priv::most_neg<eT>();
eT max_val_j = priv::most_neg<eT>();

uword best_index_i = 0;
uword best_index_j = 0;

uword i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
const eT X_i = X[i];
const eT X_j = X[j];

if(X_i > max_val_i) { max_val_i = X_i; best_index_i = i; }
if(X_j > max_val_j) { max_val_j = X_j; best_index_j = j; }
}
eT best_val = priv::most_neg<eT>();
uword best_index = 0;

if(i < n_elem)
for(uword i=0; i < n_elem; ++i)
{
const eT X_i = X[i];
const eT val = X[i];

if(X_i > max_val_i) { max_val_i = X_i; best_index_i = i; }
if(val > best_val) { best_val = val; best_index = i; }
}

index_of_max_val = (max_val_i > max_val_j) ? best_index_i : best_index_j;
index_of_max_val = best_index;

return (max_val_i > max_val_j) ? max_val_i : max_val_j;
return best_val;
}


Expand Down Expand Up @@ -705,6 +692,8 @@ op_max::max_with_index(const Proxy<T1>& P, uword& index_of_max_val)
{
arma_conform_check(true, "max(): object has no elements");

index_of_max_val = 0;

return Datum<eT>::nan;
}

Expand Down Expand Up @@ -786,6 +775,8 @@ op_max::max_with_index(const ProxyCube<T1>& P, uword& index_of_max_val)
{
arma_conform_check(true, "max(): object has no elements");

index_of_max_val = 0;

return Datum<eT>::nan;
}

Expand Down Expand Up @@ -1160,6 +1151,8 @@ op_max::max_with_index(const Proxy<T1>& P, uword& index_of_max_val)
{
arma_conform_check(true, "max(): object has no elements");

index_of_max_val = 0;

return Datum<eT>::nan;
}

Expand Down Expand Up @@ -1263,6 +1256,8 @@ op_max::max_with_index(const ProxyCube<T1>& P, uword& index_of_max_val)
{
arma_conform_check(true, "max(): object has no elements");

index_of_max_val = 0;

return Datum<eT>::nan;
}

Expand Down
35 changes: 15 additions & 20 deletions inst/include/armadillo_bits/op_min_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,32 +393,19 @@ op_min::direct_min(const eT* const X, const uword n_elem, uword& index_of_min_va
{
arma_debug_sigprint();

eT min_val_i = priv::most_pos<eT>();
eT min_val_j = priv::most_pos<eT>();

uword best_index_i = 0;
uword best_index_j = 0;

uword i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
const eT X_i = X[i];
const eT X_j = X[j];

if(X_i < min_val_i) { min_val_i = X_i; best_index_i = i; }
if(X_j < min_val_j) { min_val_j = X_j; best_index_j = j; }
}
eT best_val = priv::most_pos<eT>();
uword best_index = 0;

if(i < n_elem)
for(uword i=0; i < n_elem; ++i)
{
const eT X_i = X[i];
const eT val = X[i];

if(X_i < min_val_i) { min_val_i = X_i; best_index_i = i; }
if(val < best_val) { best_val = val; best_index = i; }
}

index_of_min_val = (min_val_i < min_val_j) ? best_index_i : best_index_j;
index_of_min_val = best_index;

return (min_val_i < min_val_j) ? min_val_i : min_val_j;
return best_val;
}


Expand Down Expand Up @@ -705,6 +692,8 @@ op_min::min_with_index(const Proxy<T1>& P, uword& index_of_min_val)
{
arma_conform_check(true, "min(): object has no elements");

index_of_min_val = 0;

return Datum<eT>::nan;
}

Expand Down Expand Up @@ -786,6 +775,8 @@ op_min::min_with_index(const ProxyCube<T1>& P, uword& index_of_min_val)
{
arma_conform_check(true, "min(): object has no elements");

index_of_min_val = 0;

return Datum<eT>::nan;
}

Expand Down Expand Up @@ -1160,6 +1151,8 @@ op_min::min_with_index(const Proxy<T1>& P, uword& index_of_min_val)
{
arma_conform_check(true, "min(): object has no elements");

index_of_min_val = 0;

return Datum<eT>::nan;
}

Expand Down Expand Up @@ -1263,6 +1256,8 @@ op_min::min_with_index(const ProxyCube<T1>& P, uword& index_of_min_val)
{
arma_conform_check(true, "min(): object has no elements");

index_of_min_val = 0;

return Datum<eT>::nan;
}

Expand Down

0 comments on commit 5f8ba6e

Please sign in to comment.