ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::permutation Class Reference

This class handles GSL permutation objects. More...

#include <permutation.hpp>

Collaboration diagram for gsl::permutation:
Collaboration graph

Classes

class  const_iterator_t
 A class template for the const iterators. More...
 
class  iterator_base
 The container must have iterator types. More...
 

Public Types

typedef const_iterator_t< false > const_iterator
 The const_iterator type. More...
 
typedef const_iterator_t< true > const_reverse_iterator
 The const_reverse_iterator type. More...
 
typedef const_iterator::difference_type difference_type
 A container must have a difference_type. More...
 
typedef size_t size_type
 A container must have a size_type. More...
 

Public Member Functions

 permutation ()
 The default constructor is only really useful for assigning to. More...
 
 permutation (size_t const n, bool init=false)
 This constructor creates a new permutation with n elements. More...
 
 permutation (gsl_permutation *v)
 Could construct from a gsl_permutation. More...
 
 permutation (permutation const &v)
 The copy constructor. More...
 
permutationoperator= (permutation const &v)
 The assignment operator. More...
 
permutation clone () const
 The clone function. More...
 
 ~permutation ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 permutation (permutation &&v)
 Move constructor. More...
 
permutationoperator= (permutation &&v)
 Move operator. More...
 
gsl_permutation * get ()
 Get the gsl_permutation. More...
 
gsl_permutation const * get () const
 Get the gsl_permutation. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_permutation. More...
 
size_t use_count () const
 Find how many permutation objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
void init ()
 C++ version of gsl_permutation_init(). More...
 
int memcpy (permutation const &src)
 C++ version of gsl_permutation_memcpy(). More...
 
int fread (FILE *stream)
 C++ version of gsl_permutation_fread(). More...
 
int fwrite (FILE *stream) const
 C++ version of gsl_permutation_fwrite(). More...
 
int fscanf (FILE *stream)
 C++ version of gsl_permutation_fscanf(). More...
 
int fprintf (FILE *stream, char const *format) const
 C++ version of gsl_permutation_fprintf(). More...
 
size_t size () const
 C++ version of gsl_permutation_size(). More...
 
size_t * data () const
 C++ version of gsl_permutation_data(). More...
 
int swap (size_t const i, size_t const j)
 C++ version of gsl_permutation_swap(). More...
 
int valid () const
 C++ version of gsl_permutation_valid(). More...
 
void reverse ()
 C++ version of gsl_permutation_reverse(). More...
 
int inverse (permutation const &p)
 C++ version of gsl_permutation_inverse(). More...
 
int next ()
 C++ version of gsl_permutation_next(). More...
 
int prev ()
 C++ version of gsl_permutation_prev(). More...
 
int mul (permutation const &pa, permutation const &pb)
 C++ version of gsl_permutation_mul(). More...
 
int linear_to_canonical (permutation const &p)
 C++ version of gsl_permutation_linear_to_canonical(). More...
 
int canonical_to_linear (permutation const &q)
 C++ version of gsl_permutation_canonical_to_linear(). More...
 
size_t inversions () const
 C++ version of gsl_permutation_inversions(). More...
 
size_t linear_cycles () const
 C++ version of gsl_permutation_linear_cycles(). More...
 
size_t canonical_cycles () const
 C++ version of gsl_permutation_canonical_cycles(). More...
 
size_t get (size_t const i) const
 C++ version of gsl_permutation_get(). More...
 
size_t operator[] (size_t const i) const
 C++ version of gsl_permutation_get(). More...
 
const_iterator begin () const
 Get iterator pointing to first permutation element. More...
 
const_iterator end () const
 Get iterator pointing beyond last permutation element. More...
 

Static Public Member Functions

static permutation calloc (size_t const n)
 C++ version of gsl_permutation_calloc(). More...
 

Private Attributes

gsl_permutation * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

This class handles GSL permutation objects.

Definition at line 33 of file permutation.hpp.

Member Typedef Documentation

◆ const_iterator

The const_iterator type.

Definition at line 737 of file permutation.hpp.

◆ const_reverse_iterator

The const_reverse_iterator type.

Definition at line 741 of file permutation.hpp.

◆ difference_type

A container must have a difference_type.

Definition at line 746 of file permutation.hpp.

◆ size_type

A container must have a size_type.

Definition at line 751 of file permutation.hpp.

Constructor & Destructor Documentation

◆ permutation() [1/5]

gsl::permutation::permutation ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 38 of file permutation.hpp.

References ccgsl_pointer, and count.

Referenced by calloc().

◆ permutation() [2/5]

gsl::permutation::permutation ( size_t const  n,
bool  init = false 
)
inlineexplicit

This constructor creates a new permutation with n elements.

Parameters
nThe number of elements in the permutation
initSet to true to have the permutation initialised

