![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
Permutations are implemented through the permutation class. This class is fully compatible with gsl_permutation objects since it is inherited from gsl_permutation_struct. The class also contains no new data members, so upcasting and downcasting can always be performed. It is perfectly permissible to call GSL permutation functions from permutation objects by simply passing the address of the permutation, i.e.
permutation p(4); p.init(); gsl_permutation_swap(&p,2,3);
The functions which apply a permutation to a user-specified vector are member template functions in the permutation class (see permutation::apply() ).
Memory allocation/deallocation between the class and the gsl_struct is compatible in many cases, but mixing these forms is strongly discouraged, i.e. avoid using gsl_permutation_alloc()
on a permutation object, but rather use permutation::allocate() instead. The use of permutation::free() is encouraged, but any remaining memory will be deallocated in the object destructor.
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).