DSL_intArray

<< Click to Display Table of Contents >>

Navigation:  Reference Manual > Arrays and matrices >

DSL_intArray

Header file: intarray.h

class DSL_intArray : public DSL_numArray<int, 8>

DSL_intArray is derived from DSL_numArray template. DSL_intArray defines methods related to permutations (arrays of size N containing all elements in the 0..N-1 range).


bool IsPermutation() const;

Returns true if the array represents a permutation, false otherwise.


bool IsIdentityPermutation() const;

Returns true if the array represents an identity permutation (all elements have values equal to their indices), false otherwise..


void MakeIdentityPermutation(int size);

Creates the identify permutation of specified size by resizing the array and setting the value of each element equal to its index.


int ChangeOrder(const DSL_intArray& permutation);

Changes the order of elements in the array using the specified permutation. Returns DSL_OKAY on success, or a negative error code if the specified permutation array is not actually a permutation. The permutation array indices are used as sources. For example, {11,22,33,44} will become {44,11,22,33} when ChangeOrder is called with the permutation {3,0,1,2}.