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


C++ setEntry函数代码示例

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


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

示例1: main

int main( int argc, char **argv ) {
  int size = 256;
  // generate a symmetric, positive definite matrix
  double *M = (double *) malloc( size*size*sizeof(double) );
  fill( M, size*size);  
  double *Afull = (double *) malloc( size*size*sizeof(double) );
  char T = 'T', N = 'n';
  double one = 1., zero = 0.;
  dgemm_( &T, &N, &size, &size, &size, &one, M, &size, M, &size, &zero, Afull, &size );
  double *A = (double *) malloc( size*(size+1)/2*sizeof(double) );
  double *Acopy = (double *) malloc( size*(size+1)/2*sizeof(double) );
  for( int r = 0; r < size; r++ )
    for( int c = 0; c <= r; c++ ) {
      setEntry(A, size, r, c, Afull[r*size+c]);
      setEntry(Acopy, size, r, c, Afull[r*size+c], size);
    }
  //printMatrix(Afull,size);
  double startTime = read_timer();
  chol(A,size);
  double endTime = read_timer();
  printf("Time %f Gflop/s %f\n", endTime-startTime, size*size*size/3./(endTime-startTime)/1.e9); 
  int info = 0;
  char L = 'L';
  startTime = read_timer();
  dpptrf_( &L, &size, Acopy, &info);
  endTime = read_timer();
  printf("dpptrf Time %f Gflop/s %f\n", endTime-startTime, size*size*size/3./(endTime-startTime)/1.e9); 
  printf("info is %d, size is %d\n", info, size );
  startTime = read_timer();
  dpotrf_( &L, &size, Afull, &size, &info);
  endTime = read_timer();
  printf("dpotrf Time %f Gflop/s %f\n", endTime-startTime, size*size*size/3./(endTime-startTime)/1.e9); 
  //printMatrix(Afull,size);

  double maxDev = 0.;
  /*
  for( int r = 0; r < size; r++ )
    for( int c = 0; c <= r; c++ ) {
      maxDev = max(maxDev,fabs(Afull[r*size+c]-getEntry(A,size,r,c)));
      Afull[r*size+c] = getEntry(A,size,r,c);
    }
  */
  for( int r = 0; r < size; r++ )
    for( int c = 0; c < size; c++ ) {
      maxDev = max(maxDev,fabs(getEntry(Acopy,size,r,c,size)-getEntry(A,size,r,c)));
      //      Afull[r*size+c] = getEntry(Acopy,size,r,c,size);
    }
  //printMatrix(Afull,size);
  printf("Max deviation: %f\n", maxDev);
  //for( int r = 0; r < size; r++ )
  //  for( int c = 0; c < size; c++ ) {
  //    Afull[r*size+c] = getEntry(A,size,r,c);
  //  }
  //printMatrix(Afull,size);
  return 0;
}
开发者ID:benjamingr,项目名称:CAPS,代码行数:56,代码来源:sequential.cpp

示例2: RowNotFound

void Matrix::ero_3(int row_1, int row_2)
{
	if(row_1 < 0 || row_1 >= getRow() || row_2 < 0 || row_2 >= getRow())
		throw RowNotFound();
	for(int j = 0; j < getColumn(); j++)
	{
		T temp = getEntry(row_1, j);
		setEntry(row_1, j, getEntry(row_2, j));
		setEntry(row_2, j, temp);
	}
}
开发者ID:Hamid255,项目名称:Matrix,代码行数:11,代码来源:Matrix.cpp

示例3: setEntry

void Setup_Colors::cancel()
{
    userPalette->rollback();
    int type = userPalette->getColorTypeAt(mSelected);
    const gcn::Color *col = &userPalette->getColor(type);
    mGradTypeSlider->setValue(userPalette->getGradientType(type));
    const int delay = userPalette->getGradientDelay(type);
    setEntry(mGradDelaySlider, mGradDelayText, delay);
    setEntry(mRedSlider, mRedText, col->r);
    setEntry(mGreenSlider, mGreenText, col->g);
    setEntry(mBlueSlider, mBlueText, col->b);
}
开发者ID:Ablu,项目名称:invertika,代码行数:12,代码来源:setup_colors.cpp

示例4: switch

