| 255 | } |
| 256 | |
| 257 | nd::array get(int64_t index) const |
| 258 | { |
| 259 | if (!needs_resize_) { |
| 260 | return a_[index]; |
| 261 | } |
| 262 | auto& s = slices_.front(); |
| 263 | auto ii = index * s.step + s.offset; |
| 264 | |
| 265 | if (a_.shape().size() > 1) { |
| 266 | return nd::array( |
| 267 | sliced_array(a_[ii], {slices_.begin() + 1, slices_.end()}, {shape_.begin() + 1, shape_.end()})); |
| 268 | } |
| 269 | return a_[ii]; |
| 270 | } |
| 271 | |
| 272 | nd::array eval() const |
| 273 | { |