linbox
Permutation< _Field, _Matrix > Class Template Referenceabstract

#include <permutation.h>

+ Inheritance diagram for Permutation< _Field, _Matrix >:

Data Structures

struct  rebind
 

Public Types

typedef _Field Field
 
typedef Field::Element Element
 
typedef Permutation< FieldSelf_t
 
typedef LightContainer< long > Storage
 
typedef _Matrix Matrix
 
using ResizableMatrix
 
using ResizableMatrix
 

Public Member Functions

 Permutation (Storage &indices, const Field &F)
 Constructor from a vector of indices.
 
Self_tinit (size_t *P, size_t n)
 
 Permutation (size_t *P, size_t n, const Field &F)
 
 Permutation (int n, const Field &F)
 n x n permutation matrix, initially the identity.
 
 Permutation (const Field &F, size_t n=0, size_t m=0)
 
void identity (int n)
 
void cyclicShift (size_t n)
 
void random (unsigned int seed=static_cast< unsigned int >(std::time(nullptr)))
 
 Permutation (const Permutation &Mat)
 
 ~Permutation (void)
 
template<class OutVector, class InVector>
OutVector & apply (OutVector &y, const InVector &x) const
 Application of BlackBox permutation matrix.
 
template<class OutVector, class InVector>
OutVector & applyTranspose (OutVector &y, const InVector &x) const
 Application of BlackBox permutation matrix transpose.
 
MatrixapplyRight (Matrix &Y, const Matrix &X) const
 
MatrixapplyLeft (Matrix &Y, const Matrix &X) const
 
BBType bbTag () const
 
size_t & rank (size_t &r) const
 
Elementdet (Element &d) const
 
MatrixsolveRight (Matrix &Y, const Matrix &X) const
 
MatrixsolveLeft (Matrix &Y, const Matrix &X) const
 
MatrixnullspaceRandomRight (Matrix &N) const
 
MatrixnullspaceRandomLeft (Matrix &N) const
 
MatrixnullspaceBasisRight (Matrix &N) const
 
MatrixnullspaceBasisLeft (Matrix &N) const
 
size_t rowdim (void) const
 rowdim
 
size_t coldim (void) const
 coldim
 
void permute (size_t i, size_t j)
 this <– transposition(i,j)*this indices (i = 0, j = 1): 0 2 1 * 1 0 2 = 1 2 0 matrices (corresponding): 1 0 0 0 1 0 0 1 0 0 0 1 * 1 0 0 = 0 0 1 0 1 0 0 0 1 1 0 0
 
size_t operator[] (size_t i) const
 
const Fieldfield () const
 
std::istream & read (std::istream &os)
 
std::ostream & write (std::ostream &os) const
 
std::ostream & write (std::ostream &os, Tag::FileFormat format) const
 
std::istream & read (std::istream &is, Tag::FileFormat format)
 
StoragesetStorage (const Storage &s)
 
const StoragegetStorage () const
 
StoragegetStorage ()
 
void next ()
 Generate next permutation in lex order.
 
virtual Elementdet (Element &d) const=0
 
virtual MatrixsolveRight (Matrix &Y, const Matrix &X) const=0
 Y: AY = X, for this A.
 
virtual MatrixsolveLeft (Matrix &Y, const Matrix &X) const=0
 Y: YA = X, for this A.
 
virtual MatrixnullspaceRandomRight (Matrix &N) const=0
 N: AN = 0, each col random.
 
virtual MatrixnullspaceRandomLeft (Matrix &N) const=0
 N: NA = 0, each row random.
 
virtual ResizableMatrixnullspaceBasisRight (ResizableMatrix &B) const=0
 B: columns are a right nullspace basis for this A.
 
virtual ResizableMatrixnullspaceBasisLeft (ResizableMatrix &B) const=0
 BA= 0 and xA = 0 => exists y: x = yB and B full rank.
 
virtual MatrixapplyLeft (Matrix &Y, const Matrix &X) const =0
 
virtual MatrixapplyRight (Matrix &Y, const Matrix &X) const =0
 
template<typename BB2>
void map (BB2 &A)
 

Protected Attributes