void Setup_Colors::valueChanged(const gcn::SelectionEvent &event)
{
    mSelected = mColorBox->getSelected();
    int type = userPalette->getColorTypeAt(mSelected);
    const gcn::Color *col = &userPalette->getColor(type);
    Palette::GradientType grad = userPalette->getGradientType(type);
    const int delay = userPalette->getGradientDelay(type);

    mPreview->clearRows();
    mPreviewBox->setContent(mTextPreview);
    mTextPreview->setFont(boldFont);
    mTextPreview->setTextColor(col);
    mTextPreview->setTextBGColor(NULL);
    mTextPreview->setOpaque(false);
    mTextPreview->setShadow(true);
    mTextPreview->setOutline(true);
    mTextPreview->useTextAlpha(false);

    switch (type)
    {
        case UserPalette::PARTICLE:
        case UserPalette::EXP_INFO:
        case UserPalette::PICKUP_INFO:
        case UserPalette::HIT_PLAYER_MONSTER:
        case UserPalette::HIT_MONSTER_PLAYER:
        case UserPalette::HIT_CRITICAL:
        case UserPalette::MISS:
            mTextPreview->setShadow(false);
    }

    if (grad != Palette::STATIC && grad != Palette::PULSE)
    { // If nonstatic color, don't display the current, but the committed
      // color at the sliders
        col = &userPalette->getCommittedColor(type);
    }
    else if (grad == Palette::PULSE)
    {
        col = &userPalette->getTestColor(type);
    }

    setEntry(mGradDelaySlider, mGradDelayText, delay);
    setEntry(mRedSlider, mRedText, col->r);
    setEntry(mGreenSlider, mGreenText, col->g);
    setEntry(mBlueSlider, mBlueText, col->b);

    mGradTypeSlider->setValue(grad);
    updateGradType();
    mGradTypeSlider->setEnabled(true);
}
开发者ID:Ablu,项目名称:invertika,代码行数:49,代码来源:setup_colors.cpp

示例5: appendNewFacets

static list_t appendNewFacets(zhull_t * const zh, const size_t num_facets)
{
  facet_t *new_facet;
  index_t i;
  entry_t e0=entry_makeIndex(0);
  list_t new_facets;

  new_facets=initConstantList(e0, num_facets);

  for (i=0; i<getLength(new_facets); i++) {
    new_facet = (facet_t*) malloc(sizeof(facet_t));
    if (new_facet==0) {
      break;
    }
    new_facet->neighbors=emptyList();
    new_facet->corners=emptyList();
    new_facet->outsideset=emptyList();
    new_facet->insideset=emptyList();
    new_facet->maxdistance=0;
    new_facet->farthest_outside_point=0;
    //        printf("%li, %li\n", new_facet, entry_makePointer(new_facet));
    setEntry(new_facets,i,entry_makePointer(new_facet));
    //        printf("created facet %li\n",new_facet);
  }
  appendListToList(&(zh->facets),new_facets);
  return new_facets;
}
开发者ID:iem-projects,项目名称:pd-iemmatrix,代码行数:27,代码来源:zhull.c

示例6: setEntry

// ------------------------------------------------------------------
bool
JcnModel::addEntry(JcnCalc & trg,
					JcnCalc & src,
					int f_matchMask,
					int b_matchMask,
					int fb_matchMask					
					)
{
	if (jcndbg)
		std::cout << "JcnModel::addEntry: " << trg.text() << std::endl;

	EntryMap_itr_t itr = _entryMap.find(trg.text());
	if ( itr == _entryMap.end())
	{
		int mask = 0;

		trg.match(src, mask, f_matchMask, b_matchMask, fb_matchMask);

		_entryMap.insert(std::make_pair(trg.text(), trg));
		
		return setEntry(trg);
	}
	else
	{
		return -1;
	}
}
开发者ID:AwakenedOne,项目名称:qjcn,代码行数:28,代码来源:JcnModel.cpp

示例7: setId

House::House(uint32 hId, const std::string &name, const Position &pos)
{
    setId(hId);
    setName(name);
    if(pos.isValid())
        setEntry(pos);
}
开发者ID:Nekro123,项目名称:otclient,代码行数:7,代码来源:houses.cpp

示例8: setJobWalltime

/**
 * @brief Calculate the walltime for a job.
 *
 * @param job The job to set the walltime for.
 *
 * @return No return value.
 */
