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

segfault in test case 4.

parent 0169870d
This diff is collapsed.
This diff is collapsed.
......@@ -114,7 +114,8 @@ struct pedigree_tree_type {
node_type& operator = (const node_type& other) { p1 = other.p1; p2 = other.p2; return *this; }
bool is_ancestor() const { return p1 == NONE && p2 == NONE; }
bool is_gamete() const { return p1 != NONE && p2 == NONE; }
bool is_genotype() const { return p1 != NONE && p2 != NONE; }
bool is_crossing() const { return p1 != NONE && p2 != NONE; }
bool is_genotype() const { return p2 != NONE || p1 == NONE; }
bool has_p1() const { return p1 != NONE; }
bool has_p2() const { return p2 != NONE; }
};
......@@ -130,9 +131,18 @@ struct pedigree_tree_type {
std::vector<int> m_original_ordering;
pedigree_tree_type()
: m_leaves(), m_roots(), m_nodes(), m_must_recompute(), m_node_number_to_ind_number(), m_ind_number_to_node_number()
: m_leaves(), m_roots(), m_nodes(), m_must_recompute(), m_node_number_to_ind_number(), m_ind_number_to_node_number(1, NONE)
{}
int get_p1(int n) const { return m_nodes[n].p1; }
int get_p2(int n) const { return m_nodes[n].p2; }
const node_type& operator [] (int n) const { return m_nodes[n]; }
size_t size() const { return m_nodes.size(); }
const std::vector<bool>& get_recompute_vec(int n) const { return m_must_recompute[n]; }
/* building helpers */
int ancestor() { return add_node(); }
......@@ -297,7 +307,7 @@ struct pedigree_tree_type {
ret = ret - sub_re;
/*MSG_DEBUG(" current list = " << ret);*/
}
MSG_DEBUG_DEDENT;
/*MSG_DEBUG_DEDENT;*/
return ret;
}
......@@ -363,6 +373,8 @@ struct pedigree_tree_type {
return m_ind_number_to_node_number[ind];
}
int next_ind_idx() const { return m_ind_number_to_node_number.size(); }
std::string
render_tree() const
{
......@@ -1409,7 +1421,12 @@ struct symmetry_propagator {
bool latent;
group_iterator(const symmetry_group_type& g, const symmetry_group_type& lg)
: b(g.begin()), i(g.begin()), e(g.end()), lb(lg.begin()), le(lg.end()), latent(false)
{}
{
MSG_DEBUG("NEW GROUP ITERATOR");
MSG_DEBUG(g);
MSG_DEBUG(lg);
MSG_QUEUE_FLUSH();
}
bool operator ++ ()
{
++i;
......@@ -1440,6 +1457,8 @@ struct symmetry_propagator {
input_count = (int) expr.m_leaves.size();
}
int get_input_node(int i) const { return exp_sym.tree->original_node_number(exp_sym.tree->m_leaves[i]); }
permutation_type
compute_propagated_permutation(
const std::vector<symmetry_table_type>& inputs,
......@@ -1538,8 +1557,8 @@ struct symmetry_propagator {
lat_input_groups.reserve(input_count);
sym_iterators.reserve(input_count);
for (int i = 0; i < input_count; ++i) {
input_groups.push_back(get_sym_group(i).permute(alignment[i])); /* alignment should be factored in here */
lat_input_groups.push_back(get_lat_sym_group(i).permute(alignment[i])); /* alignment should be factored in here */
input_groups.push_back(get_sym_group(get_input_node(i)).permute(alignment[i])); /* alignment should be factored in here */
lat_input_groups.push_back(get_lat_sym_group(get_input_node(i)).permute(alignment[i])); /* alignment should be factored in here */
sym_iterators.emplace_back(input_groups.back(), lat_input_groups.back());
}
......
This diff is collapsed.
......@@ -164,7 +164,7 @@ test_bayes_dai: ../sandbox/bayes.cc bayes.d $(ALL_BUT_MAIN_OBJ)
test_sib: pedigree_analysis.cc static_data.o
$C $< static_data.o -o $@
matrixexp: geno_matrix.cc ../include/lumping2.h ../include/geno_matrix.h ../include/pedigree.h ../include/permutation.h ../include/braille_plot.h Makefile ../include/pedigree_tree.h
matrixexp: geno_matrix.cc ../include/lumping2.h ../include/geno_matrix.h ../include/pedigree.h ../include/permutation.h ../include/braille_plot.h Makefile ../include/pedigree_tree.h ../include/symmetry.h
$C -DORDER=$(ORDER) $< -o $@ -DTEST_GENO_MATRIX
test_permutation: test_permutation.cc ../include/permutation.h ../include/braille_plot.h ../include/pedigree_tree.h Makefile
......
......@@ -83,12 +83,11 @@ geno_matrix
1, 0,
0, 1).finished(),
#ifdef WITH_OVERLUMPING
{
{},
/*{{{GAMETE_L, GAMETE_L}, {GAMETE_R, GAMETE_R}}, {{0, 0}, {1, 1}}},*/
/*{{{GAMETE_L, GAMETE_R}, {GAMETE_R, GAMETE_L}}, {{0, 1}, {1, 0}}}*/
{std::map<int, int>{{0, 0}, {1, 1}}, letter_permutation_type{}},
{std::map<int, int>{{0, 1}, {1, 0}}, letter_permutation_type{}}
},
/*symmetry_group_type().insert({permutation_type::anti_identity(2), letter_permutation_type{}})*/
/*},*/
{}
#endif
......@@ -114,11 +113,11 @@ geno_matrix
1, 0,
0, 1).finished(),
#ifdef WITH_OVERLUMPING
{
{},
/*{{{GAMETE_L, GAMETE_L}, {GAMETE_R, GAMETE_R}}, {{0, 1}, {1, 0}}}*/
/*{{{0, 1}, {1, 0}}}*/
{std::map<int, int>{{0, 0}, {1, 1}}, letter_permutation_type{}}
},
/*symmetry_group_type().insert({permutation_type::identity(2), letter_permutation_type{}})*/
/*},*/
{}
#endif
};
......@@ -215,7 +214,7 @@ int main(int argc, char** argv)
/* 1 */
if (test_case())
{
pedigree_type ped(10);
pedigree_type ped;
MSG_DEBUG("#####################################################################");
MSG_DEBUG("A");
size_t A = ped.ancestor();
......@@ -235,7 +234,7 @@ int main(int argc, char** argv)
/* 2 */
if (test_case())
{
pedigree_type ped(10);
pedigree_type ped;
ped.n_alleles = 2;
MSG_DEBUG("#####################################################################");
MSG_DEBUG("A");
......@@ -317,7 +316,7 @@ int main(int argc, char** argv)
MSG_DEBUG("*");
MSG_DEBUG("");
pedigree_type ped(10);
pedigree_type ped;
MSG_DEBUG("#####################################################################");
MSG_DEBUG("A");
size_t A = ped.ancestor();
......@@ -360,7 +359,7 @@ int main(int argc, char** argv)
/* 32 */
if (test_case())
{
pedigree_type ped(10);
pedigree_type ped;
/*ped.max_states = 4;*/
/*ped.n_alleles = 2;*/
size_t A = ped.ancestor();
......@@ -382,7 +381,7 @@ int main(int argc, char** argv)
/* 64 */
if (test_case())
{
pedigree_type ped(20);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -401,7 +400,7 @@ int main(int argc, char** argv)
/* 128 */
if (test_case())
{
pedigree_type ped(20);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -423,7 +422,7 @@ int main(int argc, char** argv)
/* 256 */
if (test_case())
{
pedigree_type ped(20);
pedigree_type ped;
ped.n_alleles = 2;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
......@@ -445,7 +444,7 @@ int main(int argc, char** argv)
/* 512 */
if (test_case())
{
pedigree_type ped(20);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -466,7 +465,7 @@ int main(int argc, char** argv)
/* 1024 */
if (test_case())
{
pedigree_type ped(20);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -479,7 +478,7 @@ int main(int argc, char** argv)
/* 2048 */
if (test_case())
{
pedigree_type ped(20);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -495,7 +494,7 @@ int main(int argc, char** argv)
/* 4096 */
if (test_case())
{
pedigree_type ped(20);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
/*size_t C = ped.ancestor();*/
......@@ -530,7 +529,7 @@ int main(int argc, char** argv)
/* 16384 */
if (test_case())
{
pedigree_type ped(30);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -553,7 +552,7 @@ int main(int argc, char** argv)
/* 32768 */
if (test_case())
{
pedigree_type ped(30);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -601,7 +600,7 @@ int main(int argc, char** argv)
#if 0
if (test_case())
{
pedigree_type ped(30);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t C = ped.ancestor();
......@@ -661,7 +660,7 @@ int main(int argc, char** argv)
size_t F2 = ped.crossing(F1_1, F1_2); (void) F2;
}
if (1)
if (0)
{
/*MatrixXd inf_mat(4, 4);*/
/*inf_mat << */
......@@ -693,7 +692,7 @@ int main(int argc, char** argv)
test_group(CP.inf_mat, CP.labels);
}
if (1)
if (0)
{
permutation_type p{0, 2, 1};
symmetry_mask_type s;
......@@ -727,7 +726,7 @@ int main(int argc, char** argv)
if (0)
{
pedigree_type ped(10);
pedigree_type ped;
/*ped.max_states = 4;*/
/*ped.n_alleles = 2;*/
size_t A = ped.ancestor();
......@@ -785,7 +784,7 @@ int main(int argc, char** argv)
if (0)
{
pedigree_type ped(10);
pedigree_type ped;
size_t A = ped.ancestor();
size_t B = ped.ancestor();
size_t F1_1 = ped.crossing(A, B);
......@@ -872,7 +871,7 @@ int main(int argc, char** argv)
if (0)
{
pedigree_type ped(10);
pedigree_type ped;
/*ped.max_states = 4;*/
/*ped.n_alleles = 2;*/
size_t A = ped.ancestor();
......@@ -923,7 +922,7 @@ int main(int argc, char** argv)
MSG_DEBUG((lz2.matrix<double>() * twothree * lz2.matrix<double>().transpose() - threetwo));
}
if (1)
if (0)
{
pedigree_tree_type tree;
......@@ -1034,7 +1033,7 @@ int main(int argc, char** argv)
}
}
if (1)
if (0)
{
pedigree_tree_type tree;
......
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