shark::TwoStateSpace< State1, State2 > Struct Template Reference

The TwoStateSpace is a discrete Space with only two values, for example {0,1} or {-1,1}. More...

#include <shark/Unsupervised/RBM/StateSpaces/TwoStateSpace.h>

Public Types

typedef tags::DiscreteSpace EnumerationTag
 Tag which tells an approximating function of the partition function, that this space can be enumerated. More...
 

Static Public Member Functions

static std::size_t numberOfStates (std::size_t numberOfNeurons)
 Returns the number of states a vector of n random variables (neurons) with values in this state space may have. More...
 
template<class Vector >
static void state (Vector &vec, std::size_t stateNumber)
 Returns the i-th state vector. More...
 
template<class Matrix >
static void state (blas::matrix_row< Matrix > vec, std::size_t stateNumber)
 Returns the i-th state vector for a matrix row. More...
 

Detailed Description

template<int State1, int State2>
struct shark::TwoStateSpace< State1, State2 >

The TwoStateSpace is a discrete Space with only two values, for example {0,1} or {-1,1}.

Definition at line 41 of file TwoStateSpace.h.

Member Typedef Documentation

◆ EnumerationTag

template<int State1, int State2>
typedef tags::DiscreteSpace shark::TwoStateSpace< State1, State2 >::EnumerationTag

Tag which tells an approximating function of the partition function, that this space can be enumerated.

Definition at line 44 of file TwoStateSpace.h.

Member Function Documentation

◆ numberOfStates()

template<int State1, int State2>
static std::size_t shark::TwoStateSpace< State1, State2 >::numberOfStates ( std::size_t  numberOfNeurons)
inlinestatic

Returns the number of states a vector of n random variables (neurons) with values in this state space may have.

For example if {a,b} is the state space it returns the cardinality of the set \( {a,b}^n = 2^n \)

Parameters
numberOfNeuronsthe size of the vector
Returns
the number of States.

Definition at line 51 of file TwoStateSpace.h.

References SHARK_RUNTIME_CHECK.

◆ state() [1/2]

template<int State1, int State2>
template<class Vector >
static void shark::TwoStateSpace< State1, State2 >::state ( Vector &  vec,
std::size_t  stateNumber 
)
inlinestatic

Returns the i-th state vector.

Parameters
vecthe vector the i-th state vector is stored in
stateNumberthe number of the state

Definition at line 63 of file TwoStateSpace.h.

◆ state() [2/2]

template<int State1, int State2>
template<class Matrix >
static void shark::TwoStateSpace< State1, State2 >::state ( blas::matrix_row< Matrix >  vec,
std::size_t  stateNumber 
)
inlinestatic

Returns the i-th state vector for a matrix row.

Parameters
vecthe vector the i-th state vector is stored in
stateNumberthe number of the state

Definition at line 74 of file TwoStateSpace.h.


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