Definition at line 47 of file permutation.hpp.

References ccgsl_pointer, count, init(), and gsl::rstat::n().

◆ permutation() [3/5]

gsl::permutation::permutation ( gsl_permutation *  v)
inlineexplicit

Could construct from a gsl_permutation.

This is not usually a good idea. In this case you should not use gsl_permutation_free() to deallocate the memory.

Parameters
vThe permutation

Definition at line 63 of file permutation.hpp.

References ccgsl_pointer, and count.

◆ permutation() [4/5]

gsl::permutation::permutation ( permutation const &  v)
inline

The copy constructor.

This shares the permutation. Use clone() if you want a full copy.

Parameters
vThe permutation to copy.

Definition at line 74 of file permutation.hpp.

References count.

◆ ~permutation()

gsl::permutation::~permutation ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 111 of file permutation.hpp.

References ccgsl_pointer, and count.

◆ permutation() [5/5]

gsl::permutation::permutation ( permutation &&  v)
inline

Move constructor.

Parameters
vThe permutation to move.

Definition at line 123 of file permutation.hpp.

References count.

Member Function Documentation

◆ begin()

const_iterator gsl::permutation::begin ( ) const
inline

Get iterator pointing to first permutation element.

Returns
iterator pointing to first permutation element

Definition at line 757 of file permutation.hpp.

◆ calloc()

static permutation gsl::permutation::calloc ( size_t const  n)
inlinestatic

C++ version of gsl_permutation_calloc().

Parameters
nThe size of the permutation
Returns
A new permutation, initialised to the identity

Definition at line 186 of file permutation.hpp.

References gsl::rstat::n(), and permutation().

◆ canonical_cycles()

size_t gsl::permutation::canonical_cycles ( ) const
inline

C++ version of gsl_permutation_canonical_cycles().

Returns
The number of cycles (canonical form)

Definition at line 302 of file permutation.hpp.

References get().

◆ canonical_to_linear()

int gsl::permutation::canonical_to_linear ( permutation const &  q)
inline

C++ version of gsl_permutation_canonical_to_linear().

Parameters
qApermutation
Returns
Error code on failure

Definition at line 286 of file permutation.hpp.

References get().

◆ clone()

permutation gsl::permutation::clone ( ) const
inline

The clone function.

Use this if you want a copy of the permutation that does not share the underlying data.

Returns
a new copy of this.

Definition at line 100 of file permutation.hpp.

References get(), and size().

◆ data()

size_t * gsl::permutation::data ( ) const
inline

C++ version of gsl_permutation_data().

Returns
Pointer to the array of elements

Definition at line 232 of file permutation.hpp.

References get().

◆ end()

const_iterator gsl::permutation::end ( ) const
inline

Get iterator pointing beyond last permutation element.

Returns
iterator pointing beyond last permutation element

Definition at line 765 of file permutation.hpp.

References ccgsl_pointer, and size().

◆ fprintf()

int gsl::permutation::fprintf ( FILE *  stream,
char const *  format 
) const
inline

C++ version of gsl_permutation_fprintf().

Parameters
streamAn output stream
formatA print format: typically "%zu\n"
Returns
Error code on failure

Definition at line 221 of file permutation.hpp.

References get().

◆ fread()

int gsl::permutation::fread ( FILE *  stream)
inline

C++ version of gsl_permutation_fread().

Parameters
streamAn output stream
Returns
Error code on failure

Definition at line 202 of file permutation.hpp.

References get().

◆ fscanf()

int gsl::permutation::fscanf ( FILE *  stream)
inline

C++ version of gsl_permutation_fscanf().

Parameters
streamAn output stream
Returns
Error code on failure

Definition at line 214 of file permutation.hpp.

References get().

◆ fwrite()

int gsl::permutation::fwrite ( FILE *  stream) const
inline

C++ version of gsl_permutation_fwrite().

Parameters
streamAn output stream
Returns
Error code on failure

Definition at line 208 of file permutation.hpp.

References get().

◆ get() [1/3]

gsl_permutation * gsl::permutation::get ( )
inline

Get the gsl_permutation.

Returns
the gsl_permutation

Definition at line 153 of file permutation.hpp.

References ccgsl_pointer.

