| 855 | } |
| 856 | |
| 857 | inline void nonzero(icm::bit_vector_view output) const |
| 858 | { |
| 859 | if (has_data_) { |
| 860 | nd::switch_numeric_dtype(dtype(), [this, &output]<typename T>() { |
| 861 | auto y = data<T>(); |
| 862 | output.set_from_span(y); |
| 863 | }); |
| 864 | return; |
| 865 | } |
| 866 | try { |
| 867 | holder()->nonzero(output); |
| 868 | } catch (const invalid_operation&) { |
| 869 | int64_t i = 0L; |
| 870 | auto e = end(); |
| 871 | for (auto it = begin(); it != e; ++it) { |
| 872 | try { |
| 873 | auto d = *it; |
| 874 | if (d && !d.empty() && d.value<bool>(0)) { |
| 875 | output.set(i); |
| 876 | } |
| 877 | } catch (const std::exception&) { |
| 878 | /// Intentionally empty. |
| 879 | } |
| 880 | ++i; |
| 881 | } |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | friend array eval(array); |
| 886 | friend void copy_data(const array& arr, std::span<uint8_t>); |
no test coverage detected