本文整理汇总了C++中FreeModule::append_schreyer方法的典型用法代码示例。如果您正苦于以下问题:C++ FreeModule::append_schreyer方法的具体用法?C++ FreeModule::append_schreyer怎么用?C++ FreeModule::append_schreyer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreeModule
的用法示例。
在下文中一共展示了FreeModule::append_schreyer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreeModule
FreeModule* ResF4toM2Interface::to_M2_freemodule(const PolynomialRing* R,
SchreyerFrame& C,
int lev)
{
FreeModule* result = new FreeModule(R, 0, true);
if (lev < 0 or lev > C.maxLevel())
{
return result;
}
const Monoid* M = R->getMonoid();
auto& thislevel = C.level(lev);
const ResSchreyerOrder& S = C.schreyerOrder(lev);
res_ntuple_word* longexp = new res_ntuple_word[M->n_vars()];
int* exp = new int[M->n_vars()];
for (auto i = 0; i < thislevel.size(); ++i)
{
int d[1];
d[0] = thislevel[i].mDegree;
monomial deg = M->degree_monoid()->make_one();
M->degree_monoid()->from_expvector(d, deg);
// Now grab the Schreyer info
// unpack to exponent vector, then repack into monoid element
monomial totalmonom = M->make_one();
long comp;
C.monoid().to_exponent_vector(S.mTotalMonom[i], longexp, comp);
for (int j=0; j<M->n_vars(); ++j)
exp[j] = static_cast<int>(longexp[j]);
M->from_expvector(exp, totalmonom);
result->append_schreyer(deg, totalmonom, static_cast<int>(S.mTieBreaker[i]));
}
delete [] longexp;
delete [] exp;
return result;
}
示例2: setup
void gbres_comp::setup(const Matrix *m,
int length,
int origsyz,
int strategy)
{
int i;
originalR = m->get_ring()->cast_to_PolynomialRing();
if (originalR == NULL) assert(0);
GR = originalR->get_gb_ring();
mi_stash = new stash("res mi nodes", sizeof(Nmi_node));
FreeModule *Fsyz = originalR->make_Schreyer_FreeModule();
if (length <= 0)
{
ERROR("resolution length must be at least 1");
length = 1;
}
// If origsyz, and length>1, create Fsyz as a Schreyer free
// if origsyz is smaller, truncate this module...
if (length > 1 && origsyz > 0)
{
if (origsyz > m->n_cols())
origsyz = m->n_cols();
int *one = originalR->getMonoid()->make_one();
const int *mon;
for (i=0; i<origsyz; i++)
{
if ((*m)[i] == NULL)
mon = one;
else
{
Nterm *t = (*m)[i]->coeff;
mon = t->monom;
}
Fsyz->append_schreyer(m->cols()->degree(i), mon, i);
}
originalR->getMonoid()->remove(one);
}
lo_degree = m->cols()->lowest_primary_degree();
last_completed_degree = lo_degree-1;
n_nodes = length + 1;
nodes = newarray(gb_node_ptr,n_nodes);
nodes[0] = new gb_emitter(m);
nodes[1] = new gb2_comp(Fsyz,mi_stash,nodes[0],lo_degree,origsyz,1,strategy);
nodes[0]->set_output(nodes[1]);
if (n_nodes == 2)
{
// Don't compute syzygies at all.
nodes[1]->set_output(NULL);
}
else if (n_nodes >= 3)
{
// Compute a resolution to length 'length', with last being
// a gb node.
int deg = lo_degree+1;
if (origsyz > 0) deg--;
for (i=2; i<n_nodes-1; i++)
{
FreeModule *F = originalR->make_Schreyer_FreeModule();
nodes[i] = new gb2_comp(F,mi_stash,nodes[i-1],deg++,-1,i,strategy);
nodes[i-1]->set_output(nodes[i]);
}
FreeModule *F = originalR->make_Schreyer_FreeModule();
nodes[n_nodes-1] = new gb2_comp(F,mi_stash,nodes[n_nodes-2],deg++,0,n_nodes-1,strategy);
nodes[n_nodes-1]->set_output(NULL);
}
strategy_flags = strategy;
}