本文整理汇总了C++中ivector::indexmax方法的典型用法代码示例。如果您正苦于以下问题:C++ ivector::indexmax方法的具体用法?C++ ivector::indexmax怎么用?C++ ivector::indexmax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ivector
的用法示例。
在下文中一共展示了ivector::indexmax方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: x
/**
Allocate variable vector of matrices with dimensions
[sl to sh] x ([nrl to nrh] x [ncl to nch])
where nch is a vector of indexes.
\param sl lower index of vector
\param sh upper index of vector
\param nrl lower row index for matrix
\param nrh upper row index for matrix
\param ncl vector of lower column indexes for matrix
\param nch vector of upper column indexes for matrix
*/
void dvar3_array::allocate(int sl, int sh, int nrl, int nrh,
const ivector& ncl, const ivector& nch)
{
if (sh<sl)
{
allocate();
return;
}
#ifdef DIAG
myheapcheck("Entering dvar3_array matrix(sl,sh,nrl,nrh,ncl,nch)" );
#endif
if (sl !=ncl.indexmin() || sh !=ncl.indexmax()
|| sl !=nch.indexmin() || sh !=nch.indexmax())
{
cerr << "Incompatible array bounds in "
"dmatrix(int nrl,int nrh, const ivector& ncl, const ivector& nch)" << endl;
ad_exit(1);
}
if ((shape = new three_array_shape(sl, sh)) == 0)
{
cerr << " Error allocating memory in dvar3_array contructor" << endl;
}
if ( (t = new dvar_matrix[slicesize()]) == 0)
{
cerr << " Error allocating memory in dvar3_array contructor" << endl;
ad_exit(21);
}
t -= slicemin();
for (int i = sl; i <= sh; ++i)
{
t[i].allocate(nrl, nrh, ncl(i), nch(i));
}
}
示例2: allocate
/**
* Description not yet available.
* \param
*/
void dmatrix::allocate(int nrl,int nrh,const ivector& ncl,const ivector& nch)
{
if (nrh<nrl)
{
allocate();
return;
}
if (nrl !=ncl.indexmin() || nrh !=ncl.indexmax() ||
nrl !=nch.indexmin() || nrh !=nch.indexmax())
{
cerr << "Incompatible array bounds in "
"dmatrix(int nrl,int nrh,const ivector& ncl,const ivector& nch)\n";
ad_exit(1);
}
index_min=nrl;
index_max=nrh;
if ( (m = new dvector [rowsize()]) == 0)
{
cerr << " Error allocating memory in dmatrix contructor\n";
ad_exit(21);
}
if ( (shape = new mat_shapex(m))== 0)
{
cerr << " Error allocating memory in dmatrix contructor\n";
ad_exit(21);
}
m -= rowmin();
for (int i=rowmin(); i<=rowmax(); i++)
{
m[i].allocate(ncl(i),nch(i));
}
}
示例3: allocate
/**
* Description not yet available.
* \param
*/
void lmatrix::allocate(int nrl,int nrh,const ivector& ncl,const ivector& nch)
{
if ((shape = new mat_shape(nrl,nrh,ncl(ncl.indexmin()),
nch(nch.indexmin()) ))== 0)
{
cerr << " Error allocating memory in lmatrix contructor\n";
ad_exit(21);
}
if (nrl !=ncl.indexmin() || nrh !=ncl.indexmax() ||
nrl !=nch.indexmin() || nrh !=nch.indexmax())
{
cerr << "Incompatible array bounds in "
"dmatrix(int nrl,int nrh, const ivector& ncl, const ivector& nch)\n";
ad_exit(1);
}
size_t rs=rowsize();
if ( (m = new lvector [rs]) == 0)
{
cerr << " Error allocating memory in lmatrix contructor\n";
ad_exit(21);
}
m -= rowmin();
for (int i=rowmin(); i<=rowmax(); i++)
{
m[i].allocate(ncl(i),nch(i));
}
}
示例4: operator
/**
* Description not yet available.
* \param
*/
dmatrix dmatrix::operator()(const ivector& t)
{
dmatrix tmp(t.indexmin(), t.indexmax(), t.indexmin(), t.indexmax());
for (int i=t.indexmin(); i <= t.indexmax(); i++)
{
tmp(i) = (*this)(t(i))(t);
}
return(tmp);
}
示例5: operator
/**
* Description not yet available.
* \param
*/
dvector dvector::operator ()(const ivector& u)
{
dvector tmp(u.indexmin(),u.indexmax());
for ( int i=u.indexmin(); i<=u.indexmax(); i++)
{
tmp(i)=(*this)(u(i));
}
return tmp;
}
示例6: match
ivector match(const ivector& x, const ivector& table)
{
int i,j;
ivector pos(x.indexmin(),x.indexmax());
for(i=x.indexmin();i<=x.indexmax();i++)
{
for(j=table.indexmin();j<=table.indexmax();j++)
{
if(x(i) == table(j) )
{
pos(i) = j;
break;
}
}
}
return(pos);
}
示例7: allocate
/**
* Description not yet available.
* \param
*/
dvector::dvector(const ivector& u)
{
allocate(u.indexmin(),u.indexmax());
for ( int i=indexmin(); i<=indexmax(); i++)
{
elem(i)=u.elem(i);
}
}
示例8: clean
/**
Set elements of ivec to zero starting from level + 1;
\param level is the index of ivec
*/
void clean(ivector& v, int level)
{
int max = v.indexmax();
for (int i = level + 1; i <= max; ++i)
{
v(i) = 0;
}
}
示例9: norm2
/**
Returns the sum of the squares of all elements in ivec.
\param ivec ivector
*/
int norm2(const ivector& ivec)
{
int sum = 0;
for (int i = ivec.indexmin(); i <= ivec.indexmax(); ++i)
{
sum += ivec(i) * ivec(i);
}
return sum;
}
示例10: square
/**
Return dvector results of squaring elements in a values;
constant vector object.
\ingroup misc
\param values of constant object to be squared.
\return vector of the same length as #values containing \f$values_i^2\f$
*/
ivector square(const ivector& values)
{
ivector results;
results.allocate(values);
for (int i = values.indexmin(); i <= values.indexmax(); ++i)
{
results(i) = values(i) * values(i);
}
return results;
}
示例11: assign
void pvm_int::assign(const ivector& u)
{
if(ad_comm::pvm_manager)
{
int nsp=ad_comm::pvm_manager->num_slave_processes;
if (u.indexmin() !=0 || u.indexmax() != nsp)
{
cerr << "Error in pvm_int::assign validindex bounds must be 0 "
<< ad_comm::pvm_manager->num_slave_processes << endl;
ad_exit(1);
}
if (allocated(v))
v.deallocate();
v.allocate(0,nsp);
v=u;
d=u(0);
}
}
示例12: ivector_check
/**
* Description not yet available.
* \param
*/
int ivector_check(const ivector& v, int l, int u)
{
if (v.indexmin()!=l||v.indexmax()!=u) return 1;
return 0;
}
示例13:
/**
* Description not yet available.
* \param
*/
ivector_position::ivector_position(const ivector& iv)
{
min=iv.indexmin();
max=iv.indexmax();
v=iv.get_v();
}
示例14: allocate
/**
* Description not yet available.
* \param
*/
void ivector::allocate(const ivector& dv)
{
allocate(dv.indexmin(),dv.indexmax());
}