CMR  1.3.0
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

 typedef std::vector tu::binary_linear_space::vector_type

## Constructor & Destructor Documentation

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

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

Parameters
 length Length of each vector in the space.
 tu::binary_linear_space::binary_linear_space ( const binary_linear_space & other )
inline

Copy constructor which copies all vectors.

Parameters
 other Instance of another binary linear vector space.

## Member Function Documentation

 size_t tu::binary_linear_space::dimension ( ) const
inline
Returns
Dimension of this vector space
 int tu::binary_linear_space::find ( const vector_type & vector ) const
inline

Searches a given vector in this vector space.

Parameters
 vector Given vector of appropriate size
Returns
Index of the given vector or -1 if it is not spanned.
 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
 vector A given vector of appropriate size
 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
 vector A given vector of appropriate size
Returns
true if and only if the vector was inserted
 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
 vector A given vector of appropriate size
Returns
 size_t tu::binary_linear_space::length ( ) const
inline
Returns
Length of each of the vectors
 const vector_type& tu::binary_linear_space::operator[] ( size_t index ) const
inline

Parameters
 index Index in range [0, vectors() )
 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
 first First summand vector second Second summand vector result Vector containing the result
 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: