simplifications

This commit is contained in:
conrad
2021-01-10 02:14:26 +10:00
parent fe2c0d0100
commit 1fcb59a621
17 changed files with 57 additions and 57 deletions
+6 -6
View File
@@ -3467,7 +3467,7 @@ Cube<eT>::in_range(const span& x) const
{
arma_extra_debug_sigprint();
if(x.whole == true)
if(x.whole)
{
return true;
}
@@ -3517,7 +3517,7 @@ Cube<eT>::in_range(const span& row_span, const span& col_span, const span& slice
const bool slices_ok = slice_span.whole ? true : ( (in_slice1 <= in_slice2) && (in_slice2 < n_slices) );
return ( (rows_ok == true) && (cols_ok == true) && (slices_ok == true) );
return ( (rows_ok) && (cols_ok) && (slices_ok) );
}
@@ -4346,7 +4346,7 @@ Cube<eT>::save(const hdf5_name& spec, const file_type type, const bool print_sta
save_okay = diskio::save_hdf5_binary(*this, spec, err_msg);
}
if((print_status == true) && (save_okay == false))
if(print_status) && (save_okay == false))
{
if(err_msg.length() > 0)
{
@@ -4459,7 +4459,7 @@ Cube<eT>::load(const std::string name, const file_type type, const bool print_st
load_okay = false;
}
if( (print_status == true) && (load_okay == false) )
if( print_status && (load_okay == false) )
{
if(err_msg.length() > 0)
{
@@ -4515,7 +4515,7 @@ Cube<eT>::load(const hdf5_name& spec, const file_type type, const bool print_sta
}
if( (print_status == true) && (load_okay == false) )
if( print_status && (load_okay == false) )
{
if(err_msg.length() > 0)
{
@@ -4580,7 +4580,7 @@ Cube<eT>::load(std::istream& is, const file_type type, const bool print_status)
load_okay = false;
}
if( (print_status == true) && (load_okay == false) )
if( print_status && (load_okay == false) )
{
if(err_msg.length() > 0)
{
+5 -5
View File
@@ -7401,7 +7401,7 @@ Mat<eT>::save(const hdf5_name& spec, const file_type type, const bool print_stat
save_okay = diskio::save_hdf5_binary(*this, spec, err_msg);
}
if((print_status == true) && (save_okay == false))
if(print_status && (save_okay == false))
{
if(err_msg.length() > 0)
{
@@ -7485,7 +7485,7 @@ Mat<eT>::save(const csv_name& spec, const file_type type, const bool print_statu
save_okay = diskio::save_csv_ascii(*this, spec.filename, spec.header_ro, with_header);
}
if((print_status == true) && (save_okay == false))
if(print_status && (save_okay == false))
{
arma_debug_warn("Mat::save(): couldn't write to ", spec.filename);
}
@@ -7599,7 +7599,7 @@ Mat<eT>::load(const std::string name, const file_type type, const bool print_sta
load_okay = false;
}
if( (print_status == true) && (load_okay == false) )
if( print_status && (load_okay == false) )
{
if(err_msg.length() > 0)
{
@@ -7655,7 +7655,7 @@ Mat<eT>::load(const hdf5_name& spec, const file_type type, const bool print_stat
}
if( (print_status == true) && (load_okay == false) )
if( print_status && (load_okay == false) )
{
if(err_msg.length() > 0)
{
@@ -7811,7 +7811,7 @@ Mat<eT>::load(std::istream& is, const file_type type, const bool print_status)
load_okay = false;
}
if( (print_status == true) && (load_okay == false) )
if( print_status && (load_okay == false) )
{
if(err_msg.length() > 0)
{
+7 -7
View File
@@ -3611,7 +3611,7 @@ SpMat<eT>::in_range(const span& x) const
{
arma_extra_debug_sigprint();
if(x.whole == true)
if(x.whole)
{
return true;
}
@@ -3646,7 +3646,7 @@ SpMat<eT>::in_range(const span& row_span, const uword in_col) const
{
arma_extra_debug_sigprint();
if(row_span.whole == true)
if(row_span.whole)
{
return (in_col < n_cols);
}
@@ -3669,7 +3669,7 @@ SpMat<eT>::in_range(const uword in_row, const span& col_span) const
{
arma_extra_debug_sigprint();
if(col_span.whole == true)
if(col_span.whole)
{
return (in_row < n_rows);
}
@@ -3701,7 +3701,7 @@ SpMat<eT>::in_range(const span& row_span, const span& col_span) const
const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (in_row2 < n_rows) );
const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (in_col2 < n_cols) );
return ( (rows_ok == true) && (cols_ok == true) );
return ( (rows_ok) && (cols_ok) );
}
@@ -4626,7 +4626,7 @@ SpMat<eT>::save(const csv_name& spec, const file_type type, const bool print_sta
save_okay = diskio::save_csv_ascii(*this, spec.filename, spec.header_ro, with_header);
}
if((print_status == true) && (save_okay == false))
if((print_status) && (save_okay == false))
{
arma_debug_warn("SpMat::save(): couldn't write to ", spec.filename);
}
@@ -4785,7 +4785,7 @@ SpMat<eT>::load(const csv_name& spec, const file_type type, const bool print_sta
load_okay = diskio::load_csv_ascii(*this, spec.filename, err_msg, spec.header_rw, with_header);
}
if(print_status == true)
if(print_status)
{
if(load_okay == false)
{
@@ -5798,7 +5798,7 @@ SpMat<eT>::init_xform_mt(const SpBase<eT2,T1>& A, const Functor& func)
const SpProxy<T1> P(A.get_ref());
if( (P.is_alias(*this) == true) || (is_SpMat<typename SpProxy<T1>::stored_type>::value == true) )
if( P.is_alias(*this) || (is_SpMat<typename SpProxy<T1>::stored_type>::value) )
{
// NOTE: unwrap_spmat will convert a submatrix to a matrix, which in effect takes care of aliasing with submatrices;
// NOTE: however, when more delayed ops are implemented, more elaborate handling of aliasing will be necessary
+1 -1
View File
@@ -761,7 +761,7 @@ auxlib::lu(Mat<eT>& L, Mat<eT>& U, podarray<blas_int>& ipiv, const Base<eT,T1>&
L.at(row,col) = eT(0);
}
if( L.in_range(col,col) == true )
if( L.in_range(col,col) )
{
L.at(col,col) = eT(1);
}
+9 -9
View File
@@ -1525,7 +1525,7 @@ field<oT>::in_range(const span& x) const
{
arma_extra_debug_sigprint();
if(x.whole == true)
if(x.whole)
{
return true;
}
@@ -1560,7 +1560,7 @@ field<oT>::in_range(const span& row_span, const uword in_col) const
{
arma_extra_debug_sigprint();
if(row_span.whole == true)
if(row_span.whole)
{
return (in_col < n_cols);
}
@@ -1583,7 +1583,7 @@ field<oT>::in_range(const uword in_row, const span& col_span) const
{
arma_extra_debug_sigprint();
if(col_span.whole == true)
if(col_span.whole)
{
return (in_row < n_rows);
}
@@ -1615,7 +1615,7 @@ field<oT>::in_range(const span& row_span, const span& col_span) const
const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (in_row2 < n_rows) );
const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (in_col2 < n_cols) );
return ( (rows_ok == true) && (cols_ok == true) );
return ( (rows_ok) && (cols_ok) );
}
@@ -1673,7 +1673,7 @@ field<oT>::in_range(const span& row_span, const span& col_span, const span& slic
const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2 ) && (in_col2 < n_cols ) );
const bool slices_ok = slice_span.whole ? true : ( (in_slice1 <= in_slice2) && (in_slice2 < n_slices) );
return ( (rows_ok == true) && (cols_ok == true) && (slices_ok == true) );
return ( (rows_ok) && (cols_ok) && (slices_ok) );
}
@@ -1711,7 +1711,7 @@ field<oT>::save(const std::string name, const file_type type, const bool print_s
std::string err_msg;
const bool save_okay = field_aux::save(*this, name, type, err_msg);
if( (print_status == true) && (save_okay == false) )
if( (print_status) && (save_okay == false) )
{
if(err_msg.length() > 0)
{
@@ -1739,7 +1739,7 @@ field<oT>::save(std::ostream& os, const file_type type, const bool print_status)
std::string err_msg;
const bool save_okay = field_aux::save(*this, os, type, err_msg);
if( (print_status == true) && (save_okay == false) )
if( (print_status) && (save_okay == false) )
{
if(err_msg.length() > 0)
{
@@ -1767,7 +1767,7 @@ field<oT>::load(const std::string name, const file_type type, const bool print_s
std::string err_msg;
const bool load_okay = field_aux::load(*this, name, type, err_msg);
if( (print_status == true) && (load_okay == false) )
if( (print_status) && (load_okay == false) )
{
if(err_msg.length() > 0)
{
@@ -1800,7 +1800,7 @@ field<oT>::load(std::istream& is, const file_type type, const bool print_status)
std::string err_msg;
const bool load_okay = field_aux::load(*this, is, type, err_msg);
if( (print_status == true) && (load_okay == false) )
if( (print_status) && (load_okay == false) )
{
if(err_msg.length() > 0)
{
+1 -1
View File
@@ -57,7 +57,7 @@ linspace
const uword num_m1 = num - 1;
if(is_non_integral<T>::value == true)
if(is_non_integral<T>::value)
{
const T delta = (end-start)/T(num_m1);
+2 -2
View File
@@ -41,7 +41,7 @@ inline
typename
enable_if2
<
( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value == true) ),
( (is_arma_type<T1>::value) && (is_same_type<T2, char>::value) ),
const mtOp<uword,T1,op_sort_index>
>::result
sort_index
@@ -87,7 +87,7 @@ inline
typename
enable_if2
<
( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value == true) ),
( (is_arma_type<T1>::value) && (is_same_type<T2, char>::value) ),
const mtOp<uword,T1,op_stable_sort_index>
>::result
stable_sort_index
+8 -8
View File
@@ -26,8 +26,8 @@ const Op<T1, op_strans>
strans
(
const T1& X,
const typename enable_if< is_arma_type<T1>::value == true >::result* junk1 = nullptr,
const typename arma_cx_only<typename T1::elem_type>::result* junk2 = nullptr
const typename enable_if< is_arma_type<T1>::value >::result* junk1 = nullptr,
const typename arma_cx_only<typename T1::elem_type>::result* junk2 = nullptr
)
{
arma_extra_debug_sigprint();
@@ -48,8 +48,8 @@ const Op<T1, op_htrans>
strans
(
const T1& X,
const typename enable_if< is_arma_type<T1>::value == true >::result* junk1 = nullptr,
const typename arma_not_cx<typename T1::elem_type>::result* junk2 = nullptr
const typename enable_if< is_arma_type<T1>::value >::result* junk1 = nullptr,
const typename arma_not_cx<typename T1::elem_type>::result* junk2 = nullptr
)
{
arma_extra_debug_sigprint();
@@ -72,8 +72,8 @@ const SpOp<T1, spop_strans>
strans
(
const T1& X,
const typename enable_if< is_arma_sparse_type<T1>::value == true >::result* junk1 = nullptr,
const typename arma_cx_only<typename T1::elem_type>::result* junk2 = nullptr
const typename enable_if< is_arma_sparse_type<T1>::value >::result* junk1 = nullptr,
const typename arma_cx_only<typename T1::elem_type>::result* junk2 = nullptr
)
{
arma_extra_debug_sigprint();
@@ -92,8 +92,8 @@ const SpOp<T1, spop_htrans>
strans
(
const T1& X,
const typename enable_if< is_arma_sparse_type<T1>::value == true >::result* junk1 = nullptr,
const typename arma_not_cx<typename T1::elem_type>::result* junk2 = nullptr
const typename enable_if< is_arma_sparse_type<T1>::value >::result* junk1 = nullptr,
const typename arma_not_cx<typename T1::elem_type>::result* junk2 = nullptr
)
{
arma_extra_debug_sigprint();
+4 -4
View File
@@ -25,7 +25,7 @@ const Op<T1, op_htrans>
trans
(
const T1& X,
const typename enable_if< is_arma_type<T1>::value == true >::result* junk = nullptr
const typename enable_if< is_arma_type<T1>::value >::result* junk = nullptr
)
{
arma_extra_debug_sigprint();
@@ -43,7 +43,7 @@ const Op<T1, op_htrans>
htrans
(
const T1& X,
const typename enable_if< is_arma_type<T1>::value == true >::result* junk = nullptr
const typename enable_if< is_arma_type<T1>::value >::result* junk = nullptr
)
{
arma_extra_debug_sigprint();
@@ -65,7 +65,7 @@ const SpOp<T1, spop_htrans>
trans
(
const T1& X,
const typename enable_if< is_arma_sparse_type<T1>::value == true >::result* junk = nullptr
const typename enable_if< is_arma_sparse_type<T1>::value >::result* junk = nullptr
)
{
arma_extra_debug_sigprint();
@@ -83,7 +83,7 @@ const SpOp<T1, spop_htrans>
htrans
(
const T1& X,
const typename enable_if< is_arma_sparse_type<T1>::value == true >::result* junk = nullptr
const typename enable_if< is_arma_sparse_type<T1>::value >::result* junk = nullptr
)
{
arma_extra_debug_sigprint();
+2 -2
View File
@@ -176,12 +176,12 @@ zeros(const uword n_rows, const uword n_cols, const typename arma_SpMat_SpCol_Sp
arma_extra_debug_sigprint();
arma_ignore(junk);
if(is_SpCol<sp_obj_type>::value == true)
if(is_SpCol<sp_obj_type>::value)
{
arma_debug_check( (n_cols != 1), "zeros(): incompatible size" );
}
else
if(is_SpRow<sp_obj_type>::value == true)
if(is_SpRow<sp_obj_type>::value)
{
arma_debug_check( (n_rows != 1), "zeros(): incompatible size" );
}
+3 -3
View File
@@ -151,7 +151,7 @@ mat_injector<T1>::~mat_injector()
const uword max_n_rows = ((*(A[n_rows-1])).n_cols == 0) ? n_rows-1 : n_rows;
if(is_Mat_only<T1>::value == true)
if(is_Mat_only<T1>::value)
{
X.set_size(max_n_rows, max_n_cols);
@@ -171,7 +171,7 @@ mat_injector<T1>::~mat_injector()
}
}
else
if(is_Row<T1>::value == true)
if(is_Row<T1>::value)
{
arma_debug_check( (max_n_rows > 1), "matrix initialisation: incompatible dimensions" );
@@ -182,7 +182,7 @@ mat_injector<T1>::~mat_injector()
arrayops::copy( X.memptr(), (*(A[0])).A.memptr(), n_cols );
}
else
if(is_Col<T1>::value == true)
if(is_Col<T1>::value)
{
const bool is_vec = ( (max_n_rows == 1) || (max_n_cols == 1) );
+1 -1
View File
@@ -474,7 +474,7 @@ op_cdot::apply(const T1& X, const T2& Y)
{
arma_extra_debug_sigprint();
if( (is_Mat<T1>::value == true) && (is_Mat<T2>::value == true) )
if( (is_Mat<T1>::value) && (is_Mat<T2>::value) )
{
return op_cdot::apply_unwrap(X,Y);
}
+2 -2
View File
@@ -267,7 +267,7 @@ op_fft_cx::apply_noalias(Mat<typename T1::elem_type>& out, const Proxy<T1>& P, c
// correct the scaling for the inverse transform
if(inverse == true)
if(inverse)
{
typedef typename get_pod_type<eT>::result T;
@@ -291,7 +291,7 @@ op_fft_cx::copy_vec(typename Proxy<T1>::elem_type* dest, const Proxy<T1>& P, con
{
arma_extra_debug_sigprint();
if(is_Mat< typename Proxy<T1>::stored_type >::value == true)
if(is_Mat< typename Proxy<T1>::stored_type >::value)
{
op_fft_cx::copy_vec_unwrap(dest, P, N);
}
+2 -2
View File
@@ -41,7 +41,7 @@ op_median::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_median>& in)
const bool is_alias = P.is_alias(out);
if( (is_Mat<P_stored_type>::value == true) || is_alias )
if( (is_Mat<P_stored_type>::value) || is_alias )
{
const unwrap_check<P_stored_type> tmp(P.Q, is_alias);
@@ -242,7 +242,7 @@ op_median::median_vec
std::vector<eT> tmp_vec(n_elem);
if(is_Mat<P_stored_type>::value == true)
if(is_Mat<P_stored_type>::value)
{
const unwrap<P_stored_type> tmp(P.Q);
+1 -1
View File
@@ -73,7 +73,7 @@ op_toeplitz_c::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_toeplitz_c
out.set_size(N,N);
if(X.is_rowvec() == true)
if(X.is_rowvec())
{
for(uword row=0; row < N; ++row)
{
+2 -2
View File
@@ -242,7 +242,7 @@ op_vectorise_row::apply_proxy(Mat<typename T1::elem_type>& out, const Proxy<T1>&
if(n_cols == 1)
{
if(is_Mat<typename Proxy<T1>::stored_type>::value == true)
if(is_Mat<typename Proxy<T1>::stored_type>::value)
{
const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
@@ -365,7 +365,7 @@ op_vectorise_cube_col::apply_proxy(Mat<typename T1::elem_type>& out, const Proxy
out.set_size(N, 1);
if(is_Cube<typename ProxyCube<T1>::stored_type>::value == true)
if(is_Cube<typename ProxyCube<T1>::stored_type>::value)
{
const unwrap_cube<typename ProxyCube<T1>::stored_type> tmp(P.Q);
+1 -1
View File
@@ -1520,7 +1520,7 @@ subview<eT>::extract(Mat<eT>& out, const subview<eT>& in)
arma_extra_debug_print(arma_str::format("out.n_rows = %d out.n_cols = %d in.m.n_rows = %d in.m.n_cols = %d") % out.n_rows % out.n_cols % in.m.n_rows % in.m.n_cols );
if(in.is_vec() == true)
if(in.is_vec())
{
if(n_cols == 1) // a column vector
{