linbox
BooleanSwitch Class Reference

Boolean switch object. More...

Data Structures

struct  rebind
 

Public Types

typedef BooleanSwitch Self_t
 
typedef BooleanSwitchFactory Factory
 

Public Member Functions

 BooleanSwitch (const bool s)
 Constructor from an STL vector of booleans.
 
 ~BooleanSwitch ()
 Destructor.
 
template<class Field>
bool apply (const Field &F, typename Field::Element &x, typename Field::Element &y) const
 Apply switch function.
 
template<class Field>
bool applyTranspose (const Field &F, typename Field::Element &x, typename Field::Element &y) const
 Apply switch transpose function.
 

Protected Attributes

bool _s
 

Detailed Description

Boolean switch object.

This is a switch predicate object that is applied to two references to elements to switch them as needed by the Butterfly\ Switching\ Network\ BlackBox\ Matrix\ Object.

Member Typedef Documentation

◆ Self_t

◆ Factory

Constructor & Destructor Documentation

◆ BooleanSwitch()

BooleanSwitch ( const bool s)
inline

Constructor from an STL vector of booleans.

The switch is applied using the vector of booleans. A true value means to swap the two elements, and a false value means not to. The apply function starts at the beginning of the vector moving forward through it, and applyTranspose function starts at the end moving backwards. Both repeat the vector after they pass through it.

Parameters
svector of switches

◆ ~BooleanSwitch()

~BooleanSwitch ( )
inline

Destructor.

Member Function Documentation

◆ apply()

template<class Field>
bool apply ( const Field & F,
typename Field::Element & x,
typename Field::Element & y ) const
inline

Apply switch function.

Switches the elements in references according to current boolean value. Swaps the elements if boolean is true, otherwise does nothing. It is templatized by the element type to be swapped.

Returns
bool true if swapped, false otherwise
Parameters
F
xreference to first element to be switched
yreference to second element to be switched

◆ applyTranspose()

template<class Field>
bool applyTranspose ( const Field & F,
typename Field::Element & x,
typename Field::Element & y ) const
inline

Apply switch transpose function.

Switches the elements in references according to current boolean value. Swaps the elements if boolean is true, otherwise does nothing. It is templatized by the element type to be swapped.

Returns
bool true if swapped, false otherwise
Parameters
F
xreference to first element to be switched
yreference to second element to be switched

Field Documentation

◆ _s

bool _s
protected

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