Storage _indices
 
const Field_field
 

Detailed Description

template<class _Field, class _Matrix = DenseMatrix<_Field>>
class LinBox::Permutation< _Field, _Matrix >
Examples
examples/power_rank.C, examples/poweroftwo_ranks.C, and examples/smithsparse.C.

Member Typedef Documentation

◆ Field

template<class _Field, class _Matrix = DenseMatrix<_Field>>
typedef _Field Field

◆ Element

template<class _Field, class _Matrix = DenseMatrix<_Field>>
typedef Field::Element Element

◆ Self_t

template<class _Field, class _Matrix = DenseMatrix<_Field>>
typedef Permutation<Field> Self_t

◆ Storage

template<class _Field, class _Matrix = DenseMatrix<_Field>>
typedef LightContainer<long> Storage

◆ Matrix

template<class _Field, class _Matrix = DenseMatrix<_Field>>
typedef _Matrix Matrix

◆ ResizableMatrix [1/2]

using ResizableMatrix
inherited

◆ ResizableMatrix [2/2]

using ResizableMatrix
inherited

Constructor & Destructor Documentation

◆ Permutation() [1/5]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Permutation ( Storage & indices,
const Field & F )
inline

Constructor from a vector of indices.

This constructor creates a permutation matrix based on a vector of indices

Parameters
F
indicesVector of indices representing the permutation Permutation P has 1 in the P_{i, _indices[i]} positions.

◆ Permutation() [2/5]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Permutation ( size_t * P,
size_t n,
const Field & F )
inline

◆ Permutation() [3/5]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Permutation ( int n,
const Field & F )
inline

n x n permutation matrix, initially the identity.

Parameters
nThe dimension of the matrix
Ffield or ring

◆ Permutation() [4/5]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Permutation ( const Field & F,
size_t n = 0,
size_t m = 0 )
inline

◆ Permutation() [5/5]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Permutation ( const Permutation< _Field, _Matrix > & Mat)
inline

◆ ~Permutation()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
~Permutation ( void )
inline

Member Function Documentation

◆ init()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Self_t & init ( size_t * P,
size_t n )
inline

◆ identity()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
void identity ( int n)
inline
Bug
should be size_t

◆ cyclicShift()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
void cyclicShift ( size_t n)
inline

◆ random()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
void random ( unsigned int seed = static_cast<unsigned int>(std::time(nullptr)))
inline

◆ apply()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
template<class OutVector, class InVector>
OutVector & apply ( OutVector & y,
const InVector & x ) const
inline

Application of BlackBox permutation matrix.

\(y \leftarrow Px\). Requires one vector conforming to the LinBox vector archetype. Required by abstract base class.

Returns
reference to vector y containing output.
Parameters
xconstant reference to vector to contain input
y

◆ applyTranspose()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
template<class OutVector, class InVector>
OutVector & applyTranspose ( OutVector & y,
const InVector & x ) const
inline

Application of BlackBox permutation matrix transpose.

y= transpose(P)*x, equivalently y= P^-1*x Requires one vector conforming to the LinBox vector archetype. Required by abstract base class.

Returns
reference to vector y containing output.
Parameters
xconstant reference to vector to contain input
y\(y^T \leftarrow x^T P\).

◆ applyRight() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & applyRight ( Matrix & Y,
const Matrix & X ) const
inline

◆ applyLeft() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & applyLeft ( Matrix & Y,
const Matrix & X ) const
inline

◆ bbTag()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
BBType bbTag ( ) const
inlinevirtual

Implements BB< Ring >.

◆ rank()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
size_t & rank ( size_t & r) const
inlinevirtual

Implements FIBB< _Field >.

◆ det() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Element & det ( Element & d) const
inline

◆ solveRight() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & solveRight ( Matrix & Y,
const Matrix & X ) const
inline

◆ solveLeft() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & solveLeft ( Matrix & Y,
const Matrix & X ) const
inline

◆ nullspaceRandomRight() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & nullspaceRandomRight ( Matrix & N) const
inline

◆ nullspaceRandomLeft() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & nullspaceRandomLeft ( Matrix & N) const
inline

