handle NaNs when checking ranges
This commit is contained in:
@@ -47,7 +47,7 @@ rande(const uword n_rows, const uword n_cols, const distr_param& param = distr_p
|
||||
|
||||
param.get_double_vals(lambda, unused);
|
||||
|
||||
arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
arma_conform_check( ((lambda > double(0)) == false), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
|
||||
obj_type out(n_rows, n_cols, arma_nozeros_indicator());
|
||||
|
||||
@@ -138,7 +138,7 @@ rande(const distr_param& param = distr_param())
|
||||
|
||||
param.get_double_vals(lambda, unused);
|
||||
|
||||
arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
arma_conform_check( ((lambda > double(0)) == false), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
|
||||
double out_val = double(0);
|
||||
|
||||
@@ -162,7 +162,7 @@ rande(const distr_param& param = distr_param())
|
||||
|
||||
param.get_double_vals(lambda, unused);
|
||||
|
||||
arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
arma_conform_check( ((lambda > double(0)) == false), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
|
||||
eT out_val = eT(0);
|
||||
|
||||
@@ -189,7 +189,7 @@ rande(const uword n_rows, const uword n_cols, const uword n_slices, const distr_
|
||||
|
||||
param.get_double_vals(lambda, unused);
|
||||
|
||||
arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
arma_conform_check( ((lambda > double(0)) == false), "rande(): incorrect distribution parameters; lambda must be greater than zero" );
|
||||
|
||||
cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator());
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ randg(const uword n_rows, const uword n_cols, const distr_param& param = distr_p
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
arma_conform_check( ( ((a > double(0)) == false) || ((b > double(0)) == false) ), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
|
||||
obj_type out(n_rows, n_cols, arma_nozeros_indicator());
|
||||
|
||||
@@ -138,7 +138,7 @@ randg(const distr_param& param = distr_param())
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
arma_conform_check( ( ((a > double(0)) == false) || ((b > double(0)) == false) ), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
|
||||
double out_val = double(0);
|
||||
|
||||
@@ -162,7 +162,7 @@ randg(const distr_param& param = distr_param())
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
arma_conform_check( ( ((a > double(0)) == false) || ((b > double(0)) == false) ), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
|
||||
eT out_val = eT(0);
|
||||
|
||||
@@ -189,7 +189,7 @@ randg(const uword n_rows, const uword n_cols, const uword n_slices, const distr_
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( ((a <= double(0)) || (b <= double(0))), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
arma_conform_check( ( ((a > double(0)) == false) || ((b > double(0)) == false) ), "randg(): incorrect distribution parameters; a and b must be greater than zero" );
|
||||
|
||||
cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator());
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ randi(const uword n_rows, const uword n_cols, const distr_param& param = distr_p
|
||||
|
||||
param.get_int_vals(a,b);
|
||||
|
||||
arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a <= b) == false), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
obj_type out(n_rows, n_cols, arma_nozeros_indicator());
|
||||
|
||||
@@ -142,7 +142,7 @@ randi(const distr_param& param)
|
||||
|
||||
param.get_int_vals(a,b);
|
||||
|
||||
arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a <= b) == false), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
sword out_val = sword(0);
|
||||
|
||||
@@ -166,7 +166,7 @@ randi(const distr_param& param)
|
||||
|
||||
param.get_int_vals(a,b);
|
||||
|
||||
arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a <= b) == false), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
eT out_val = eT(0);
|
||||
|
||||
@@ -218,7 +218,7 @@ randi(const uword n_rows, const uword n_cols, const uword n_slices, const distr_
|
||||
|
||||
param.get_int_vals(a,b);
|
||||
|
||||
arma_conform_check( (a > b), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a <= b) == false), "randi(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator());
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ randn(const distr_param& param)
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
const double val = double(arma_rng::randn<double>());
|
||||
|
||||
@@ -86,7 +86,7 @@ randn(const distr_param& param)
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
eT val = eT(0);
|
||||
|
||||
@@ -119,7 +119,7 @@ randn(const uword n_elem, const distr_param& param = distr_param())
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
arma_rng::randn<double>::fill(out.memptr(), n_elem, mu, sd);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ randn(const uword n_elem, const distr_param& param = distr_param(), const typena
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
arma_rng::randn<eT>::fill(out.memptr(), out.n_elem, mu, sd);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ randn(const uword n_rows, const uword n_cols, const distr_param& param = distr_p
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
arma_rng::randn<double>::fill(out.memptr(), out.n_elem, mu, sd);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ randn(const uword n_rows, const uword n_cols, const distr_param& param = distr_p
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
arma_rng::randn<eT>::fill(out.memptr(), out.n_elem, mu, sd);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ randn(const uword n_rows, const uword n_cols, const uword n_slices, const distr_
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
arma_rng::randn<double>::fill(out.memptr(), out.n_elem, mu, sd);
|
||||
}
|
||||
@@ -330,7 +330,7 @@ randn(const uword n_rows, const uword n_cols, const uword n_slices, const distr_
|
||||
|
||||
param.get_double_vals(mu,sd);
|
||||
|
||||
arma_conform_check( (sd <= double(0)), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
arma_conform_check( ((sd > double(0)) == false), "randn(): incorrect distribution parameters; standard deviation must be > 0" );
|
||||
|
||||
arma_rng::randn<eT>::fill(out.memptr(), out.n_elem, mu, sd);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ randu(const distr_param& param)
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
const double val = double(arma_rng::randu<double>());
|
||||
|
||||
@@ -86,7 +86,7 @@ randu(const distr_param& param)
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
eT val = eT(0);
|
||||
|
||||
@@ -119,7 +119,7 @@ randu(const uword n_elem, const distr_param& param = distr_param())
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
arma_rng::randu<double>::fill(out.memptr(), n_elem, a, b);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ randu(const uword n_elem, const distr_param& param = distr_param(), const typena
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
arma_rng::randu<eT>::fill(out.memptr(), out.n_elem, a, b);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ randu(const uword n_rows, const uword n_cols, const distr_param& param = distr_p
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
arma_rng::randu<double>::fill(out.memptr(), out.n_elem, a, b);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ randu(const uword n_rows, const uword n_cols, const distr_param& param = distr_p
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
arma_rng::randu<eT>::fill(out.memptr(), out.n_elem, a, b);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ randu(const uword n_rows, const uword n_cols, const uword n_slices, const distr_
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
arma_rng::randu<double>::fill(out.memptr(), out.n_elem, a, b);
|
||||
}
|
||||
@@ -330,7 +330,7 @@ randu(const uword n_rows, const uword n_cols, const uword n_slices, const distr_
|
||||
|
||||
param.get_double_vals(a,b);
|
||||
|
||||
arma_conform_check( (a >= b), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
arma_conform_check( ((a < b) == false), "randu(): incorrect distribution parameters; a must be less than b" );
|
||||
|
||||
arma_rng::randu<eT>::fill(out.memptr(), out.n_elem, a, b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user