In numpy you can perform operations that look like this:
arr = np.array([[1,2,3],[4,5,6]])
ind = np.array([[0],[1]])
value = arr[ind]
I think it makes sense to implement an overload of operator() such that when an xcontainer is passed as the argument it returns an xexpression that looks the same as the value object in the example above. I think this would really help for instances where the dimensionality of the problem is dynamic. I have implemented the simple case where you provide have n dimensions and provide a single array that is 1xn resulting in 1 integral value using by calculating the linear index location I want from a stride and accessing through the raw pointer. I was previously using a strided view but it was too slow and seemed like over kill for my use case of access one value (rather than a range of values) in a multidimensional object where I know what index I want.
In numpy you can perform operations that look like this:
I think it makes sense to implement an overload of
operator()
such that when an xcontainer is passed as the argument it returns an xexpression that looks the same as the value object in the example above. I think this would really help for instances where the dimensionality of the problem is dynamic. I have implemented the simple case where you provide have n dimensions and provide a single array that is 1xn resulting in 1 integral value using by calculating the linear index location I want from a stride and accessing through the raw pointer. I was previously using a strided view but it was too slow and seemed like over kill for my use case of access one value (rather than a range of values) in a multidimensional object where I know what index I want.Thoughts?