CMR  1.3.0
Public Types | Public Member Functions | Static Protected Member Functions | List of all members
tu::binary_linear_space Class Reference

#include <binary_linear_space.hpp>

Public Types

typedef std::vector< bool > vector_type
 

Public Member Functions

 binary_linear_space (size_t length)
 
 binary_linear_space (const binary_linear_space &other)
 
const vector_typeoperator[] (size_t index) const
 
size_t length () const
 
size_t vectors () const
 
size_t dimension () const
 
bool insert_checked (const vector_type &vector)
 
void insert (const vector_type &vector)
 
int find (const vector_type &vector) const
 
bool is_spanned (const vector_type &vector) const
 

Static Protected Member Functions

static void vector_sum (const vector_type &first, const vector_type &second, vector_type &result)
 

Detailed Description

Models a binary linear vector space by storing all vectors contained in the vector space to quickly test for membership. Space consumption is O(length * 2 ^ dimension).

Member Typedef Documentation

◆ vector_type

typedef std::vector<bool> tu::binary_linear_space::vector_type

Constructor & Destructor Documentation

◆ binary_linear_space() [1/2]

tu::binary_linear_space::binary_linear_space ( size_t  length)
inlineexplicit

Contructs a binary linear vector space containing vectors of the given length.

Parameters
lengthLength of each vector in the space.

◆ binary_linear_space() [2/2]

tu::binary_linear_space::binary_linear_space ( const binary_linear_space other)
inline

Copy constructor which copies all vectors.

Parameters
otherInstance of another binary linear vector space.

Member Function Documentation

◆ dimension()

size_t tu::binary_linear_space::dimension ( ) const
inline
Returns
Dimension of this vector space

◆ find()

int tu::binary_linear_space::find ( const vector_type vector) const
inline

Searches a given vector in this vector space.

Parameters
vectorGiven vector of appropriate size
Returns
Index of the given vector or -1 if it is not spanned.

◆ insert()

void tu::binary_linear_space::insert ( const vector_type vector)
inline

Inserts a given vector into the vector space without checking whether it exists. Its size() must match the result of length().

Parameters
vectorA given vector of appropriate size

◆ insert_checked()

bool tu::binary_linear_space::insert_checked ( const vector_type vector)
inline

Inserts a given vector into the vector space if it is not contained already. Its size() must match the result of length().

Parameters
vectorA given vector of appropriate size
Returns
true if and only if the vector was inserted

◆ is_spanned()

bool tu::binary_linear_space::is_spanned ( const vector_type vector) const
inline

Tests whether a given vector is spanned by this vector space.

Parameters
vectorA given vector of appropriate size
Returns

◆ length()

size_t tu::binary_linear_space::length ( ) const
inline
Returns
Length of each of the vectors

◆ operator[]()

const vector_type& tu::binary_linear_space::operator[] ( size_t  index) const
inline

Read-only access to the vectors in this vector space.

Parameters
indexIndex in range [0, vectors() )

◆ vector_sum()

static void tu::binary_linear_space::vector_sum ( const vector_type first,
const vector_type second,
vector_type result 
)
inlinestaticprotected

Calculates the sum of two binary vectors and stores it in a third one. All must have the same size.

Parameters
firstFirst summand vector
secondSecond summand vector
resultVector containing the result

◆ vectors()

size_t tu::binary_linear_space::vectors ( ) const
inline
Returns
Number of vectors in this vector space

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