示例#1
0
/**
 * Exclude i th sample where i is index stored in @param index
 * from @param vin, @param phenotypeNameInOrder, @param phenotypeInOrder
 * and @param cov
 * @return 0 if succeed
 */
int excludeSamplesByIndex(const std::vector<int>& index, GenotypeExtractor* ge,
                          std::vector<std::string>* phenotypeNameInOrder,
                          std::vector<double>* phenotypeInOrder, Matrix* cov) {
  if (!ge || !phenotypeNameInOrder || !phenotypeInOrder || !cov) {
    return -1;
  }

  ge->excludePeople((*phenotypeNameInOrder), index);
  removeByIndex(index, phenotypeNameInOrder);
  removeByIndex(index, phenotypeInOrder);
  removeByRowIndex(index, cov);

  return 0;
}
示例#2
0
int TextMatrix::keepCol(const std::vector<std::string>& name) {
  const int nc = ncol();
  const int nr = nrow();

  std::vector<int> indexToRemove;
  std::set<std::string> keep;
  makeSet(name, &keep);

  for (int i = 0; i < nc; ++i) {
    if (keep.count(colName[i])) continue;
    indexToRemove.push_back(i);
  }

  removeByIndex(indexToRemove, &colName);
  for (int i = 0; i < nr; ++i) {
    removeByIndex(indexToRemove, &mat[i]);
  }
  return 0;
}
示例#3
0
int DataLoader::useSexAsCovariate() {
  std::vector<int> index;  // mark missing samples
  int numMissing = findMissingSex(sex, &index);
  logger->info("Exclude %d samples with missing sex", numMissing);
  removeByIndex(index, &sex);

  phenotype.dropRow(index);
  covariate.dropRow(index);
  covariate.appendCol(sex, "Sex");

  // excludeSamplesByIndex(index, &ge, &phenotypeNameInOrder, &phenotypeInOrder,
  //                       &covariate);
  // // appendToMatrix("Sex", sex, &covariate);
  return 0;
}
示例#4
0
void makeBasicScheduling(Core* core, List* alreadyQueue, int policy)
{
	Job* job;

	switch (policy)
	{
		case ROUND_ROB: 
			job = (Job*) get(*alreadyQueue, 0)->value;
			removeByIndex(alreadyQueue, 0);
			break;

		default:
			/*obtém o job que mais atendeu o critério de escalonamento*/
			job = getGreatestCriterionJob(alreadyQueue);
			break;
	
	}

	//if(job != NULL)
	assignToCore(core, job);
}
示例#5
0
	// -------------------------------------------------------
	// 
	// -------------------------------------------------------
	void ScalingAction::update(SpriteArray& array,float dt,ActionEventBuffer& buffer) {
		if (_buffer.size > 0) {
			// move
			for (int i = 0; i < _buffer.size; ++i) {
				array.scale(_ids[i], tweening::interpolate(_tweeningTypes[i], _startScale[i], _endScale[i], _timers[i], _ttl[i]));
				_timers[i] += dt;
				if ( _timers[i] >= _ttl[i] ) {
					if ( _modes[i] < 0 ) {
						_timers[i] = 0.0f;
					}
					else if ( _modes[i] == 0 ) {
						array.scale(_ids[i],_endScale[i]);
						buffer.add(_ids[i], AT_SCALE, array.getType(_ids[i]));
						removeByIndex(i);
					}
					else {
						--_modes[i];
						_timers[i] = 0.0f;

					}
				}
			}
		}
	}
示例#6
0
void copyRemoveByIndex(std::vector<T>& vals,
                 std::vector<T>& newVals,
                 const std::tr1::unordered_set<size_t> &indices) {
  copyByIndex(vals, newVals, indices);
  removeByIndex(vals, indices);
}