本文整理汇总了C++中Simplex::sign方法的典型用法代码示例。如果您正苦于以下问题:C++ Simplex::sign方法的具体用法?C++ Simplex::sign怎么用?C++ Simplex::sign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simplex
的用法示例。
在下文中一共展示了Simplex::sign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oja_rank
Point OjaData::oja_rank(const Point& x) const
{
errif(x.dim() != dim(), "OjaData::oja_rank: Illegal dimension on point " << x);
if (plane)
return plane->oja_rank(x);
Point Gr(dim());
Simplex S;
double sgn;
double k = 0;
for (Index I(dim(), size()); I; I++, k++)
{
S.get(*this, I, x);
sgn = S.sign();
for (int j = 0; j<dim(); j++)
Gr[j] += S.row_cof(j + 1) * sgn;
}
for (int i = 0; i < dim(); i++)
Gr[i] /= k;
return Gr;
}
示例2: get_oja_and_gradient
void OjaData::get_oja_and_gradient(const Point& x,double& oja
,Point& grad) const
{
errif(x.dim() != dim(),"OjaData::get_oja_and_gradient: point " << x
<< " has illegal dimension");
if(plane)
{
plane->oja_and_gradient(x,oja,grad);
return;
}
double sum = 0.0;
double sgn;
double k = 1.0 / double(fact(dim()));
Simplex S;
Point Gr(dim());
for(Index I(dim(),size()); I; I++)
{
S.get(*this,I,x);
sum += S.size();
sgn = S.sign();
for(int j=0; j<dim(); j++)
Gr[j] += S.row_cof(j+1) * sgn * k;
}
oja = sum;
grad = Gr;
}
示例3: gradient
Point OjaData::gradient(const Point& x) const
{
errif(x.dim() != dim(),"OjaData::gradient: Illegal dimension on point " << x);
if(plane)
return plane->gradient(x);
Point Gr(dim());
Simplex S;
double sgn;
double k = 1.0 / double(fact(dim()));
for(Index I(dim(),size()); I; I++)
{
S.get(*this,I,x);
sgn = S.sign();
for(int j=0; j<dim(); j++)
Gr[j] += S.row_cof(j+1) * sgn * k;
}
return Gr;
}