| 90 | |
| 91 | template <typename DataT> |
| 92 | struct SelectImplIfFalse |
| 93 | { |
| 94 | DataT m_value, m_epsilon, m_iffalse; |
| 95 | SelectImplIfFalse(DataT const& value, |
| 96 | DataT const& epsilon, |
| 97 | DataT const& iffalse) |
| 98 | : m_value(value), m_epsilon(epsilon), m_iffalse(iffalse) |
| 99 | {} |
| 100 | |
| 101 | DataT operator()(DataT const& predicate, DataT const& iftrue) const noexcept |
| 102 | { |
| 103 | bool istrue = std::fabs(predicate - m_value) < m_epsilon; |
| 104 | return istrue ? iftrue : m_iffalse; |
| 105 | } |
| 106 | void operator()(DataT const& predicate, |
| 107 | DataT const& iftrue, |
| 108 | DataT const& dy, |
| 109 | DataT& dpredicate, |
| 110 | DataT& diftrue) const noexcept |
| 111 | { |
| 112 | bool istrue = std::fabs(predicate - m_value) < m_epsilon; |
| 113 | diftrue = istrue ? dy : El::TypeTraits<DataT>::Zero(); |
| 114 | dpredicate = El::TypeTraits<DataT>::Zero(); |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | template <typename DataT> |
| 119 | struct SelectImplConstant |
no outgoing calls
no test coverage detected