本文整理汇总了C++中DblMatrix::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ DblMatrix::push_back方法的具体用法?C++ DblMatrix::push_back怎么用?C++ DblMatrix::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DblMatrix
的用法示例。
在下文中一共展示了DblMatrix::push_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qtClustering
int DblMatrix::qtClustering(double thresh, std::vector<DblMatrix>& clusters)
{
/// initialize the members
IntMatrix members;
members.assign(size(), IntVector());
///// each entry is a neighbor of itself
for(unsigned int i=0; i<size(); i++)
members[i].push_back(i);
/// get the other members
for(unsigned int j=0; j<size()-1; j++)
{
for(unsigned int k=j+1; k<size(); k++)
{
double diff = (*this)[j].EuclDist((*this)[k]);
if(diff <= thresh)
{
members[j].push_back(k);
members[k].push_back(j);
}
}
}
/// QT clustering
std::sort(members.begin(), members.end(), IntVectorGreater);
IntMatrix::iterator it1;
int n=0;
for(it1=members.begin(); it1!=members.end(); it1++, n++)
{
for(unsigned int j=1; j<it1->size(); j++)
{
IntMatrix::iterator it2=it1;
it2++;
for(; it2!=members.end();)
{
if((*it1)[j]==it2->front()) it2=members.erase(it2);
else it2++;
}
}
}
/// build groups
clusters.clear();
for(unsigned int i=0; i<members.size(); i++)
{
DblMatrix cluster;
for(unsigned int j=0; j<members[i].size(); j++)
{
cluster.push_back((*this)[members[i][j]]);
}
clusters.push_back(cluster);
}
return 0;
}
示例2: GetHelpDeterminant
// sub-determinant
double DblMatrix::GetHelpDeterminant(int k)
{
int h=GetHeight();
assert(h+1==GetWidth());
DblMatrix HelpDet;
// replace the
for(int i=0; i<h; i++)
{
HelpDet.push_back(DblVector());
for(int j=0; j<h; j++)
{
if(j==k)
HelpDet[i].push_back((*this)[i][h]);
else
HelpDet[i].push_back((*this)[i][j]);
}
}
return HelpDet.GetDeterminantNxN();
}
示例3: SolveLinearCramer
// solve linear NxN equation system (cramer)
int DblMatrix::SolveLinearCramer(DblVector& Solution)
{
// get main determinant
DblMatrix DetMat;
double Det=0.0;
int w = GetWidth();
int h = GetHeight();
for(int i=0; i<h; i++)
{
DetMat.push_back(DblVector());
for(int j=0; j<w-1; j++)
DetMat[i].push_back((*this)[i][j]);
}
Det = DetMat.GetDeterminantNxN();
if(fabs(Det)<THE_EPS_DEF) return 0;
// get solutions
Solution.clear();
for(int k=0; k<h; k++)
Solution.push_back(this->GetHelpDeterminant(k)/Det);
return 1;
}