static void setJobWalltime(Job_t *job)
{
    time_t now = time(NULL);
    time_t wspan=0, whour=0, wmin=0, wsec=0;
    char walltime[100];

    if (!job) {
	mlog("%s: invalid job!\n", __func__);
	return;
    }

    if (!job->start_time || job->start_time > now) {
	mlog("%s: walltime calc error\n", __func__);
	return;
    }

    wspan = now - job->start_time;
    job->res.walltime = wspan;

    whour = wspan / 3600;
    wspan = wspan % 3600;
    wmin = wspan / 60;
    wsec = wspan % 60;

    snprintf(walltime, 100, "%02zu:%02zu:%02zu", whour, wmin, wsec);
    setEntry(&job->status.list, "resources_used", "walltime", walltime);
}
开发者ID:ParaStation,项目名称:psmgmt,代码行数:34,代码来源:psmomacc.c

示例9: setEntry

void ArpCache::receivedArpMine(folly::IPAddressV4 ip,
                               folly::MacAddress mac,
                               PortID port,
                               ArpOpCode op) {
  // always set an entry, even if the reply was unsolicited
  setEntry(ip, mac, port, NeighborEntryState::REACHABLE);
}
开发者ID:HengWang,项目名称:fboss,代码行数:7,代码来源:ArpCache.cpp

示例10: setEntry

Board::Board()
{
	for (int row = 0; row < MAX_SIZE; ++row) {
		for (int col = 0; col < MAX_SIZE; ++col) {
			setEntry(row, col, '.');
		}
	}
}
开发者ID:catalinp86,项目名称:TicTacToe,代码行数:8,代码来源:Board.cpp

示例11: set

bool Settings::set(const std::string &name, const std::string &value)
{
	if (!setEntry(name, &value, false, false))
		return false;

	doCallbacks(name);
	return true;
}
开发者ID:blockplanet,项目名称:blockplanet,代码行数:8,代码来源:settings.cpp

示例12: TilePtr

House::House(uint32 hId, const std::string &name, const Position &pos)
{
    m_nullTile = TilePtr(new Tile(Position()));
    setId(hId);
    setName(name);
    if(pos.isValid())
        setEntry(pos);
}
开发者ID:DominikMS,项目名称:otclient,代码行数:8,代码来源:houses.cpp

示例13: emberAfRf4ceMsoIrRfDatabaseOriginatorSet

EmberStatus emberAfRf4ceMsoIrRfDatabaseOriginatorSet(EmberAfRf4ceMsoKeyCode keyCode,
                                                     const EmberAfRf4ceMsoIrRfDatabaseEntry *entry)
{
  uint8_t index = getEntryIndex(keyCode);
  if (index == 0xFF) {
    return EMBER_NOT_FOUND;
  }
  return setEntry(index, entry);
}
开发者ID:taidalab,项目名称:ZigBeeember570,代码行数:9,代码来源:rf4ce-mso-ir-rf-database-originator.c

示例14: fileSnapshot

/* assumes hold elk */
int
fileSnapshot(File *dst, File *src, u32int epoch, int doarchive)
{
	Entry e, ee;

	/* add link to snapshot */
	if(!getEntry(src->source, &e, 1) || !getEntry(src->msource, &ee, 1))
		return 0;

	e.snap = epoch;
	e.archive = doarchive;
	ee.snap = epoch;
	ee.archive = doarchive;

	if(!setEntry(dst->source, &e) || !setEntry(dst->msource, &ee))
		return 0;
	return 1;
}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:19,代码来源:file.c

示例15: bfsFindExit

void bfsFindExit(Maze &M)
{
	queue <Position> Q;
	
	vector<vector<Position> > pred;
	init_table(pred, M.size, NULLPOS);
	Position current, nbr;
	stack<Position> path;
	current = M.start;
	M.visit(current);
	Q.push(current);
	
	while (true)
	{
		/* First condition if the current position is the exit*/
		if (current == M.exitpos)
		{
			cout << endl;
			printPath(pred, current);
			return;

		}
		/* Checking if current is a wall*/
		if (current == NULLPOS)
		{
			cout << "Now way out" << endl;
			return;

		}
		/* Getting the first open neighbor */
		nbr = M.getOpenNeighbor(current);
		/* If neighbor is a wall*/
		if (nbr == NULLPOS)
		{
			Q.pop();
			current = Q.front();
			
			continue;
		}
		/* Otherwise set entry and visit neighbor*/
		else
		{
			setEntry(pred, nbr, current);
			M.visit(nbr);
			current = nbr;
			Q.push(nbr);
		}

		
		

	}
	
	
	system("PAUSE");

}
开发者ID:amertheengineer,项目名称:Personal,代码行数:57,代码来源:BFS+Algo.cpp


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