30 #ifndef SHARK_UNSUPERVISED_RBM_STATESPACES_TWOSTATESPACE_H 31 #define SHARK_UNSUPERVISED_RBM_STATESPACES_TWOSTATESPACE_H 40 template<
int State1,
int State2>
52 long double result = std::pow( 2., static_cast< int >( numberOfNeurons ) );
53 SHARK_RUNTIME_CHECK(result < std::numeric_limits<std::size_t>::max(),
"number of neurons is too big for calculation");
54 return static_cast<std::size_t
>(result);
62 template<
class Vector>
63 static void state(Vector& vec,std::size_t stateNumber){
64 for (std::size_t i = 0; i != vec.size(); i++) {
65 bool secondState = stateNumber & (std::size_t(1)<<i);
66 vec(i) = secondState? State2 : State1;
73 template<
class Matrix>
74 static void state(blas::matrix_row<Matrix> vec,std::size_t stateNumber){
75 for (std::size_t i = 0; i != vec.size(); i++) {
76 bool secondState = stateNumber & (std::size_t(1)<<i);
77 vec(i) = secondState? State2 : State1;