more informative error messages
This commit is contained in:
@@ -57,7 +57,13 @@ conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_not_cx<in_e
|
||||
|
||||
const Proxy<T1> P(in.get_ref());
|
||||
|
||||
arma_conform_check( (P.get_n_elem() != 1), "conv_to(): given object does not have exactly one element" );
|
||||
if( (arma_config::check_conform) && (P.get_n_elem() != 1) )
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
arma_conform_check_bounds(true, (arma_str::format("conv_to(): expected 1x1 matrix; got %zux%zu") % std::size_t(n_rows) % std::size_t(n_cols)) );
|
||||
}
|
||||
|
||||
return out_eT(Proxy<T1>::use_at ? P.at(0,0) : P[0]);
|
||||
}
|
||||
@@ -78,7 +84,13 @@ conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_cx_only<in_
|
||||
|
||||
const Proxy<T1> P(in.get_ref());
|
||||
|
||||
arma_conform_check( (P.get_n_elem() != 1), "conv_to(): given object does not have exactly one element" );
|
||||
if( (arma_config::check_conform) && (P.get_n_elem() != 1) )
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
arma_conform_check_bounds(true, (arma_str::format("conv_to(): expected 1x1 matrix; got %zux%zu") % std::size_t(n_rows) % std::size_t(n_cols)) );
|
||||
}
|
||||
|
||||
out_eT out;
|
||||
|
||||
@@ -103,7 +115,14 @@ conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_not_cx<
|
||||
|
||||
const ProxyCube<T1> P(in.get_ref());
|
||||
|
||||
arma_conform_check( (P.get_n_elem() != 1), "conv_to(): given object does not have exactly one element" );
|
||||
if( (arma_config::check_conform) && (P.get_n_elem() != 1) )
|
||||
{
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
arma_conform_check_bounds(true, (arma_str::format("conv_to(): expected 1x1x1 cube; got %zux%zux%zu") % std::size_t(n_r) % std::size_t(n_c) % std::size_t(n_s)) );
|
||||
}
|
||||
|
||||
return out_eT(ProxyCube<T1>::use_at ? P.at(0,0,0) : P[0]);
|
||||
}
|
||||
@@ -124,7 +143,14 @@ conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_cx_only
|
||||
|
||||
const ProxyCube<T1> P(in.get_ref());
|
||||
|
||||
arma_conform_check( (P.get_n_elem() != 1), "conv_to(): given object does not have exactly one element" );
|
||||
if( (arma_config::check_conform) && (P.get_n_elem() != 1) )
|
||||
{
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
arma_conform_check_bounds(true, (arma_str::format("conv_to(): expected 1x1x1 cube; got %zux%zux%zu") % std::size_t(n_r) % std::size_t(n_c) % std::size_t(n_s)) );
|
||||
}
|
||||
|
||||
out_eT out;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user