linbox
Butterfly< _Field, Switch > Class Template Reference

Switching Network based BlackBox Matrix. More...

#include <butterfly.h>

+ Inheritance diagram for Butterfly< _Field, Switch >:

Data Structures

struct  rebind
 

Public Types

typedef _Field Field
 
typedef Butterfly< _Field, Switch > Self_t
 
typedef Field::Element Element
 

Public Member Functions

 Butterfly (const Field &F, size_t n)
 No-Op Constructor.
 
 Butterfly (const Field &F, size_t n, typename Switch::Factory &factory)
 Constructor from an integer and a switch object.
 
 ~Butterfly ()
 
template<class OutVector, class InVector>
OutVector & apply (OutVector &y, const InVector &x) const
 Application of BlackBox matrix.
 
template<class OutVector, class InVector>
OutVector & applyTranspose (OutVector &y, const InVector &x) const
 Application of BlackBox matrix transpose.
 
template<typename _Tp1, typename _Sw1>
 Butterfly (const Butterfly< _Tp1, _Sw1 > &B, const Field &F)
 
size_t rowdim () const
 
size_t coldim () const
 
const Fieldfield () const
 
std::vector< size_t > n_vec () const
 
std::vector< size_t > l_vec () const
 
std::vector< std::pair< size_t, size_t > > indices () const
 
std::vector< size_t > & n_vec ()
 
std::vector< size_t > & l_vec ()
 
std::vector< std::pair< size_t, size_t > > & indices ()
 
std::vector< Switch >::const_iterator switchesBegin () const
 
std::vector< Switch >::const_iterator switchesEnd () const
 
std::vector< Switch > & switches ()
 

Detailed Description

template<class _Field, class Switch = CekstvSwitch<_Field>>
class LinBox::Butterfly< _Field, Switch >

Switching Network based BlackBox Matrix.

A good preconditioner.

Implements butterfly switching network on a LinBox vector as a black box matrix through the use of a switch object.

This is a blackbox matrix object, and it implements all purely virtual methods of the abstract base class. See BlackboxArchetype for the specification of these methods.

This matrix requires a dense vector to be used. Sparse vectors must somehow be converted to dense vectors before this matrix may be applied to them.

Parameters
VectorLinBox dense vector type
Switchswitch object type

Member Typedef Documentation

◆ Field

template<class _Field, class Switch = CekstvSwitch<_Field>>
typedef _Field Field

◆ Self_t

template<class _Field, class Switch = CekstvSwitch<_Field>>
typedef Butterfly<_Field, Switch> Self_t

◆ Element

template<class _Field, class Switch = CekstvSwitch<_Field>>
typedef Field::Element Element

Constructor & Destructor Documentation

◆ Butterfly() [1/3]

template<class _Field, class Switch = CekstvSwitch<_Field>>
Butterfly ( const Field & F,
size_t n )
inline

No-Op Constructor.

◆ Butterfly() [2/3]

template<class Field, class Switch>
Butterfly ( const Field & F,
size_t n,
typename Switch::Factory & factory )
inline

Constructor from an integer and a switch object.

The switch object is an object that is applied to two references to elements to switch them. It must have both an apply and an applyTranspose method. It must contain all information needed by the switch other than the elements themselves. This includes any random numbers or sequences of values. It must also be able to be applied as many times as needed. In particular, it must be able to create new random elements or repeat a stored sequence of values. This is not required by the abstract base class.

Parameters
ninteger size of vectors to be applied to
F
factoryswitch predicate object object

◆ ~Butterfly()

template<class _Field, class Switch = CekstvSwitch<_Field>>
~Butterfly ( )
inline

◆ Butterfly() [3/3]

template<class _Field, class Switch = CekstvSwitch<_Field>>
template<typename _Tp1, typename _Sw1>
Butterfly ( const Butterfly< _Tp1, _Sw1 > & B,
const Field & F )
inline

Member Function Documentation

◆ apply()

template<class Field, class Switch>
template<class OutVector, class InVector>
OutVector & apply ( OutVector & y,
const InVector & x ) const
inline

Application of BlackBox matrix.

y = A*x. Requires one vector conforming to the LinBox vector archetype. Required by abstract base class. For this matrix, this involves applying each switch in order to the input vector.

Returns
reference to vector y containing output (after switching).
Parameters
xconstant reference to vector to contain input (before switching)
y

◆ applyTranspose()

template<class Field, class Switch>
template<class OutVector, class InVector>
OutVector & applyTranspose ( OutVector & y,
const InVector & x ) const
inline

Application of BlackBox matrix transpose.

y = transpose (A)*x. Requires one vector conforming to the LinBox vector archetype. Required by abstract base class. For this matrix, this involves applying the transpose of each switch to the input vector in the reverse order of the apply function.

Returns
reference to vector y containing output (after switching).
Parameters
xconstant reference to vector to contain input (before switching)
y

◆ rowdim()

template<class _Field, class Switch = CekstvSwitch<_Field>>
size_t rowdim ( ) const
inline

◆ coldim()

template<class _Field, class Switch = CekstvSwitch<_Field>>
size_t coldim ( ) const
inline

◆ field()

template<class _Field, class Switch = CekstvSwitch<_Field>>
const Field & field ( ) const
inline

◆ n_vec() [1/2]

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< size_t > n_vec ( ) const
inline

◆ l_vec() [1/2]

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< size_t > l_vec ( ) const
inline

◆ indices() [1/2]

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< std::pair< size_t, size_t > > indices ( ) const
inline

◆ n_vec() [2/2]

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< size_t > & n_vec ( )
inline

◆ l_vec() [2/2]

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< size_t > & l_vec ( )
inline

◆ indices() [2/2]

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< std::pair< size_t, size_t > > & indices ( )
inline

◆ switchesBegin()

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< Switch >::const_iterator switchesBegin ( ) const
inline

◆ switchesEnd()

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< Switch >::const_iterator switchesEnd ( ) const
inline

◆ switches()

template<class _Field, class Switch = CekstvSwitch<_Field>>
std::vector< Switch > & switches ( )
inline

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