    001/*-
    002 *******************************************************************************
    003 * Copyright (c) 2011, 2016 Diamond Light Source Ltd.
    004 * All rights reserved. This program and the accompanying materials
    005 * are made available under the terms of the Eclipse Public License v1.0
    006 * which accompanies this distribution, and is available at
    007 * http://www.eclipse.org/legal/epl-v10.html
    008 *
    009 * Contributors:
    010 *    Peter Chang - initial API and implementation and/or initial documentation
    011 *******************************************************************************/
    012
    013package org.eclipse.january.dataset;
    014
    015import org.eclipse.january.IMonitor;
    016
    017public interface CompoundDataset extends Dataset {
    018
    019        @Override
    020        public CompoundDataset cast(boolean repeat, int dtype, int isize);
    021
    022        @Override
    023        public CompoundDataset cast(int dtype);
    024
    025        @Override
    026        public CompoundDataset clone();
    027
    028        @Override
    029        public CompoundDataset fill(Object obj);
    030
    031        @Override
    032        public CompoundDataset flatten();
    033
    034        @Override
    035        public CompoundDataset getBy1DIndex(IntegerDataset index);
    036
    037        @Override
    038        public CompoundDataset getByBoolean(Dataset selection);
    039
    040        @Override
    041        public CompoundDataset getByIndexes(Object... indexes);
    042
    043        @Override
    044        public CompoundDataset getSlice(IMonitor mon, int[] start, int[] stop, int[] step);
    045
    046        @Override
    047        public CompoundDataset getSlice(IMonitor mon, Slice... slice);
    048
    049        @Override
    050        public CompoundDataset getSlice(IMonitor mon, SliceND slice);
    051
    052        @Override
    053        public CompoundDataset getSlice(int[] start, int[] stop, int[] step);
    054
    055        @Override
    056        public CompoundDataset getSlice(Slice... slice);
    057
    058        @Override
    059        public CompoundDataset getSlice(SliceND slice);
    060
    061        @Override
    062        public CompoundDataset getSliceView(int[] start, int[] stop, int[] step);
    063
    064        @Override
    065        public CompoundDataset getSliceView(Slice... slice);
    066
    067        @Override
    068        public CompoundDataset getSliceView(SliceND slice);
    069
    070        @Override
    071        public CompoundDataset getTransposedView(int... axes);
    072
    073        @Override
    074        public CompoundDataset getView(boolean deepCopyMetadata);
    075
    076        @Override
    077        public CompoundDataset getBroadcastView(int... shape);
    078
    079        @Override
    080        public CompoundDataset iadd(Object o);
    081
    082        @Override
    083        public CompoundDataset idivide(Object o);
    084
    085        @Override
    086        public CompoundDataset ifloor();
    087
    088        @Override
    089        public CompoundDataset ifloorDivide(Object o);
    090
    091        @Override
    092        public CompoundDataset imultiply(Object o);
    093
    094        @Override
    095        public CompoundDataset ipower(Object o);
    096
    097        @Override
    098        public CompoundDataset iremainder(Object o);
    099
    100        @Override
    101        public CompoundDataset isubtract(Object o);
    102
    103        @Override
    104        public CompoundDataset reshape(int... shape);
    105
    106        @Override
    107        public CompoundDataset setBy1DIndex(Object obj, Dataset index);
    108
    109        @Override
    110        public CompoundDataset setByBoolean(Object obj, Dataset selection);
    111
    112        @Override
    113        public CompoundDataset setByIndexes(Object obj, Object... indexes);
    114
    115        @Override
    116        public CompoundDataset setSlice(Object obj, IndexIterator iterator);
    117
    118        @Override
    119        public CompoundDataset setSlice(Object obj, int[] start, int[] stop, int[] step);
    120
    121        @Override
    122        public CompoundDataset setSlice(Object object, Slice... slice);
    123
    124        @Override
    125        public CompoundDataset sort(Integer axis);
    126
    127        @Override
    128        public CompoundDataset squeezeEnds();
    129
    130        @Override
    131        public CompoundDataset squeeze();
    132
    133        @Override
    134        public CompoundDataset squeeze(boolean onlyFromEnd);
    135
    136        @Override
    137        public CompoundDataset swapAxes(int axis1, int axis2);
    138
    139        @Override
    140        public CompoundDataset synchronizedCopy();
    141
    142        @Override
    143        public CompoundDataset transpose(int... axes);
    144
    145        /**
    146         * @since 2.0
    147         */
    148        @Override
    149        public CompoundDataset max(int axis, boolean... ignoreInvalids);
    150
    151        /**
    152         * @since 2.0
    153         */
    154        @Override
    155        public CompoundDataset min(int axis, boolean... ignoreInvalids);
    156
    157        /**
    158         * @since 2.0
    159         */
    160        @Override
    161        public CompoundDataset peakToPeak(int axis, boolean... ignoreInvalids);
    162
    163        /**
    164         * @since 2.0
    165         */
    166        @Override
    167        public CompoundDataset sum(int axis, boolean... ignoreInvalids);
    168
    169        /**
    170         * @since 2.0
    171         */
    172        @Override
    173        public CompoundDataset product(int axis, boolean... ignoreInvalids);
    174
    175        /**
    176         * @since 2.0
    177         */
    178        @Override
    179        public CompoundDataset mean(int axis, boolean... ignoreInvalids);
    180
    181        /**
    182         * @since 2.0
    183         */
    184        @Override
    185        public CompoundDataset rootMeanSquare(int axis, boolean... ignoreInvalids);
    186
    187        @Override
    188        public CompoundDataset stdDeviation(int axis);
    189
    190        /**
    191         * @since 2.0
    192         */
    193        @Override
    194        public CompoundDataset stdDeviation(int axis, boolean isWholePopulation, boolean... ignoreInvalids);
    195
    196        @Override
    197        public CompoundDataset variance(int axis);
    198
    199        /**
    200         * @since 2.0
    201         */
    202        @Override
    203        public CompoundDataset variance(int axis, boolean isWholePopulation, boolean... ignoreInvalids);
    204
    205        /**
    206         * Get first item as a double array
    207         * @param darray double array must be allocated and have sufficient length
    208         * @since 2.0
    209         */
    210        public void getDoubleArray(double[] darray);
    211
    212        /**
    213         * Get an item as a double array
    214         * @param darray double array must be allocated and have sufficient length
    215         * @param i
    216         */
    217        public void getDoubleArray(double[] darray, final int i);
    218
    219        /**
    220         * Get an item as a double array
    221         * @param darray double array must be allocated and have sufficient length
    222         * @param i
    223         * @param j
    224         */
    225        public void getDoubleArray(double[] darray, final int i, final int j);
    226
    227        /**
    228         * Get an item as a double array
    229         * @param darray double array must be allocated and have sufficient length
    230         * @param pos
    231         */
    232        public void getDoubleArray(double[] darray, final int... pos);
    233
    234        /**
    235         * Get an item as a double array
    236         * @param index
    237         * @param darray double array must be allocated and have sufficient length
    238         */
    239        public void getDoubleArrayAbs(int index, double[] darray);
    240
    241        /**
    242         * Get chosen elements from each item as a dataset
    243         * @param element
    244         * @return dataset of chosen elements
    245         */
    246        public Dataset getElements(int element);
    247
    248        /**
    249         * Get chosen elements from each item as a view on dataset
    250         * @param element
    251         * @return view dataset of chosen elements
    252         */
    253        public Dataset getElementsView(int element);
    254
    255        /**
    256         * Set values of chosen elements from each item according to source dataset
    257         * @param source
    258         * @param element
    259         */
    260        public void setElements(Dataset source, int element);
    261
    262        /**
    263         * Copy chosen elements from each item to another dataset
    264         * @param destination
    265         * @param element
    266         */
    267        public void copyElements(Dataset destination, int element);
    268
    269        /**
    270         * Get a non-compound dataset version
    271         * @param shareData if true, share data otherwise copy it
    272         * @return non-compound dataset
    273         */
    274        public Dataset asNonCompoundDataset(final boolean shareData);
    275
    276        /**
    277         * Calculate maximum values of elements over all items in dataset
    278         * @return double array of element-wise maxima
    279         */
    280        public double[] maxItem();
    281
    282        /**
    283         * Calculate minimum values of elements over all items in dataset
    284         * @return double array of element-wise minima
    285         */
    286        public double[] minItem();
    287
    288        /**
    289         * @since 2.0
    290         */
    291        @Override
    292        public CompoundDataset getErrors();
    293
    294        /**
    295         * @return item in first position
    296         * @since 2.0
    297         */
    298        public byte[] getByteArray();
    299
    300        /**
    301         * @param i
    302         * @return item in given position
    303         */
    304        public byte[] getByteArray(final int i);
    305
    306        /**
    307         * @param i
    308         * @param j
    309         * @return item in given position
    310         */
    311        public byte[] getByteArray(final int i, final int j);
    312
    313        /**
    314         * @param pos
    315         * @return item in given position
    316         */
    317        public byte[] getByteArray(final int... pos);
    318
    319        /**
    320         * @return item in first position
    321         * @since 2.0
    322         */
    323        public short[] getShortArray();
    324
    325        /**
    326         * @param i
    327         * @return item in given position
    328         */
    329        public short[] getShortArray(final int i);
    330
    331        /**
    332         * @param i
    333         * @param j
    334         * @return item in given position
    335         */
    336        public short[] getShortArray(final int i, final int j);
    337
    338        /**
    339         * @param pos
    340         * @return item in given position
    341         */
    342        public short[] getShortArray(final int... pos);
    343
    344        /**
    345         * @return item in first position
    346         * @since 2.0
    347         */
    348        public int[] getIntArray();
    349
    350        /**
    351         * @param i
    352         * @return item in given position
    353         */
    354        public int[] getIntArray(final int i);
    355
    356        /**
    357         * @param i
    358         * @param j
    359         * @return item in given position
    360         */
    361        public int[] getIntArray(final int i, final int j);
    362
    363        /**
    364         * @param pos
    365         * @return item in given position
    366         * @since 2.0
    367         */
    368        public int[] getIntArray(final int... pos);
    369
    370        /**
    371         * @return item in first position
    372         * @since 2.0
    373         */
    374        public long[] getLongArray();
    375
    376        /**
    377         * @param i
    378         * @return item in given position
    379         */
    380        public long[] getLongArray(final int i);
    381
    382        /**
    383         * @param i
    384         * @param j
    385         * @return item in given position
    386         */
    387        public long[] getLongArray(final int i, final int j);
    388
    389        /**
    390         * @param pos
    391         * @return item in given position
    392         */
    393        public long[] getLongArray(final int... pos);
    394
    395        /**
    396         * @return item in first position
    397         * @since 2.0
    398         */
    399        public float[] getFloatArray();
    400
    401        /**
    402         * @param i
    403         * @return item in given position
    404         */
    405        public float[] getFloatArray(final int i);
    406
    407        /**
    408         * @param i
    409         * @param j
    410         * @return item in given position
    411         */
    412        public float[] getFloatArray(final int i, final int j);
    413
    414        /**
    415         * @param pos
    416         * @return item in given position
    417         */
    418        public float[] getFloatArray(final int... pos);
    419
    420        /**
    421         * @return item in first position
    422         * @since 2.0
    423         */
    424        public double[] getDoubleArray();
    425
    426        /**
    427         * @param i
    428         * @return item in given position
    429         */
    430        public double[] getDoubleArray(final int i);
    431
    432        /**
    433         * @param i
    434         * @param j
    435         * @return item in given position
    436         */
    437        public double[] getDoubleArray(final int i, final int j);
    438
    439        /**
    440         * @param pos
    441         * @return item in given position
    442         */
    443        public double[] getDoubleArray(final int... pos);
    444}