Skip to content

Commit e599c8c

Browse files
committed
Armadillo 12.6.7
1 parent 2277661 commit e599c8c

File tree

4 files changed

+24
-40
lines changed

4 files changed

+24
-40
lines changed

inst/include/armadillo_bits/Mat_meat.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7830,7 +7830,7 @@ Mat<eT>::save(const csv_name& spec, const file_type type) const
78307830

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

81158115
if(with_header && (spec.header_rw.n_elem != load_n_cols))
81168116
{
8117-
arma_debug_warn_level(3, "Mat::load(): size mistmach between header and matrix");
8117+
arma_debug_warn_level(3, "Mat::load(): size mismatch between header and matrix");
81188118
}
81198119
}
81208120

inst/include/armadillo_bits/SpMat_meat.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4609,7 +4609,7 @@ SpMat<eT>::save(const csv_name& spec, const file_type type) const
46094609

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

48094809
if(with_header && (spec.header_rw.n_elem != load_n_cols))
48104810
{
4811-
arma_debug_warn_level(3, "SpMat::load(): size mistmach between header and matrix");
4811+
arma_debug_warn_level(3, "SpMat::load(): size mismatch between header and matrix");
48124812
}
48134813
}
48144814

inst/include/armadillo_bits/arma_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#define ARMA_VERSION_MAJOR 12
2525
#define ARMA_VERSION_MINOR 6
26-
#define ARMA_VERSION_PATCH 6
26+
#define ARMA_VERSION_PATCH 7
2727
#define ARMA_VERSION_NAME "Cortisol Retox"
2828

2929

inst/include/armadillo_bits/diskio_meat.hpp

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,10 @@ diskio::convert_token(eT& val, const std::string& token)
445445
{
446446
const size_t N = size_t(token.length());
447447

448-
if(N == 0) { val = eT(0); return true; }
449-
450448
const char* str = token.c_str();
451449

450+
if( (N == 0) || ((N == 1) && (str[0] == '0')) ) { val = eT(0); return true; }
451+
452452
if( (N == 3) || (N == 4) )
453453
{
454454
const bool neg = (str[0] == '-');
@@ -1075,7 +1075,7 @@ diskio::save_coord_ascii(const Mat< std::complex<T> >& x, std::ostream& f)
10751075
for(uword col=0; col < x.n_cols; ++col)
10761076
for(uword row=0; row < x.n_rows; ++row)
10771077
{
1078-
const eT val = x.at(row,col);
1078+
const eT& val = x.at(row,col);
10791079

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

11831183

11841184

1185-
//
1186-
// TODO:
1187-
// add functionality to save the image in a normalised format,
1188-
// ie. scaled so that every value falls in the [0,255] range.
1189-
11901185
//! Save a matrix as a PGM greyscale image
11911186
template<typename eT>
11921187
inline
@@ -2221,10 +2216,7 @@ diskio::load_coord_ascii(Mat<eT>& x, std::istream& f, std::string& err_msg)
22212216

22222217
line_stream >> token;
22232218

2224-
if(line_stream.fail() == false)
2225-
{
2226-
diskio::convert_token( val, token );
2227-
}
2219+
if(line_stream.fail() == false) { diskio::convert_token( val, token ); }
22282220

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

23262318
line_stream >> token_real;
23272319

2328-
if(line_stream.fail() == false)
2329-
{
2330-
diskio::convert_token( val_real, token_real );
2331-
}
2332-
2320+
if(line_stream.fail() == false) { diskio::convert_token( val_real, token_real ); }
23332321

23342322
line_stream >> token_imag;
23352323

2336-
if(line_stream.fail() == false)
2337-
{
2338-
diskio::convert_token( val_imag, token_imag );
2339-
}
2324+
if(line_stream.fail() == false) { diskio::convert_token( val_imag, token_imag ); }
23402325

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

2907+
const eT eT_zero = eT(0);
2908+
29222909
for(uword row=0; row < x_n_rows; ++row)
29232910
{
29242911
for(uword col=0; col < x_n_cols; ++col)
29252912
{
29262913
const eT val = x.at(row,col);
29272914

2928-
if(val != eT(0)) { arma_ostream::raw_print_elem(f, val); }
2915+
if(val == eT_zero)
2916+
{
2917+
f.put('0');
2918+
}
2919+
else
2920+
{
2921+
arma_ostream::raw_print_elem(f, val);
2922+
}
29292923

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

34273421
line_stream >> token;
34283422

3429-
if(line_stream.fail() == false)
3430-
{
3431-
diskio::convert_token( val, token );
3432-
}
3423+
if(line_stream.fail() == false) { diskio::convert_token( val, token ); }
34333424

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

35313522
line_stream >> token_real;
35323523

3533-
if(line_stream.fail() == false)
3534-
{
3535-
diskio::convert_token( val_real, token_real );
3536-
}
3537-
3524+
if(line_stream.fail() == false) { diskio::convert_token( val_real, token_real ); }
35383525

35393526
line_stream >> token_imag;
35403527

3541-
if(line_stream.fail() == false)
3542-
{
3543-
diskio::convert_token( val_imag, token_imag );
3544-
}
3528+
if(line_stream.fail() == false) { diskio::convert_token( val_imag, token_imag ); }
35453529

35463530
if( (val_real != T(0)) || (val_imag != T(0)) )
35473531
{

0 commit comments

Comments
 (0)