Referenced by canonical_cycles(), canonical_to_linear(), clone(), gsl::linalg::COD_decomp(), gsl::linalg::COD_decomp_e(), gsl::linalg::COD_lssolve(), gsl::linalg::COD_lssolve2(), gsl::permute::complex_float_forward(), gsl::permute::complex_float_inverse(), gsl::permute::complex_forward(), gsl::permute::complex_inverse(), gsl::permute::complex_long_double_forward(), gsl::permute::complex_long_double_inverse(), gsl::linalg::complex_LU_decomp(), gsl::linalg::complex_LU_invert(), gsl::linalg::complex_LU_invx(), gsl::linalg::complex_LU_refine(), gsl::linalg::complex_LU_solve(), gsl::linalg::complex_LU_svx(), data(), gsl::permute::float_forward(), gsl::permute::float_inverse(), gsl::permute::forward(), fprintf(), fread(), fscanf(), fwrite(), init(), gsl::permute::int_forward(), gsl::permute::int_inverse(), inverse(), gsl::permute::inverse(), inversions(), linear_cycles(), linear_to_canonical(), gsl::permute::long_double_forward(), gsl::permute::long_double_inverse(), gsl::permute::long_forward(), gsl::permute::long_inverse(), gsl::linalg::LU_decomp(), gsl::linalg::LU_invert(), gsl::linalg::LU_invx(), gsl::linalg::LU_refine(), gsl::linalg::LU_solve(), gsl::linalg::LU_svx(), gsl::linalg::mcholesky_decomp(), gsl::linalg::mcholesky_invert(), gsl::linalg::mcholesky_rcond(), gsl::linalg::mcholesky_solve(), gsl::linalg::mcholesky_svx(), memcpy(), mul(), next(), operator[](), gsl::linalg::pcholesky_decomp(), gsl::linalg::pcholesky_decomp2(), gsl::linalg::pcholesky_invert(), gsl::linalg::pcholesky_rcond(), gsl::linalg::pcholesky_solve(), gsl::linalg::pcholesky_solve2(), gsl::linalg::pcholesky_svx(), gsl::linalg::pcholesky_svx2(), gsl::matrix::permute(), gsl::matrix_char::permute(), gsl::matrix_complex::permute(), gsl::matrix_complex_float::permute(), gsl::matrix_complex_long_double::permute(), gsl::matrix_float::permute(), gsl::matrix_int::permute(), gsl::matrix_long::permute(), gsl::matrix_long_double::permute(), gsl::matrix_short::permute(), gsl::matrix_uchar::permute(), gsl::matrix_uint::permute(), gsl::matrix_ulong::permute(), gsl::matrix_ushort::permute(), prev(), gsl::linalg::PTLQ_decomp(), gsl::linalg::PTLQ_decomp2(), gsl::linalg::PTLQ_LQsolve_T(), gsl::linalg::PTLQ_Lsolve_T(), gsl::linalg::PTLQ_Lsvx_T(), gsl::linalg::PTLQ_solve_T(), gsl::linalg::PTLQ_svx_T(), gsl::linalg::PTLQ_update(), gsl::linalg::QRPT_decomp(), gsl::linalg::QRPT_decomp2(), gsl::linalg::QRPT_lssolve(), gsl::linalg::QRPT_lssolve2(), gsl::linalg::QRPT_QRsolve(), gsl::linalg::QRPT_Rsolve(), gsl::linalg::QRPT_Rsvx(), gsl::linalg::QRPT_solve(), gsl::linalg::QRPT_svx(), gsl::linalg::QRPT_update(), reverse(), gsl::permute::short_forward(), gsl::permute::short_inverse(), size(), swap(), gsl::permute::uchar_forward(), gsl::permute::uchar_inverse(), gsl::permute::uint_forward(), gsl::permute::uint_inverse(), gsl::permute::ulong_forward(), gsl::permute::ulong_inverse(), gsl::permute::ushort_forward(), gsl::permute::ushort_inverse(), valid(), gsl::permute::vector_char_forward(), gsl::permute::vector_char_inverse(), gsl::permute::vector_complex_float_forward(), gsl::permute::vector_complex_float_inverse(), gsl::permute::vector_complex_forward(), gsl::permute::vector_complex_inverse(), gsl::permute::vector_complex_long_double_forward(), gsl::permute::vector_complex_long_double_inverse(), gsl::permute::vector_float_forward(), gsl::permute::vector_float_inverse(), gsl::permute::vector_forward(), gsl::permute::vector_int_forward(), gsl::permute::vector_int_inverse(), gsl::permute::vector_inverse(), gsl::permute::vector_long_double_forward(), gsl::permute::vector_long_double_inverse(), gsl::permute::vector_long_forward(), gsl::permute::vector_long_inverse(), gsl::permute::vector_short_forward(), gsl::permute::vector_short_inverse(), gsl::permute::vector_uchar_forward(), gsl::permute::vector_uchar_inverse(), gsl::permute::vector_uint_forward(), gsl::permute::vector_uint_inverse(), gsl::permute::vector_ulong_forward(), gsl::permute::vector_ulong_inverse(), gsl::permute::vector_ushort_forward(), and gsl::permute::vector_ushort_inverse().

◆ get() [2/3]

gsl_permutation const * gsl::permutation::get ( ) const
inline

Get the gsl_permutation.

Returns
the gsl_permutation

Definition at line 158 of file permutation.hpp.

