Skip to content

Commit

Permalink
Armadillo 12.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Dec 19, 2023
1 parent 2277661 commit e599c8c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 40 deletions.
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/Mat_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7830,7 +7830,7 @@ Mat<eT>::save(const csv_name& spec, const file_type type) const

if(spec.header_ro.n_elem != save_n_cols)
{
arma_debug_warn_level(1, "Mat::save(): size mistmach between header and matrix");
arma_debug_warn_level(1, "Mat::save(): size mismatch between header and matrix");
return false;
}
}
Expand Down Expand Up @@ -8114,7 +8114,7 @@ Mat<eT>::load(const csv_name& spec, const file_type type)

if(with_header && (spec.header_rw.n_elem != load_n_cols))
{
arma_debug_warn_level(3, "Mat::load(): size mistmach between header and matrix");
arma_debug_warn_level(3, "Mat::load(): size mismatch between header and matrix");
}
}

Expand Down
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/SpMat_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4609,7 +4609,7 @@ SpMat<eT>::save(const csv_name& spec, const file_type type) const

if(spec.header_ro.n_elem != save_n_cols)
{
arma_debug_warn_level(1, "SpMat::save(): size mistmach between header and matrix");
arma_debug_warn_level(1, "SpMat::save(): size mismatch between header and matrix");
return false;
}
}
Expand Down Expand Up @@ -4808,7 +4808,7 @@ SpMat<eT>::load(const csv_name& spec, const file_type type)

if(with_header && (spec.header_rw.n_elem != load_n_cols))
{
arma_debug_warn_level(3, "SpMat::load(): size mistmach between header and matrix");
arma_debug_warn_level(3, "SpMat::load(): size mismatch between header and matrix");
}
}

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 12
#define ARMA_VERSION_MINOR 6
#define ARMA_VERSION_PATCH 6
#define ARMA_VERSION_PATCH 7
#define ARMA_VERSION_NAME "Cortisol Retox"


Expand Down
54 changes: 19 additions & 35 deletions inst/include/armadillo_bits/diskio_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ diskio::convert_token(eT& val, const std::string& token)
{
const size_t N = size_t(token.length());

if(N == 0) { val = eT(0); return true; }

const char* str = token.c_str();

if( (N == 0) || ((N == 1) && (str[0] == '0')) ) { val = eT(0); return true; }

if( (N == 3) || (N == 4) )
{
const bool neg = (str[0] == '-');
Expand Down Expand Up @@ -1075,7 +1075,7 @@ diskio::save_coord_ascii(const Mat< std::complex<T> >& x, std::ostream& f)
for(uword col=0; col < x.n_cols; ++col)
for(uword row=0; row < x.n_rows; ++row)
{
const eT val = x.at(row,col);
const eT& val = x.at(row,col);

if(val != eT_zero)
{
Expand Down Expand Up @@ -1182,11 +1182,6 @@ diskio::save_pgm_binary(const Mat<eT>& x, const std::string& final_name)



//
// TODO:
// add functionality to save the image in a normalised format,
// ie. scaled so that every value falls in the [0,255] range.

//! Save a matrix as a PGM greyscale image
template<typename eT>
inline
Expand Down Expand Up @@ -2221,10 +2216,7 @@ diskio::load_coord_ascii(Mat<eT>& x, std::istream& f, std::string& err_msg)

line_stream >> token;

if(line_stream.fail() == false)
{
diskio::convert_token( val, token );
}
if(line_stream.fail() == false) { diskio::convert_token( val, token ); }

if(val != eT(0)) { tmp(line_row,line_col) = val; }
}
Expand Down Expand Up @@ -2325,18 +2317,11 @@ diskio::load_coord_ascii(Mat< std::complex<T> >& x, std::istream& f, std::string

line_stream >> token_real;

if(line_stream.fail() == false)
{
diskio::convert_token( val_real, token_real );
}

if(line_stream.fail() == false) { diskio::convert_token( val_real, token_real ); }

line_stream >> token_imag;

if(line_stream.fail() == false)
{
diskio::convert_token( val_imag, token_imag );
}
if(line_stream.fail() == false) { diskio::convert_token( val_imag, token_imag ); }

if( (val_real != T(0)) || (val_imag != T(0)) )
{
Expand Down Expand Up @@ -2919,13 +2904,22 @@ diskio::save_csv_ascii(const SpMat<eT>& x, std::ostream& f, const char separator
uword x_n_rows = x.n_rows;
uword x_n_cols = x.n_cols;

const eT eT_zero = eT(0);

for(uword row=0; row < x_n_rows; ++row)
{
for(uword col=0; col < x_n_cols; ++col)
{
const eT val = x.at(row,col);

if(val != eT(0)) { arma_ostream::raw_print_elem(f, val); }
if(val == eT_zero)
{
f.put('0');
}
else
{
arma_ostream::raw_print_elem(f, val);
}

if( col < (x_n_cols-1) ) { f.put(separator); }
}
Expand Down Expand Up @@ -3426,10 +3420,7 @@ diskio::load_coord_ascii(SpMat<eT>& x, std::istream& f, std::string& err_msg)

line_stream >> token;

if(line_stream.fail() == false)
{
diskio::convert_token( val, token );
}
if(line_stream.fail() == false) { diskio::convert_token( val, token ); }

if(val != eT(0)) { tmp(line_row,line_col) = val; }
}
Expand Down Expand Up @@ -3530,18 +3521,11 @@ diskio::load_coord_ascii(SpMat< std::complex<T> >& x, std::istream& f, std::stri

line_stream >> token_real;

if(line_stream.fail() == false)
{
diskio::convert_token( val_real, token_real );
}

if(line_stream.fail() == false) { diskio::convert_token( val_real, token_real ); }

line_stream >> token_imag;

if(line_stream.fail() == false)
{
diskio::convert_token( val_imag, token_imag );
}
if(line_stream.fail() == false) { diskio::convert_token( val_imag, token_imag ); }

if( (val_real != T(0)) || (val_imag != T(0)) )
{
Expand Down

0 comments on commit e599c8c

Please sign in to comment.