本文整理汇总了C++中intarray类的典型用法代码示例。如果您正苦于以下问题:C++ intarray类的具体用法?C++ intarray怎么用?C++ intarray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了intarray类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: toVarpower
void toVarpower(const_schur_partition a, intarray &result)
{
int len = a[0];
int *result_vp = result.alloc(2*len);
int *orig_result_vp = result_vp;
result_vp++;
if (len > 1)
{
int v = a[1];
int e = 1;
for (int i=2; i<len; i++)
{
if (v == a[i])
e++;
else
{
*result_vp++ = v;
*result_vp++ = e;
v = a[i];
e = 1;
}
}
*result_vp++ = v;
*result_vp++ = e;
}
int newlen = static_cast<int>(result_vp - orig_result_vp);
*orig_result_vp = newlen;
result.shrink(newlen);
}
开发者ID:pzinn,项目名称:M2,代码行数:32,代码来源:schur2.cpp
示例2: mult
void varpower::mult(const int *a, const int *b, intarray &result)
{
int len = *a + *b; // potential length
int *result_vp = result.alloc(len);
int *orig_result_vp = result_vp;
result_vp++;
index_varpower i = a;
index_varpower j = b;
// merge the two varpowers to staticVP
int va = (i.valid() ? i.var() : -1);
int vb = (j.valid() ? j.var() : -1);
for (;;)
{
if (va > vb)
{
*result_vp++ = va;
*result_vp++ = i.exponent();
++i;
va = (i.valid() ? i.var() : -1);
}
else if (vb > va)
{
*result_vp++ = vb;
*result_vp++ = j.exponent();
++j;
vb = (j.valid() ? j.var() : -1);
}
else
{
if (va == -1) break;
int x = i.exponent();
int y = j.exponent();
int z = x+y;
if ((x < 0) == (y < 0) && (x < 0) != (z < 0))
{
ERROR("monomial overflow");
}
else
{
if (z != 0)
{
*result_vp++ = va;
*result_vp++ = z;
}
}
++i; ++j;
va = (i.valid() ? i.var() : -1);
vb = (j.valid() ? j.var() : -1);
}
}
int newlen = static_cast<int>(result_vp - orig_result_vp);
*orig_result_vp = newlen;
result.shrink(newlen);
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:56,代码来源:varpower.cpp
示例3: var
// Mostly used to make skew vars...
void varpower::var(int v, int e, intarray &result)
{
if (e == 0)
result.append(1);
else
{
check_var(v,e); // Sets ERROR if a problem...
result.append(3);
result.append(v);
result.append(e);
}
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:13,代码来源:varpower.cpp
示例4: power
void varpower::power(const int *a, int n, intarray &result)
{
if (n == 0)
{
result.append(1);
return;
}
int *result_vp = result.alloc(*a);
*result_vp++ = *a;
for (index_varpower i = a; i.valid(); ++i)
{
*result_vp++ = i.var();
*result_vp++ = safe::mult(i.exponent(),n);
}
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:15,代码来源:varpower.cpp
示例5: monsyz
void varpower::monsyz(const int *a, const int *b,
intarray &sa, intarray &sb)
// sa, sb are set so that a * sa = b * sb
// and sa, sb have disjoint support.
{
int *result_vp1 = sa.alloc(*b);
int *result_vp2 = sa.alloc(*a);
int *orig_result_vp1 = result_vp1;
int *orig_result_vp2 = result_vp2;
result_vp1++;
result_vp2++;
index_varpower i = a;
index_varpower j = b;
int va = (i.valid() ? i.var() : -1);
int vb = (j.valid() ? j.var() : -1);
for (;;)
{
if (va > vb)
{
// va should be placed into sb
*result_vp2++ = va;
*result_vp2++ = i.exponent();
++i;
va = (i.valid() ? i.var() : -1);
}
else if (va < vb)
{
// vb should be placed into sa
*result_vp1++ = vb;
*result_vp1++ = j.exponent();
++j;
vb = (j.valid() ? j.var() : -1);
}
else
{
if (va == -1) break;
int ea = i.exponent();
int eb = j.exponent();
if (ea < eb)
{
*result_vp1++ = va;
*result_vp1++ = eb-ea;
}
else if (ea > eb)
{
*result_vp2++ = va;
*result_vp2++ = ea-eb;
}
++i; ++j;
va = (i.valid() ? i.var() : -1);
vb = (j.valid() ? j.var() : -1);
}
}
*orig_result_vp1 = static_cast<int>(result_vp1 - orig_result_vp1);
*orig_result_vp2 = static_cast<int>(result_vp2 - orig_result_vp2);
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:58,代码来源:varpower.cpp
示例6: radical
void varpower::radical(const int *a, intarray &result)
{
// length of result is the same as that of a
int *result_vp = result.alloc(*a);
*result_vp++ = *a;
for (index_varpower i = a; i.valid(); ++i)
{
*result_vp++ = i.var(); // var
*result_vp++ = 1; // exponent
}
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:11,代码来源:varpower.cpp
示例7: InitEnds
void C_BranchProperties::InitEnds()
{
static intarray chk;
static intarray unchk;
static intarray greyed;
static stringarray tips;
static intarray values;
if (0 == tips.GetLength()) {
tips.ReDim(3);
chk.ReDim(3);
unchk.ReDim(3);
greyed.ReDim(3);
values.ReDim(3);
*tips[0] = _T("The branch is drawn with a rounded end");
*tips[1] = _T("The branch is drawn with a square end");
*tips[2] = _T("The branch is drawn with a flat end");
*values[0] = eEndRound;
*values[1] = eEndSquare;
*values[2] = eEndFlat;
for (int n = 0; n < chk.GetLength(); n++) {
*chk[n] = reinterpret_cast<int>(s_hEndSel[n]->GetHandle());
*unchk[n] = reinterpret_cast<int>(s_hEndUnsel[n]->GetHandle());
*greyed[n] = reinterpret_cast<int>(s_hEndGrey[n]->GetHandle());
}
}
m_penEnd.Init(
eMetafile,
String(_T("Pen End")),
unchk,
chk,
greyed,
tips,
values
);
}
开发者ID:ElliottBignell,项目名称:HeadCase,代码行数:42,代码来源:BranchProperties.cpp
示例8: InitJoin
void C_BranchProperties::InitJoin()
{
static intarray chk;
static intarray unchk;
static intarray greyed;
static stringarray tips;
static intarray values;
if (0 == tips.GetLength()) {
tips.ReDim(3);
chk.ReDim(3);
unchk.ReDim(3);
greyed.ReDim(3);
values.ReDim(3);
*tips[0] = _T("The branch is drawn with a rounded join");
*tips[1] = _T("The branch is drawn with a bevelled join");
*tips[2] = _T("The branch is drawn with a mitred join");
*values[0] = eJoinRound;
*values[1] = eJoinBevel;
*values[2] = eJoinMitre;
for (int n = 0; n < chk.GetLength(); n++) {
*chk[n] = reinterpret_cast<int>(s_hJoinSel[n]->GetHandle());
*unchk[n] = reinterpret_cast<int>(s_hJoinUnsel[n]->GetHandle());
*greyed[n] = reinterpret_cast<int>(s_hJoinGrey[n]->GetHandle());
}
}
m_penJoin.Init(
eMetafile,
String(_T("Pen Join")),
unchk,
chk,
greyed,
tips,
values
);
}
开发者ID:ElliottBignell,项目名称:HeadCase,代码行数:42,代码来源:BranchProperties.cpp
示例9: from_ntuple
void varpower::from_ntuple(int n, const int *a, intarray &result)
{
int len = 0;
for (int i=0; i<n; i++) if (a[i] != 0) len++;
int result_len = 2*len + 1;
int *result_vp = result.alloc(result_len);
*result_vp++ = result_len;
for (int i=n-1; i>=0; i--)
if (a[i] != 0)
{
*result_vp++ = i;
*result_vp++ = a[i];
}
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:15,代码来源:varpower.cpp
示例10: from_arrayint
void varpower::from_arrayint(M2_arrayint m, intarray &result)
{
int *result_vp = result.alloc(m->len+1);
*result_vp++ = m->len+1;
int *melems = m->array;
for (int i=0; i<m->len; i+=2)
{
int v = *melems++;
int e = *melems++;
check_var(v,e);
*result_vp++ = v;
*result_vp++ = e;
}
}
开发者ID:AlessandroOneto,项目名称:M2,代码行数:15,代码来源:varpower.cpp
示例11: lcm
void varpower::lcm(const int *a, const int *b, intarray &result)
{
int len = *a + *b; // potential length
int *result_vp = result.alloc(len);
int *orig_result_vp = result_vp;
result_vp++;
index_varpower i = a;
index_varpower j = b;
// merge the two varpowers to staticVP
int va = (i.valid() ? i.var() : -1);
int vb = (j.valid() ? j.var() : -1);
for (;;)
{
if (va > vb)
{
*result_vp++ = va;
*result_vp++ = i.exponent();
++i;
va = (i.valid() ? i.var() : -1);
}
else if (vb > va)
{
*result_vp++ = vb;
*result_vp++ = j.exponent();
++j;
vb = (j.valid() ? j.var() : -1);
}
else
{
if (va == -1) break;
int ea = i.exponent();
int eb = j.exponent();
if (ea < eb) ea = eb;
*result_vp++ = va;
*result_vp++ = ea;
++i;
++j;
va = (i.valid() ? i.var() : -1);
vb = (j.valid() ? j.var() : -1);
}
}
*orig_result_vp = static_cast<int>(result_vp - orig_result_vp);
}
开发者ID:BertiniM2,项目名称:M2,代码行数:45,代码来源:varpower.cpp
示例12: quotient
void varpower::quotient(const int *a, const int *b, intarray &result)
// return a:b
{
int *result_vp = result.alloc(*a);
int *orig_result_vp = result_vp;
result_vp++;
index_varpower i = a;
index_varpower j = b;
int va = (i.valid() ? i.var() : -1);
int vb = (j.valid() ? j.var() : -1);
for (;;)
{
if (va > vb)
{
*result_vp++ = va;
*result_vp++ = i.exponent();
++i;
va = (i.valid() ? i.var() : -1);
}
else if (vb > va)
{
++j;
vb = (j.valid() ? j.var() : -1);
}
else
{
if (va == -1) break;
int ea = i.exponent();
int eb = j.exponent();
if (ea > eb)
{
*result_vp++ = va;
*result_vp++ = ea - eb; // overflow cannot occur
}
++i;
++j;
va = (i.valid() ? i.var() : -1);
vb = (j.valid() ? j.var() : -1);
}
}
*orig_result_vp = static_cast<int>(result_vp - orig_result_vp);
}
开发者ID:BertiniM2,项目名称:M2,代码行数:44,代码来源:varpower.cpp
示例13: erase
void varpower::erase(const int *a, const int *b, intarray &result)
// divide a by b^infinity
{
int *result_vp = result.alloc(*a);
int *orig_result_vp = result_vp;
result_vp++;
index_varpower i = a;
index_varpower j = b;
int va = (i.valid() ? i.var() : -1);
int vb = (j.valid() ? j.var() : -1);
for (;;)
{
if (va > vb)
{
*result_vp++ = va;
*result_vp++ = i.exponent();
++i;
va = (i.valid() ? i.var() : -1);
}
else if (vb > va)
{
++j;
vb = (j.valid() ? j.var() : -1);
}
else
{
if (va == -1) break;
++i;
++j;
va = (i.valid() ? i.var() : -1);
vb = (j.valid() ? j.var() : -1);
}
}
*orig_result_vp = static_cast<int>(result_vp - orig_result_vp);
}
开发者ID:BertiniM2,项目名称:M2,代码行数:38,代码来源:varpower.cpp
示例14: one
// Used in 2 places
void varpower::one(intarray &result) { result.append(1); }
开发者ID:AlessandroOneto,项目名称:M2,代码行数:2,代码来源:varpower.cpp
示例15: ints
int * ints() { return val.raw(); }
开发者ID:ChristineJost,项目名称:M2,代码行数:1,代码来源:monomial.hpp
示例16: text_out
void text_out(buffer &o) const { varpower::elem_text_out(o, val.raw()); }
开发者ID:ChristineJost,项目名称:M2,代码行数:1,代码来源:monomial.hpp
示例17: to_arrayint
M2_arrayint to_arrayint() const { return varpower::to_arrayint(val.raw()); }
开发者ID:ChristineJost,项目名称:M2,代码行数:1,代码来源:monomial.hpp
注:本文中的intarray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论