◆ nullspaceBasisRight() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & nullspaceBasisRight ( Matrix & N) const
inline

◆ nullspaceBasisLeft() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Matrix & nullspaceBasisLeft ( Matrix & N) const
inline

◆ rowdim()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
size_t rowdim ( void ) const
inlinevirtual

rowdim

Implements BB< Ring >.

◆ coldim()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
size_t coldim ( void ) const
inlinevirtual

coldim

Implements BB< Ring >.

◆ permute()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
void permute ( size_t i,
size_t j )
inline

this <– transposition(i,j)*this indices (i = 0, j = 1): 0 2 1 * 1 0 2 = 1 2 0 matrices (corresponding): 1 0 0 0 1 0 0 1 0 0 0 1 * 1 0 0 = 0 0 1 0 1 0 0 0 1 1 0 0

◆ operator[]()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
size_t operator[] ( size_t i) const
inline

◆ field()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
const Field & field ( ) const
inlinevirtual

Implements BB< Ring >.

◆ read() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
std::istream & read ( std::istream & os)
inlinevirtual
Bug
needs a read. (needed by test-blackbox.h)

Implements BB< Ring >.

◆ write() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
std::ostream & write ( std::ostream & os) const
inlinevirtual
Bug
needs a MM version

Implements BB< Ring >.

Examples
examples/power_rank.C, and examples/poweroftwo_ranks.C.

◆ write() [2/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
std::ostream & write ( std::ostream & os,
Tag::FileFormat format ) const
inline

◆ read() [2/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
std::istream & read ( std::istream & is,
Tag::FileFormat format )
inline
Bug
there is no read here. (needed by test-blackbox.h)

◆ setStorage()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Storage & setStorage ( const Storage & s)
inline

◆ getStorage() [1/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
const Storage & getStorage ( ) const
inline

◆ getStorage() [2/2]

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Storage & getStorage ( )
inline

◆ next()

template<class _Field, class _Matrix = DenseMatrix<_Field>>
void next ( )
inline

Generate next permutation in lex order.

◆ det() [2/2]

virtual Element & det ( Element & d) const
pure virtualinherited

◆ solveRight() [2/2]

virtual Matrix & solveRight ( Matrix & Y,
const Matrix & X ) const
pure virtualinherited

Y: AY = X, for this A.

Solve nonsingular or consistent singular system. If it is consistent singular, an arbitrary solution is provided. X and Y must have identical shape.

Note that Y+Z is a random sample of the solution space after {solveRight(Y, X); nullspaceRandomRight(Z);}.

Behaviour is unspecified for inconsistent systems (see solveMP).

◆ solveLeft() [2/2]

virtual Matrix & solveLeft ( Matrix & Y,
const Matrix & X ) const
pure virtualinherited

Y: YA = X, for this A.

◆ nullspaceRandomRight() [2/2]

virtual Matrix & nullspaceRandomRight ( Matrix & N) const
pure virtualinherited

N: AN = 0, each col random.

◆ nullspaceRandomLeft() [2/2]

virtual Matrix & nullspaceRandomLeft ( Matrix & N) const
pure virtualinherited

N: NA = 0, each row random.

◆ nullspaceBasisRight() [2/2]

virtual ResizableMatrix & nullspaceBasisRight ( ResizableMatrix & B) const
pure virtualinherited

B: columns are a right nullspace basis for this A.

B is resized and filled so that: (1) AB = 0, (2) Ax = 0 => exists y: x = By, and (3) B has full rank.

◆ nullspaceBasisLeft() [2/2]

virtual ResizableMatrix & nullspaceBasisLeft ( ResizableMatrix & B) const
pure virtualinherited

BA= 0 and xA = 0 => exists y: x = yB and B full rank.

◆ applyLeft() [2/2]

◆ applyRight() [2/2]

◆ map()

template<class Ring>
template<typename BB2>
void map ( BB2 & A)
inlineinherited

Field Documentation

◆ _indices

template<class _Field, class _Matrix = DenseMatrix<_Field>>
Storage _indices
protected

◆ _field

template<class _Field, class _Matrix = DenseMatrix<_Field>>
const Field& _field
protected

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