本文整理汇总了C++中Partition::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Partition::Add方法的具体用法?C++ Partition::Add怎么用?C++ Partition::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partition
的用法示例。
在下文中一共展示了Partition::Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateCells
void Grid::PopulateCells(Entity* ent)
{
BoxCollider* box = ent->GetComponent<BoxCollider>();
if (box)
{
box->cell = cell;
box->part.clear();
Vector3 min = box->GetMinCoord();
Vector3 max = box->GetMaxCoord();
min.x /= GridWidth;
min.x *= NumberOfPartitionsX;
max.x /= GridWidth;
max.x *= NumberOfPartitionsX;
min.y /= GridHeight;
min.y *= NumberOfPartitionsY;
max.y /= GridHeight;
max.y *= NumberOfPartitionsY;
for (int i = min.x; i <= max.x; ++i)
for (int j = min.y; j <= max.y; ++j)
{
Partition* c = GetPartition(i, j);
if (c)
{
c->Add(ent);
box->part.push_back(c);
}
}
}
for (auto &child : ent->GetChildren())
{
if (child->IsActive())
PopulateCells(child);
}
}
示例2: main
void main(void) {
int n, k, r;
//ofstream data_file;
//data_file.open("Answer5.txt");
n = 4;
for(k = 2; k <= n-2; k++) {
// We first loop through all partitions of n
list<Partition> pars;
pars = Par(n);
// for latter use
list<RankSet> ranks;
ranks = ComputeRanks(n, k);
for(list<Partition>::iterator lambda = pars.begin(); lambda != pars.end(); ++lambda) {
Partition theta;
for(int junk = 1; junk <= (*lambda).Size(); junk++) {
theta.Add(1);
}
tableau t = standard(*lambda, theta);
list<Perm> colgroup = C(t);
list<Perm> rowgroup = R(t);
vector<Perm> YS;
vector<int> signs;
int YSl = 0;
// we scroll through col * sign and the row
for(list<Perm>::iterator sigma = colgroup.begin(); sigma != colgroup.end(); ++sigma) {
for (list<Perm>::iterator tau = rowgroup.begin(); tau != rowgroup.end(); ++tau) {
YS.push_back((*sigma) * (*tau));
signs.push_back(sign(*sigma));
YSl++;
}
}
vector<Matrix> MatList(n-1);
vector<bool> exists(n-1);
for(int o = 0; o < n-1; o++) {
exists[o] = false;
}
// Now we loop through all possible ranks-sets
// Answers store our multiplicity calculations
vector<int> Answers(n-1);
// Before we begin we need to get all possible SSYT to create an ordered basis
vector<RankSet> images;
for(list<RankSet>::const_iterator tempiter = ranks.begin(); tempiter != ranks.end(); ++tempiter) {
images.push_back(*tempiter);
}
// get a list of SSYT
// where each element of the list is a SSYT
// of each possible image
vector<chain> posschains;
for(vector<RankSet>::iterator image = images.begin(); image != images.end(); ++image) {
list<tableau> temptablist = SSYT(*lambda, *image);
if(temptablist.size() != 0) {
// convert each tableau to a chain
list<chain> tempchainlist;
for(list<tableau>::const_iterator tabby = temptablist.begin(); tabby != temptablist.end(); ++tabby) {
Partition gamma2;
for (RankSet::const_iterator iter = (*image).begin(); iter != (*image).end(); ++iter) {
gamma2.Add(*iter);
}
tabloid tempoid;
tempoid = TableauToTabloid(*tabby, gamma2);
chain c = ConvertFromTabloid(tempoid);
posschains.push_back(c);
}
}
}
// So now posschains contains all possible image chains
// this stores the dimension of the range
int rangedim = posschains.size();
// for each possible image chain, apply the
// Young symmetrizer. We will get a result of type basis.
vector<basis> vecofimages;
for(vector<chain>::const_iterator c = posschains.begin(); c != posschains.end(); ++c) {
vecofimages.push_back(e(YS, signs, YSl, *c));
}
//vecofimages now contains all the symmetrized images.
for(list<RankSet>::iterator u = ranks.begin(); u != ranks.end(); ++u) {
// We need to get possible ranges of u
list<tableau> tableaulist = SSYT(*lambda, *u);
// convert to chains
list<chain> domain;
Partition gamma;
for (RankSet::const_iterator iter = (*u).begin(); iter != (*u).end(); ++iter) {
gamma.Add(*iter);
}
//.........这里部分代码省略.........
示例3: main
void main(void) {
cout << "\nTesting blank constructor";
tabloid t;
cout << "\nTesting constructor of a tabloid of shape 311";
Partition lambda;
lambda.Add(3);
lambda.Add(2);
lambda.Add(1);
tabloid s(lambda);
cout << "\nGetting the standard tabloid of shape 311";
s = standardoid(lambda);
cout << "\nTesting output";
cout << s;
cout << "\nTesting Sn action";
Perm sigma(6);
sigma[1]=6;
sigma[2]=3;
sigma[3]=1;
sigma[4]=2;
sigma[5]=5;
sigma[6]=4;
cout << "\nApplying ";
cout << sigma;
cout << sigma * s;
cout << "\nNote that ";
cout << s;
cout << " has " << s.RowNumber() << " of rows";
cout << " and the second row is \n";
rows temp = s.Row(2);
for (rows::const_iterator iter2 = temp.begin(); iter2 != temp.end(); ++iter2) {
cout << " " << *iter2;
}
// reorder the rows of a tabloid Note it no longer have the shape of a paritition
Perm tau(3);
tau[1]=2;
tau[2]=3;
tau[3]=1;
cout << "\nReordering rows of ";
cout << s;
cout << " with ";
cout << tau;
tabloid q = reorderrows(tau, s);
cout << q;
// void insert(const vector<int> row);
cout << "\nNow we insert a row of 7, 8, 9";
vector<int> rowtemp;
rowtemp.push_back(7);
rowtemp.push_back(8);
rowtemp.push_back(9);
q.insert(rowtemp);
cout << q;
// void Add(const int row, const int value);
cout << "\nNow we add a 10 to row 2";
q.Add(2,10);
cout << q;
int crap;
cin >> crap;
}