Ticket #5989 (closed: invalid)
Investigate 1D arrangement of multidimensional MD Histo workspace arrays
Reported by: | Alex Buts | Owned by: | Alex Buts |
---|---|---|---|
Priority: | major | Milestone: | Release 2.6 |
Component: | Framework | Keywords: | CORE |
Cc: | martyn.gigg@… | Blocked By: | |
Blocking: | Tester: | Andrei Savici |
Description (last modified by Alex Buts) (diff)
MD histo workspace can be produced by rebinning suitable MD workspace using BinMD algorithm in the form:
BinMD(InputWorkspace=wsName,AlignedDim0='x,x_min,x_max,nd[0]',AlignedDim1='y,y_min,y_max,nd[1]',AlignedDim2='z,z_min,z_max,nd[2]'OutputWorkspace=ResultingHisto_WS_Name)
The array nd[3] describes the dimensions of the resulting multidimensional MD Histo workspace array: array. The access to the data of this array currently can be arranged by the code:
for(int k=0;k<nd[2];k++) { for(int j=0;j<nd[1];j++) { for(int i=0;i<nd[0];i++) { // linear index: int index=i+nd[0]*(j+k*nd[1]); data = array[index]; } } }
to export this array to Numpy for one accessing it in C-way data=array[k,j,i], i is the fastest index, one has to invert the index array nd and give it to python API as
nd_numpy[0]=nd[2]; nd_numpy[1]=nd[1]; nd_numpy[2]=nd[0];
Is it the most natural way of working with 1D array in C++? What should be changed to do it natural way?
Change History
comment:2 Changed 8 years ago by Nick Draper
- Keywords CORE added
This should be done, but it is purely internal and therefore can be considered low priority.
However this should be considered a CORE FUNCTIONALITY change
comment:5 Changed 8 years ago by Nick Draper
- Owner set to Alex Buts
- Status changed from new to assigned
comment:9 Changed 7 years ago by Alex Buts
- Status changed from new to verify
- Resolution set to invalid
- Description modified (diff)
Current way is around for a while and number of user scripts is based on it. Hassle of changing at current stage grossly overweights all questionable benefits new users can get from this change.
I think it lost all relevance at the moment -- C access to indexes of multidimensional arrays may be considered the Mantid standard.
comment:10 Changed 7 years ago by Andrei Savici
- Status changed from verify to verifying
- Tester set to Andrei Savici
comment:13 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 6835