linbox
BlasPermutation< _UnsignedInt > Class Template Reference

Lapack-style permutation. More...

#include <permutation-matrix.h>

Public Member Functions

 BlasPermutation ()
 
 ~BlasPermutation ()
 
 BlasPermutation (size_t n)
 
 BlasPermutation (const _UnsignedInt *V, const _UnsignedInt &n)
 
 BlasPermutation (const std::vector< _UnsignedInt > &V)
 
 BlasPermutation (const MatrixPermutation< _UnsignedInt > &M)
 
const Givaro::ZRing< _UnsignedInt > & field () const
 
BlasPermutation< _UnsignedInt > & operator= (const BlasPermutation< _UnsignedInt > &P)
 copy operator (with copy)
 
_UnsignedInt getSize () const
 Returns the size of the permuation.
 
_UnsignedInt getOrder () const
 Returns the order of the permuation.
 
void setOrder (size_t r)
 
std::vector< _UnsignedInt > getStorage () const
 returns a copy of the raw storage.
 
void resize (_UnsignedInt s, bool with_zeros=true)
 
bool isIdentity () const
 
MatrixPermutation< _UnsignedInt > & Convert (MatrixPermutation< _UnsignedInt > &P)
 Converts a BlasPermutation to a MatrixPermutation.
 
_UnsignedInt operator[] (const _UnsignedInt i) const
 \( M \gets P M\)
 
const _UnsignedInt * getPointer () const
 col i and col j are swapped
 
_UnsignedInt * getPointer ()
 
void Transpose ()
 
void Invert ()
 
BlasPermTranspose (BlasPerm &Mt)
 
BlasPermInvert (BlasPerm &Mt)
 
void Compress ()
 compresses BlasPermutation to a smaller r_.
 
std::ostream & write (std::ostream &o, bool Lapack=true) const
 writes on output stream o
 

Protected Member Functions

void BuildQ_ () const
 
void InvertQ_ ()
 
std::vector< _UnsignedInt > & InvertQ_ (std::vector< _UnsignedInt > &Qinv)
 
void BuildP_ (std::vector< _UnsignedInt > &Q, std::vector< _UnsignedInt > &Qinv)
 
bool CheckP_ ()
 
void InitQ_ () const
 

Protected Attributes

_UnsignedInt r_
 
_UnsignedInt n_
 
std::vector< _UnsignedInt > P_
 
std::vector< _UnsignedInt > Q_
 
bool inv_
 

Friends

template<class _Uint>
std::ostream & operator<< (std::ostream &o, BlasPerm &P)
 writes P on output stream o
 

Detailed Description

template<class _UnsignedInt>
class LinBox::BlasPermutation< _UnsignedInt >

Lapack-style permutation.

A Lapack permutation is represented with a vector \([p_1,p_2,\cdots, p_r]\) such that \(p_i > i\). Converting it to a classic representation of a permutation corresponds to taking an identity permutation and then successively permuting \((i,p_i)\). Example : if P=[1,4,4] and V=[1,2,3,4,5], then P.V=[1,4,2,3,5].

Precondition
if Q_ is built, then P_=Q_

Constructor & Destructor Documentation

◆ BlasPermutation() [1/5]

template<class _Uint>
BlasPermutation ( )

◆ ~BlasPermutation()

template<class _Uint>
~BlasPermutation ( )

◆ BlasPermutation() [2/5]

template<class _Uint>
BlasPermutation ( size_t n)

◆ BlasPermutation() [3/5]

template<class _UnsignedInt>
BlasPermutation ( const _UnsignedInt * V,
const _UnsignedInt & n )

◆ BlasPermutation() [4/5]

template<class _UnsignedInt>
BlasPermutation ( const std::vector< _UnsignedInt > & V)

◆ BlasPermutation() [5/5]

template<class _UnsignedInt>
BlasPermutation ( const MatrixPermutation< _UnsignedInt > & M)

Member Function Documentation

◆ field()

template<class _UnsignedInt>
const Givaro::ZRing< _UnsignedInt > & field ( ) const
inline

