• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VectorPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VectorPtr的典型用法代码示例。如果您正苦于以下问题:C++ VectorPtr类的具体用法?C++ VectorPtr怎么用?C++ VectorPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VectorPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Q_ASSERT

// If a plugin provides a Parameters Vector, then scalars will be created, as well as a label.
void BasicPlugin::createScalars() {
  // Assumes that this is called with a write lock in place on this object
  Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);

  if (hasParameterVector()) {
    VectorPtr vectorParam = _outputVectors["Parameters Vector"];
    if (vectorParam) {
      QString paramName;
      int i = 0;
      int length = vectorParam->length();

      Q_ASSERT(store());
      for (paramName = parameterName(i);
          !paramName.isEmpty() && i < length;
           paramName = parameterName(++i)) {
        double scalarValue = vectorParam->value(i);
        if (!_outputScalars.contains(paramName)) {
          ScalarPtr s = store()->createObject<Scalar>();
          s->setProvider(this);
          s->setSlaveName(paramName);
          s->setValue(scalarValue);
          s->writeLock();
          _outputScalars.insert(paramName, s);
        } else {
          _outputScalars[paramName]->setValue(scalarValue);
        }
      }
    }
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:31,代码来源:basicplugin.cpp


示例2: selectedVector

void VectorSelector::fillVectors() {
  if (!_store) {
    return;
  }
  int current_index = _vector->currentIndex();
  VectorPtr current = selectedVector();

  QHash<QString, VectorPtr> vectors;

  VectorList vectorList = _store->getObjects<Vector>();

  VectorList::ConstIterator it = vectorList.constBegin();
  for (; it != vectorList.constEnd(); ++it) {
    VectorPtr vector = (*it);
    if (vector->isScalarList())
      continue;

    vector->readLock();
    vectors.insert(vector->CleanedName(), vector);
    vector->unlock();
  }

  QStringList list = vectors.keys();

  qSort(list);

  _vector->clear();
  foreach (const QString &string, list) {
    VectorPtr v = vectors.value(string);
    _vector->addItem(string, qVariantFromValue(v.data()));
  }
开发者ID:mattryoung,项目名称:kst,代码行数:31,代码来源:vectorselector.cpp


示例3: TEST_F

/** @brief Update by mean vectors and covariance matrices */
TEST_F(TestBCM, CovTest)
{
	// pointer should be NULL initially
	EXPECT_FALSE(m_pSumOfWeightedMeans);
	EXPECT_FALSE(m_pSumOfInvCovs);

	// prediction 1
	update(pMean1, pCov1);
	EXPECT_TRUE(m_pSumOfInvCovs->isApprox(*pSumOfInvCovs1));
	EXPECT_TRUE(m_pSumOfWeightedMeans->isApprox(*pSumOfWeightedMeansByCov1));

	// prediction 2
	update(pMean2, pCov2);
	EXPECT_TRUE(m_pSumOfInvCovs->isApprox(*pSumOfInvCovs2));
	EXPECT_TRUE(m_pSumOfWeightedMeans->isApprox(*pSumOfWeightedMeansByCov2));

	// prediction 3
	update(pMean3, pCov3);
	EXPECT_TRUE(m_pSumOfInvCovs->isApprox(*pSumOfInvCovs3));
	EXPECT_TRUE(m_pSumOfWeightedMeans->isApprox(*pSumOfWeightedMeansByCov3));

	// final
	VectorPtr pMean;
	MatrixPtr pCov;
	get(pMean, pCov);
	EXPECT_TRUE(pCov->isApprox(pCovFinal->diagonal())); // get a variance!!! 
	EXPECT_TRUE(pMean->isApprox(*pMeanByCovFinal));
}
开发者ID:kanster,项目名称:GPMap,代码行数:29,代码来源:test_bcm.hpp


示例4: AutoBin

void Histogram::AutoBin(VectorPtr V, int *n, double *max, double *min) {
    double m;

    *max = V->max();
    *min = V->min();
    *n = V->length();

    if (*max < *min) {
        m = *max;
        *max = *min;
        *min = m;
    }

    if (*max == *min) {
        *max += 1.0;
        *min -= 1.0;
    }

    // we can do a better job auto-ranging using the tick rules from plot...
    // this has not been done yet, you will notice...
    *n /= 50;
    if (*n < 6) {
        *n = 6;
    }
    if (*n > 60) {
        *n = 60;
    }

    m = (*max - *min)/(100.0*double(*n));
    *max += m;
    *min -= m;
}
开发者ID:rxwatt,项目名称:kst,代码行数:32,代码来源:histogram.cpp


示例5: pushMultipartData

rho::net::CNetResponseWrapper CNetRequestWrapper::pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
{
    VectorPtr<CMultipartItem*> arItems;
    arItems.addElement(&oItem);

    rho::net::CNetResponseWrapper oResp = pushMultipartData(strUrl, arItems, oSession, pHeaders);

    arItems[0] = 0; //do not delete item
    return oResp;
}
开发者ID:CSanshulgandhi,项目名称:rhodes,代码行数:10,代码来源:INetRequest.cpp


示例6: xVector

void Curve::point(int i, double &x, double &y) const {
  VectorPtr xv = xVector();
  if (xv) {
    x = xv->interpolate(i, NS);
  }
  VectorPtr yv = yVector();
  if (yv) {
    y = yv->interpolate(i, NS);
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:10,代码来源:curve.cpp


示例7: getArg

QString DataObjectSI::outputVector(QString& command) {
  QString key = getArg(command);

  VectorPtr vout = _dataObject->outputVector(key);
  if (vout) {
    return vout->shortName();
  } else {
    return "Invalid";
  }

}
开发者ID:Kst-plot,项目名称:kst,代码行数:11,代码来源:dataobjectscriptinterface.cpp


示例8: pushMultipartData

INetResponse* CNetRequest::pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
{
    m_bCancel = false;
    VectorPtr<CMultipartItem*> arItems;
    arItems.addElement(&oItem);

    INetResponse* pResp = pushMultipartData(strUrl, arItems, oSession, pHeaders);

    arItems[0] = 0; //do not delete item
    return pResp;
}
开发者ID:davesims,项目名称:rhodes,代码行数:11,代码来源:NetRequest.cpp


示例9: setVector

void CSD::setVector(VectorPtr new_v) {
  VectorPtr v = _inputVectors[CSD_INVECTOR];
  if (v) {
    if (v == new_v) {
      return;
    }
    v->unlock();
  }

  _inputVectors.remove(CSD_INVECTOR);
  new_v->writeLock();
  _inputVectors[CSD_INVECTOR] = new_v;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:13,代码来源:csd.cpp


示例10: internalUpdate

void CSD::internalUpdate() {

  VectorPtr inVector = _inputVectors[CSD_INVECTOR];

  writeLockInputsAndOutputs();

  double *tempOutput, *input;
  int tempOutputLen = PSDCalculator::calculateOutputVectorLength(_windowSize, _average, _averageLength);
  _length = tempOutputLen;
  tempOutput = new double[tempOutputLen];

  input = inVector->value();

  int xSize = 0;
  for (int i=0; i < inVector->length(); i+= _windowSize) {
    //ensure there is enough data left.
    if (i + _windowSize >= inVector->length()) {
        break; //If there isn't enough left for a complete window.
    }

    _psdCalculator.calculatePowerSpectrum(input + i, _windowSize, tempOutput, tempOutputLen, _removeMean,  false, _average, _averageLength, _apodize, _apodizeFxn, _gaussianSigma, _outputType, _frequency);

    // resize output matrix
    _outMatrix->resize(xSize+1, tempOutputLen);

    if (_outMatrix->sampleCount() == (xSize+1)*tempOutputLen) { // all is well.
      // copy elements to output matrix
      for (int j=0; j < tempOutputLen; j++) {
        _outMatrix->setValueRaw(xSize, j, tempOutput[j]);
      }
    } else {
      Debug::self()->log(i18n("Could not allocate sufficient memory for CSD."), Debug::Error);
      break;
    }

    xSize++;
  }

  delete[] tempOutput;

  double frequencyStep = .5*_frequency/(double)(tempOutputLen-1);

  _outMatrix->change(xSize, tempOutputLen, 0, 0, _windowSize/_frequency, frequencyStep);

  unlockInputsAndOutputs();

  return;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:48,代码来源:csd.cpp


示例11:

/*******************************获取定长数组坐标********************************/
int Jce2Php::getSuffix(const TypeIdPtr &pPtr) const
{
    BuiltinPtr bPtr = BuiltinPtr::dynamicCast(pPtr->getTypePtr());
    if(bPtr && bPtr->kind() == Builtin::KindString && bPtr->isArray())
    {
        return bPtr->getSize();
    }

    VectorPtr vPtr = VectorPtr::dynamicCast(pPtr->getTypePtr());
    if(vPtr && vPtr->isArray())
    {
        return vPtr->getSize();
    }

    return -1;
}
开发者ID:daliniu,项目名称:mobile,代码行数:17,代码来源:jce2php.cpp


示例12: vector

void HistogramTab::generateAutoBin() {

  VectorPtr selectedVector = vector();

  if (selectedVector) {
    selectedVector->readLock(); // Hmm should we really lock here?  AutoBin should I think
    int n;
    double max, min;
    Histogram::AutoBin(selectedVector, &n, &max, &min);
    selectedVector->unlock();

    _numberOfBins->setValue(n);
    _min->setText(QString::number(min));
    _max->setText(QString::number(max));
  }
}
开发者ID:lnickers2004,项目名称:kst,代码行数:16,代码来源:histogramdialog.cpp


示例13: change

void CSD::change(VectorPtr in_V, double in_freq, bool in_average,
    bool in_removeMean, bool in_apodize, ApodizeFunction in_apodizeFxn,
    int in_windowSize, int in_length, double in_gaussianSigma,
    PSDType in_outputType, const QString& in_vectorUnits,
    const QString& in_rateUnits) {

  _inputVectors[CSD_INVECTOR] = in_V;
  QString vecName = in_V ? in_V->Name() : QString();
  _frequency = in_freq;
  _average = in_average;
  _apodize = in_apodize;
  _windowSize = in_windowSize;
  _apodizeFxn = in_apodizeFxn;
  _gaussianSigma = in_gaussianSigma;
  _removeMean = in_removeMean;
  _averageLength = in_length;
  _vectorUnits = in_vectorUnits;
  _rateUnits = in_rateUnits;
  _outputType = in_outputType;

  if (_frequency <= 0.0) {
    _frequency = 1.0;
  }

  updateMatrixLabels();
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:26,代码来源:csd.cpp


示例14: Q_ASSERT

void PSD::setVector(VectorPtr new_v) {
  Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);

  VectorPtr v = _inputVectors[INVECTOR];
  if (v) {
    if (v == new_v) {
      return;
    }
    v->unlock();
  }

  _inputVectors.remove(INVECTOR);
  new_v->writeLock();
  _inputVectors[INVECTOR] = new_v;
  _changed = true;
}
开发者ID:jmlee4301,项目名称:kst,代码行数:16,代码来源:psd.cpp


示例15: Q_ASSERT

void Matrix::createScalars(ObjectStore *store) {
  Q_ASSERT(store);
  ScalarPtr sp;
  VectorPtr vp;

  _scalars.insert("max", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("Max");

  _scalars.insert("min", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("Min");

  _scalars.insert("mean", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("Mean");

  _scalars.insert("sigma", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("Sigma");

  _scalars.insert("rms", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("Rms");

  _scalars.insert("ns", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("NS");

  _scalars.insert("sum", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("Sum");

  _scalars.insert("sumsquared", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("SumSquared");

  _scalars.insert("minpos", sp=store->createObject<Scalar>());
  sp->setProvider(this);
  sp->setSlaveName("MinPos");

  _vectors.insert("z", vp = store->createObject<Vector>());
  vp->setProvider(this);
  vp->setSlaveName("Z");

}
开发者ID:KDE,项目名称:kst-plot,代码行数:46,代码来源:matrix.cpp


示例16: tostr

string TarsAnalyzer::tostrVector(const VectorPtr &pPtr)
{
    //数组类型
    if(pPtr->isArray())
    {
        return tostr(pPtr->getTypePtr());
    }

    //指针类型
    if(pPtr->isPointer())
    {
        return tostr(pPtr->getTypePtr())+" *";
    }

    string s = Builtin::builtinTable[Builtin::KindVector] + string("<") + tostr(pPtr->getTypePtr());

    if(MapPtr::dynamicCast(pPtr->getTypePtr()) || VectorPtr::dynamicCast(pPtr->getTypePtr()))
    {
        s += " >";
    }
    else
    {
        s += ">";
    }
    return s;
}
开发者ID:Blucezhang,项目名称:Tars,代码行数:26,代码来源:tarsAnalyzer.cpp


示例17: TEST

TEST(Arguments, Vector) {
  VectorPtr vector = Vector::create(100, false);
  CheckBufferArg check = [=](const BufferArg& arg) {
    EXPECT_EQ(arg.shape().ndims(), 1U);
    EXPECT_EQ(arg.shape()[0], 100U);
    EXPECT_EQ(arg.data(), vector->getData());

    CpuVector inVector = arg.vector<real, DEVICE_TYPE_CPU>();
    EXPECT_EQ(inVector.getSize(), vector->getSize());
    EXPECT_EQ(inVector.getData(), vector->getData());
  };

  BufferArgs argments;
  argments.addArg(*vector);
  std::vector<CheckBufferArg> checkFunc;
  checkFunc.push_back(check);
  testBufferArgs(argments, checkFunc);
}
开发者ID:youmingwei,项目名称:Paddle,代码行数:18,代码来源:FunctionTest.cpp


示例18: while

void Win32WindowManager::getWindows(VectorPtr<PlatformWindow*> &windows)
{
   Win32Window *win = mWindowListHead;
   while(win)
   {
      windows.push_back(win);
      win = win->mNextWindow;
   }
}
开发者ID:mattparizeau,项目名称:Torque3D-Improvement,代码行数:9,代码来源:win32WindowMgr.cpp


示例19: writeLockInputsAndOutputs

void PSD::internalUpdate() {
  writeLockInputsAndOutputs();

  VectorPtr iv = _inputVectors[INVECTOR];

  const int v_len = iv->length();

  _last_n_new += iv->numNew();
  assert(_last_n_new >= 0);

  int n_subsets = (v_len)/_PSDLength;

  // determine if the PSD needs to be updated.
  // if not using averaging, then we need at least _PSDLength/16 new data points.
  // if averaging, then we want enough new data for a complete subset.
  // ... unless we are counting from end at fixed length (scrolling data).
  bool scrolling_data = (_last_n == iv->length());
  if ( (!_changed) && ((_last_n_new < _PSDLength/16) ||
        (_Average && scrolling_data && (_last_n_new < _PSDLength/16)) ||
        (_Average && !scrolling_data && (n_subsets - _last_n_subsets < 1))) &&
       iv->length() != iv->numNew()) {
    unlockInputsAndOutputs();
    return;
  }

  _changed = false;

  _adjustLengths();

  double *psd = _sVector->value();
  double *f = _fVector->value();

  int i_samp;
  for (i_samp = 0; i_samp < _PSDLength; ++i_samp) {
    f[i_samp] = i_samp * 0.5 * _Frequency / (_PSDLength - 1);
  }
  //f[0] = -1E-280; // really 0 (this shouldn't be needed...)

  _psdCalculator.calculatePowerSpectrum(iv->value(), v_len, psd, _PSDLength, _RemoveMean,  _interpolateHoles, _Average, _averageLength, _Apodize, _apodizeFxn, _gaussianSigma, _Output, _Frequency);

  _last_n_subsets = n_subsets;
  _last_n_new = 0;
  _last_n = iv->length();

  updateVectorLabels();

  // should be updated by the update manager
  //_sVector->update();
  //_fVector->update();

  unlockInputsAndOutputs();

  return;
}
开发者ID:jmlee4301,项目名称:kst,代码行数:54,代码来源:psd.cpp


示例20: indexNearX

inline int indexNearX(double x, VectorPtr& xv, int NS) {
  // monotonically rising: we can do a binary search
  // should be reasonably fast
  if (xv->isRising()) {
    int i_top = NS - 1;
    int i_bot = 0;

    // don't pre-check for x outside of the curve since this is not
    // the common case.  It will be correct - just slightly slower...
    while (i_bot + 1 < i_top) {
      int i0 = (i_top + i_bot)/2;
      double rX = xv->interpolate(i0, NS);
      if (x < rX) {
        i_top = i0;
      } else {
        i_bot = i0;
      }
    }
    double xt = xv->interpolate(i_top, NS);
    double xb = xv->interpolate(i_bot, NS);
    if (xt - x < x - xb) {
      return i_top;
    } else {
      return i_bot;
    }
  } else {
    // Oh Oh... not monotonically rising - we have to search the entire curve!
    // May be unbearably slow for large vectors
    double rX = xv->interpolate(0, NS);
    double dx0 = fabs(x - rX);
    int i0 = 0;

    for (int i = 1; i < NS; ++i) {
      rX = xv->interpolate(i, NS);
      double dx = fabs(x - rX);
      if (dx < dx0) {
        dx0 = dx;
        i0 = i;
      }
    }
    return i0;
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:43,代码来源:curve.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VectorRn类代码示例发布时间:2022-05-31
下一篇:
C++ VectorOfFloatArray类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap