Loading...
Searching...
No Matches
casacore::ArrayUtil_global_functions_reorderArray Struct Reference
casa package (libcasa_casa) » Arrays_module

Reorder the axes of an array. More...

`#include <ArrayUtil.h>`

## Public Member Functions

template<class T>
Array< T > | reorderArray (const Array< T > &array, const IPosition &newAxisOrder, bool alwaysCopy=true)

## Detailed Description

Reorder the axes of an array.

### Intended use:

Public interface

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25
Test programs:
  tArrayUtil2

### Synopsis

This function makes it possible to reorder the axes of an array. The resulting array is a copy of the input array with its data moved around according to the new array order. If the order does not change, a copy is returned if the alwaysCopy is true. Otherwise a reference of the input array is returned.

The newAxisOrder defines the new axes order. Its length can be less than the dimensionality of the input array. It is appended with the non-specified axes in their natural order. newAxisOrder(i) gives the axis in the original array which will now get axis i.

### Example

Array<int> result = reorderArray (someArray, IPosition(2,1,3));
casacore::Array
Definition Array.h:155
casacore::IPosition
Definition IPosition.h:117
casacore::ArrayUtil_global_functions_reorderArray::reorderArray
Array< T > reorderArray(const Array< T > &array, const IPosition &newAxisOrder, bool alwaysCopy=true)

Say that someArray is a 4D array with shape [3,4,5,6]. The non-specified axes get appended to the axis order specification [1,3] resulting in [1,3,0,2].
This means that axis 1 gets axis 0, axis 3 gets axis 1, axis 0 gets axis 2, and axis 2 gets axis 3. Thus the resulting shape is [4,6,3,5] and the data are moved accordingly.

### Motivation

This function was needed for an efficient implementation of the functions partialMedians and partialFractiles.

Definition at line 266 of file ArrayUtil.h.

## Member Function Documentation

## reorderArray()

template<class T>

Array< T > casacore::ArrayUtil_global_functions_reorderArray::reorderArray | ( | const Array< T > & | array,
|  | const IPosition & | newAxisOrder,
|  | bool | alwaysCopy = true )

References casacore::array.

The documentation for this struct was generated from the following file:

- casa/Arrays/ArrayUtil.h