◆ operator=()

template<class _UnsignedInt>
BlasPermutation< _UnsignedInt > & operator= ( const BlasPermutation< _UnsignedInt > & P)
inline

copy operator (with copy)

◆ getSize()

template<class _Uint>
_Uint getSize ( ) const

Returns the size of the permuation.

If given, we return n as we see P in \(S_n\). We default to the order of the permutation (minimal such n)

Warning
potentially catastrophic

◆ getOrder()

template<class _Uint>
_Uint getOrder ( ) const

Returns the order of the permuation.

◆ setOrder()

template<class _Uint>
void setOrder ( size_t r)

◆ getStorage()

template<class _UnsignedInt>
std::vector< _UnsignedInt > getStorage ( ) const
inline

returns a copy of the raw storage.

◆ resize()

template<class _UnsignedInt>
void resize ( _UnsignedInt s,
bool with_zeros = true )
inline

◆ isIdentity()

template<class _UnsignedInt>
bool isIdentity ( ) const
inline

◆ Convert()

template<class _UnsignedInt>
MatrixPermutation< _Uint > & Convert ( MatrixPermutation< _UnsignedInt > & P)

Converts a BlasPermutation to a MatrixPermutation.

Parameters
[out]PMatrixPermutation to be created. Need not be initialized.

◆ operator[]()

template<class _UnsignedInt>
_Uint operator[] ( const _UnsignedInt i) const
inline

\( M \gets P M\)

\( M \gets M P\)

\( M \gets M P^t\)

\( M \gets P^t M\)

◆ getPointer() [1/2]

template<class _UnsignedInt>
const _UnsignedInt * getPointer ( ) const
inline

col i and col j are swapped

row i and row j are swapped

◆ getPointer() [2/2]

template<class _UnsignedInt>
_UnsignedInt * getPointer ( )
inline

◆ Transpose() [1/2]

template<class _Uint>
void Transpose ( )

◆ Invert() [1/2]

template<class _Uint>
void Invert ( )

◆ Transpose() [2/2]

template<class _UnsignedInt>
BlasPerm & Transpose ( BlasPerm & Mt)

◆ Invert() [2/2]

template<class _UnsignedInt>
BlasPerm & Invert ( BlasPerm & Mt)

◆ Compress()

template<class _Uint>
void Compress ( )

compresses BlasPermutation to a smaller r_.

◆ write()

template<class _Uint>
std::ostream & write ( std::ostream & o,
bool Lapack = true ) const

writes on output stream o

◆ BuildQ_()

template<class _Uint>
void BuildQ_ ( ) const
protected

◆ InvertQ_() [1/2]

template<class _UnsignedInt>
void InvertQ_ ( )
protected

◆ InvertQ_() [2/2]

template<class _UnsignedInt>
std::vector< _UnsignedInt > & InvertQ_ ( std::vector< _UnsignedInt > & Qinv)
protected

◆ BuildP_()

template<class _UnsignedInt>
void BuildP_ ( std::vector< _UnsignedInt > & Q,
std::vector< _UnsignedInt > & Qinv )
protected

◆ CheckP_()

template<class _Uint>
bool CheckP_ ( )
protected

◆ InitQ_()

template<class _Uint>
void InitQ_ ( ) const
protected

Friends And Related Symbol Documentation

◆ operator<<

template<class _UnsignedInt>
template<class _Uint>
std::ostream & operator<< ( std::ostream & o,
BlasPerm & P )
friend

writes P on output stream o

Field Documentation

◆ r_

template<class _UnsignedInt>
_UnsignedInt r_
protected

◆ n_

template<class _UnsignedInt>
_UnsignedInt n_
mutableprotected

◆ P_

template<class _UnsignedInt>
std::vector<_UnsignedInt> P_
protected

◆ Q_

template<class _UnsignedInt>
std::vector<_UnsignedInt> Q_
mutableprotected

◆ inv_

template<class _UnsignedInt>
bool inv_
protected

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