add .clamp()
This commit is contained in:
@@ -323,6 +323,8 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
|
||||
inline const Cube& clean(const pod_type threshold);
|
||||
|
||||
inline const Cube& clamp(const eT min_val, const eT max_val);
|
||||
|
||||
inline const Cube& fill(const eT val);
|
||||
|
||||
inline const Cube& zeros();
|
||||
|
||||
@@ -3942,6 +3942,22 @@ Cube<eT>::clean(const typename get_pod_type<eT>::result threshold)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
const Cube<eT>&
|
||||
Cube<eT>::clamp(const eT min_val, const eT max_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (min_val > max_val), "Cube::clamp(): min_val must be less than max_val" );
|
||||
|
||||
arrayops::clamp(memptr(), n_elem, min_val, max_val);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! fill the cube with the specified value
|
||||
template<typename eT>
|
||||
inline
|
||||
|
||||
Reference in New Issue
Block a user