Commit f3d8169e authored by Damien Leroux's avatar Damien Leroux
Browse files

Implemented geno_matrix computation with reentrants and LC.

parent aa3dd51d
......@@ -4,7 +4,7 @@
#include <list>
#include "eigen.h"
template <typename PARENT_TYPE>
template <typename PARENT_TYPE, typename STATE_TYPE=size_t>
struct combination_type {
static const size_t nopar = (size_t) -1;
......@@ -17,15 +17,15 @@ struct combination_type {
struct key_type {
/* TODO: parent MUST be const generation_rs* */
PARENT_TYPE parent;
size_t state;
STATE_TYPE state;
key_type(PARENT_TYPE p, size_t s) : parent(p), state(s) {}
key_type(PARENT_TYPE p, STATE_TYPE s) : parent(p), state(s) {}
key_type() : parent(0), state(0) {}
key_type& operator = (const key_type& k) { parent = k.parent; state = k.state; return *this; }
bool operator == (const key_type& other) const { return parent == other.parent && state == other.state; }
bool operator == (size_t x) const { return parent == x; }
bool operator == (PARENT_TYPE x) const { return parent == x; }
bool operator != (const key_type& other) const { return parent != other.parent || state != other.state; }
bool operator != (size_t x) const { return parent != x; }
bool operator != (PARENT_TYPE x) const { return parent != x; }
bool operator < (const key_type& other) const { return parent < other.parent || (parent == other.parent && state < other.state); }
friend std::ostream& operator << (std::ostream& os, const key_type& k)
......@@ -177,7 +177,7 @@ struct combination_type {
return keys.is_consistent();
}
this_type operator | (const expansion_map_type& expansions) const
this_type operator | (const std::map<PARENT_TYPE, Vector>& expansions) const
{
MSG_DEBUG("================================================");
MSG_DEBUG("expanding " << (*this));
......@@ -223,7 +223,7 @@ struct combination_type {
sum_type m_combination;
friend std::ostream& operator << (std::ostream& os, const this_type& c)
friend std::ostream& operator << (std::ostream& os, const combination_type<PARENT_TYPE, STATE_TYPE>& c)
{
auto i = c.begin();
auto j = c.end();
......@@ -240,7 +240,7 @@ struct combination_type {
: m_combination()
{}
combination_type(size_t par, size_t n_states)
combination_type(PARENT_TYPE par, size_t n_states)
: m_combination()
{
for (size_t i = 0; i < n_states; ++i) {
......@@ -348,16 +348,6 @@ struct combination_type {
return ret;
}
friend
Vector operator | (const Vector& V, const expansion_map_type& expansions)
{
Vector ret(V.size());
for (int i = 0; i < V.size(); ++i) {
ret(i) = V(i) | expansions;
}
return ret;
}
friend
this_type operator * (const element_type& e, const this_type& lc)
{
......@@ -385,6 +375,18 @@ struct combination_type {
}
};
template <typename PARENT_TYPE, typename STATE_TYPE>
typename combination_type<PARENT_TYPE, STATE_TYPE>::Vector
operator | (const typename combination_type<PARENT_TYPE, STATE_TYPE>::Vector& V,
const std::map<PARENT_TYPE, typename combination_type<PARENT_TYPE, STATE_TYPE>::Vector>& expansions)
{
typename combination_type<PARENT_TYPE, STATE_TYPE>::Vector ret(V.size());
for (int i = 0; i < V.size(); ++i) {
ret(i) = V(i) | expansions;
}
return ret;
}
namespace Eigen {
template<typename PARENT_TYPE>
......@@ -410,7 +412,7 @@ namespace Eigen {
}
namespace impl { struct generation_rs; }
/*namespace impl { struct generation_rs; }*/
typedef combination_type<size_t> gencomb_type;
......
This diff is collapsed.
......@@ -30,10 +30,10 @@ COV_OBJ=$(subst .cc,.cov.o,$(SRC))
ALL_BUT_MAIN_OBJ=$(subst main.o ,,$(OBJ))
#DEBUG_OPTS=-ggdb
DEBUG_OPTS=-ggdb
#DEBUG_OPTS=-ggdb -DNDEBUG
#OPT_OPTS=-O3 -DEIGEN_NO_DEBUG -DNDEBUG
OPT_OPTS=-O3 -DNDEBUG
#OPT_OPTS=-O3 -DNDEBUG
#PROF_OPTS=-O2 -DEIGEN_NO_DEBUG -DNDEBUG -g -pg
#DEBUG_OPTS=-ggdb
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment