当前位置: 首页>>代码示例>>C++>>正文


C++ ivector::indexmax方法代码示例

本文整理汇总了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));
  }
}
开发者ID:johnrsibert,项目名称:admb,代码行数:44,代码来源:f3arr.cpp

示例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));
   }
 }
开发者ID:jimianelli,项目名称:admb,代码行数:38,代码来源:dmat.cpp

示例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));
   }
 }
开发者ID:colemonnahan,项目名称:admb,代码行数:31,代码来源:lmat.cpp

示例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);
}
开发者ID:jimianelli,项目名称:admb,代码行数:14,代码来源:dmat18.cpp

示例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;
 }
开发者ID:pwoo,项目名称:admb,代码行数:14,代码来源:dvect8.cpp

示例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);
  }
开发者ID:hhamazaki,项目名称:cstar,代码行数:17,代码来源:generic.cpp

示例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);
   }
 }
开发者ID:pwoo,项目名称:admb,代码行数:12,代码来源:dvect8.cpp

示例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;
  }
}
开发者ID:colemonnahan,项目名称:admb,代码行数:13,代码来源:ivector.cpp

示例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;
}
开发者ID:colemonnahan,项目名称:admb,代码行数:14,代码来源:ivector.cpp

示例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;
}
开发者ID:colemonnahan,项目名称:admb,代码行数:18,代码来源:d3arr4.cpp

示例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);
   }
 }
开发者ID:colemonnahan,项目名称:admb,代码行数:18,代码来源:pvmvar1.cpp

示例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;
  }
开发者ID:jimianelli,项目名称:admb,代码行数:9,代码来源:dmat.cpp

示例13:

/**
 * Description not yet available.
 * \param
 */
ivector_position::ivector_position(const ivector& iv)
{
  min=iv.indexmin();
  max=iv.indexmax();
  v=iv.get_v();
}
开发者ID:fishfollower,项目名称:admb,代码行数:10,代码来源:cmpdif2.cpp

示例14: allocate

/**
 * Description not yet available.
 * \param
 */
void ivector::allocate(const ivector& dv)
{
  allocate(dv.indexmin(),dv.indexmax());
}
开发者ID:colemonnahan,项目名称:admb,代码行数:8,代码来源:ivector.cpp


注:本文中的ivector::indexmax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。