References ccgsl_pointer.

◆ get() [3/3]

size_t gsl::permutation::get ( size_t const  i) const
inline

C++ version of gsl_permutation_get().

Parameters
iindex of element
Returns
Element at index i

Definition at line 308 of file permutation.hpp.

References get().

Referenced by get().

◆ init()

void gsl::permutation::init ( )
inline

C++ version of gsl_permutation_init().

Definition at line 190 of file permutation.hpp.

References get().

Referenced by permutation().

◆ inverse()

int gsl::permutation::inverse ( permutation const &  p)
inline

C++ version of gsl_permutation_inverse().

Parameters
pAnother permutation
Returns
Error code on failure

Definition at line 254 of file permutation.hpp.

References get().

◆ inversions()

size_t gsl::permutation::inversions ( ) const
inline

C++ version of gsl_permutation_inversions().

Returns
The number of inversions (pairs not in order)

Definition at line 292 of file permutation.hpp.

References get().

◆ linear_cycles()

size_t gsl::permutation::linear_cycles ( ) const
inline

C++ version of gsl_permutation_linear_cycles().

Returns
The number of cycles (linear form)

Definition at line 297 of file permutation.hpp.

References get().

◆ linear_to_canonical()

int gsl::permutation::linear_to_canonical ( permutation const &  p)
inline

C++ version of gsl_permutation_linear_to_canonical().

Parameters
pA permutation
Returns
Error code on failure

Definition at line 279 of file permutation.hpp.

References get().

◆ memcpy()

int gsl::permutation::memcpy ( permutation const &  src)
inline

C++ version of gsl_permutation_memcpy().

Parameters
srcThe permutation to copy
Returns
Error code on failure

Definition at line 196 of file permutation.hpp.

References get().

◆ mul()

int gsl::permutation::mul ( permutation const &  pa,
permutation const &  pb 
)
inline

C++ version of gsl_permutation_mul().

Parameters
paThe first permutation
pbThe second permutation (applied after pb)
Returns
Error code on failure

Definition at line 271 of file permutation.hpp.

References get().

◆ next()

int gsl::permutation::next ( )
inline

C++ version of gsl_permutation_next().

Returns
Error code on failure

Definition at line 259 of file permutation.hpp.

References get().

◆ operator bool()

gsl::permutation::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_permutation

Definition at line 178 of file permutation.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

permutation & gsl::permutation::operator= ( permutation &&  v)
inline

Move operator.

Parameters
vThe permutation to move.
Returns
A reference to this.

Definition at line 132 of file permutation.hpp.

References ccgsl_pointer, and count.

◆ operator=() [2/2]

permutation & gsl::permutation::operator= ( permutation const &  v)
inline

The assignment operator.

This makes a shared copy.

Parameters
vThe permutation to copy

Definition at line 82 of file permutation.hpp.

References ccgsl_pointer, and count.

◆ operator[]()

size_t gsl::permutation::operator[] ( size_t const  i) const
inline

C++ version of gsl_permutation_get().

Parameters
iindex of element
Returns
Element at index i

Definition at line 314 of file permutation.hpp.

References get().

◆ prev()

int gsl::permutation::prev ( )
inline

C++ version of gsl_permutation_prev().

Returns
Error code on failure

Definition at line 264 of file permutation.hpp.

References get().

◆ reverse()

◆ size()

size_t gsl::permutation::size ( ) const
inline

C++ version of gsl_permutation_size().

Returns
The size

Definition at line 227 of file permutation.hpp.

References get().

Referenced by clone(), and end().

◆ swap()

int gsl::permutation::swap ( size_t const  i,
size_t const  j 
)
inline

C++ version of gsl_permutation_swap().

Parameters
iAn element
jAn element to swap with i
Returns
Error code on failure

Definition at line 239 of file permutation.hpp.

References get().

◆ unique()

bool gsl::permutation::unique ( ) const
inline

Find if this is the only object sharing the gsl_permutation.

Returns
true or falses according as this is the only permutation object sharing the gsl_permutation

Definition at line 164 of file permutation.hpp.

References count.

◆ use_count()

size_t gsl::permutation::use_count ( ) const
inline

Find how many permutation objects share this pointer.

Returns
the number of permutation objects that share this pointer

Definition at line 169 of file permutation.hpp.

References count.

◆ valid()

int gsl::permutation::valid ( ) const
inline

C++ version of gsl_permutation_valid().

Returns
Error code for valid

Definition at line 244 of file permutation.hpp.

References get().

Member Data Documentation

◆ ccgsl_pointer

gsl_permutation* gsl::permutation::ccgsl_pointer
private

◆ count

size_t* gsl::permutation::count
private

The shared reference count.

Definition at line 146 of file permutation.hpp.

Referenced by operator=(), permutation(), unique(), use_count(), and ~permutation().


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