| 615 | |
| 616 | template <class T> |
| 617 | FixedArray<int> |
| 618 | FixedVArray<T>::SizeHelper::getitem_mask (const FixedArray<int>& mask) const |
| 619 | { |
| 620 | int len = mask.len(); |
| 621 | if (len != _a.len()) |
| 622 | { |
| 623 | throw std::invalid_argument("Dimensions of mask do not match array"); |
| 624 | } |
| 625 | |
| 626 | int count = 0; |
| 627 | for (Py_ssize_t i = 0; i < mask.len(); ++i) |
| 628 | { |
| 629 | if (mask[i]) count += 1; |
| 630 | } |
| 631 | |
| 632 | FixedArray<int> f(count); |
| 633 | |
| 634 | if (_a._indices) |
| 635 | { |
| 636 | size_t index = 0; |
| 637 | for (Py_ssize_t i = 0; i < mask.len(); ++i) |
| 638 | { |
| 639 | if (mask[i]) |
| 640 | { |
| 641 | f.direct_index(index) = _a._ptr[_a.raw_ptr_index(i)*_a._stride].size(); |
| 642 | index += 1; |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | else |
| 647 | { |
| 648 | size_t index = 0; |
| 649 | for (Py_ssize_t i = 0; i < mask.len(); ++i) |
| 650 | { |
| 651 | if (mask[i]) |
| 652 | { |
| 653 | f.direct_index(index) = _a._ptr[i*_a._stride].size(); |
| 654 | index += 1; |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | return f; |
| 660 | } |
| 661 | |
| 662 | |
| 663 | template <class T> |
nothing calls this directly
no test coverage detected