int isSubset(node *tree, node *tree2) { if (tree == NULL || tree2 == NULL) return 0; else if (tree->key == tree2->key ) return 1; else return ((isSubset(tree, tree2->left)) || (isSubset(tree,tree2->right))); }
void SBTarget::resolveVCProjectDependecies(VCProject* proj, std::multimap<SBTarget*, VCProject*>& vcProjects) { // Get the VCProject's platforms StringSet platforms; proj->getPlatforms(platforms); // Iterate over the target's dependencies for (auto dep : m_dependencies) { // Find all VCProjects generated from the SBTarget auto possibleDeps = vcProjects.equal_range(dep); // Look for the best-matching VCProject // BIG ASSUMPTION: Projects will have distinct platform sets, so only one match exists VCProject* match = NULL; for (auto it = possibleDeps.first; it != possibleDeps.second; ++it) { VCProject* depVCProject = it->second; StringSet depPlatforms; depVCProject->getPlatforms(depPlatforms); if (isSubset(platforms, depPlatforms)) { match = depVCProject; break; } } sbAssert(match); proj->addProjectReference(match); } }
bool Itemset::isGenerator(ItemsetTable& itemsetTable){ /* check if it is genertor: all support(subset) must be greater than its support if itemset len = 1 than it must me a generator */ int itemsetLen = itemset.size(); if( itemsetLen > 1 ){ Itemset* itemsetCursor = itemsetTable.headList[ itemsetLen-1 ]; while(itemsetCursor){ if( isSubset(itemsetCursor->itemset) && itemsetCursor->support == support ) return false; itemsetCursor = itemsetCursor->next; } } return true; }
bool GJKSimplex::computeClosestPoint(Vector3d& v) { Bits subset; // For each possible simplex set for (subset=m_bitsCurrentGJKSimplex; subset != 0; subset--) { // If the simplex is a subset of the current simplex and is valid for the Johnson's // algorithm test if (isSubset(subset, m_bitsCurrentGJKSimplex) && isValidSubset(subset | m_lastFoundBit)) { // Add the last added point to the current simplex m_bitsCurrentGJKSimplex = subset | m_lastFoundBit; // Compute the closest point in the simplex v = computeClosestPointForSubset(m_bitsCurrentGJKSimplex); return true; } } // If the simplex that contains only the last added point is valid for the Johnson's algorithm test if (isValidSubset(m_lastFoundBit)) { // Set the current simplex to the set that contains only the last added point m_bitsCurrentGJKSimplex = m_lastFoundBit; // Update the maximum square length m_maxLengthSquare = m_pointsLengthSquare[m_lastFound]; // The closest point of the simplex "v" is the last added point v = m_points[m_lastFound]; return true; } // The algorithm failed to found a point return false; }
bool isSubgroup(const std::set<T>& elems) const { if (elems.empty() || !isSubset(elems)) return false; for (const T& x: elems) { for (const T& y: elems) { if (elems.count(oper(x,y)) == 0) return false; } } return true; }
bool isA(Object* object,const ObjectType& type) { if(type.kind != object->kind) { return false; } switch(type.kind) { case ObjectKind::function: return type.function == asFunction(object)->type; case ObjectKind::global: return type.global == asGlobal(object)->type; case ObjectKind::table: { auto table = asTable(object); return type.table.elementType == table->type.elementType && isSubset(type.table.size,table->type.size); } case ObjectKind::memory: { auto memory = asMemory(object); return isSubset(type.memory.size,memory->type.size); } default: Core::unreachable(); } }
int main(int argc,char *argv[]){ node *tree = NULL; node *tree2 = NULL; tree = getNumbers(tree); tree2 = getNumbers(tree2); if(isSubset(tree,tree2) == 1) printf("Tree 2 is a subset of Tree 1."); else printf("Tree 2 is not a subset of Tree 1."); freeTree(tree); freeTree(tree2); return 0; }
/*Driver program to test above functions */ int main() { int arr1[] = {11, 1, 13, 21, 3, 7}; int arr2[] = {11, 3, 7, 1}; int m = sizeof(arr1)/sizeof(arr1[0]); int n = sizeof(arr2)/sizeof(arr2[0]); if(isSubset(arr1, arr2, m, n)) printf("arr2[] is subset of arr1[] "); else printf("arr2[] is not a subset of arr1[] "); return 0; }
void GlobalGrid::makeBalanceWeights(){ int num_tensors = tensorList->getNumIndexes(); if ( tensor_weights != 0 ){ delete[] tensor_weights; } tensor_weights = new int[ num_tensors ]; tzero( num_tensors, tensor_weights ); int max_level = computeMaxLevel(); for( int l = max_level; l>=0; l-- ){ for( int i=0; i<num_tensors; i++ ){ const int *iList = tensorList->getIndexList(i); if ( tsum( num_dimensions, iList ) == l ){ // set the current level tensor_weights[i] = 1 - tensor_weights[i]; for( int j=0; j<num_tensors; j++ ){ if ( (i!=j) && (isSubset(tensorList->getIndexList(j), iList)) ){ tensor_weights[j] += tensor_weights[i]; } } } } } }
removeSubSetPole() { // printArray(colsum, P); int i =0 ; int j =0; int s=0; //printf("remove subset poles: \n"); for (i =0;i<P-1;i++) { for (j =i+1;j<P;j++) { int t = isSubset(pmap[i], pmap[j], msize); if(t==1) { // printf("pole %d is a subset of %d\n", i,j); // printf("%d ", i); removePoleLink(i); s=1; //printNeighbor(pmap[i], M); } } } // printf("\n"); return s; }
static pair<bitset<MAX>, bitset<MAX> > nextClos(const vector<bitset<MAX> > in, BitObj &cur, int i, int num_obs) { bitset<MAX> inter, res, old_inter; res.flip(); cur.A = calcInter(cur.A, i); old_inter = cur.A; if (!cur.A[i]) { //set union cur.A.set(i); } for (int j = 0; j < in.size(); ++j) { //store common attributes in res if (cur.A[j]) res &= in[j]; } for (int j = 0; j < in.size(); ++j) { //find extent if (!cur.A[j] && isSubset(in[j], res)) { cur.A.set(j); } } return make_pair(old_inter, res); //pair(extent, intent) }
void findEdges(vector<BitObj*> &extents, vector<bitset<MAX> > &relation, ofstream &edges) { sort(extents.begin(), extents.end(), BComp); cout << "\nSorted concepts:\n"; for (auto e : extents) { printObj(e->A, cout, (int)extents.size()); } for (int i = 0; i < extents.size(); ++i) { for (int j = i + 1; j < extents.size(); ++j) { if (isSubset(extents[j]->A, extents[i]->A)) { relation[i].set(j); //i is a subset of j } } } for (int k = 0; k < relation.size(); ++k) { for (int i = 0; i < relation.size(); ++i) { for (int j = 0; j < relation.size(); ++j) { if (relation[i][j]) { if (relation[i][k] && relation[k][j]) { relation[i].set(j, false); } } } } } cout << "\nWriting edges to edges.txt...\n"; for (int i = 0; i < relation.size(); ++i) { for (int j = 0; j < relation.size(); ++j) { if (relation[i][j]) { if (extents[i]->weight < extents[j]->weight) { extents[i]->parents.push_back(extents[j]); extents[j]->children.push_back(extents[i]); } edges << i << ' ' << j << '\n'; } } } edges.close(); }
int main(int argc, char** argv){ //srand will force the random numbers to be always the same, so we can verify that our code works //normally we would want them to be different. srand(100); struct DataSet* setA; setA = allocDataSet(); struct DataSet* setB; setB = allocDataSet(); int i = 0; for(i = 0; i < 30; ++i){ Byte element = rand() % 20; appendDataSet(setA, element); Byte event = rand() % 100; if(event < 30){ //30% of chance of repeating the same number appendDataSet(setB, element); } else if(event < 65){ //65% of chance of adding a different element //event should be a number between 0 and 99 //make it between 0 and 49 included appendDataSet(setB, event % 50); } else{ //C requires an else, even if it is empty, //this else does nothing, so setB could be smaller than setA } } //Data has been initialized, now lets test the other methods //Print printf("SET A IS:\n"); printDataSet(setA); printf("SET B IS:\n"); printDataSet(setB); //Union (notice that union is another C keyword), //actually what is does is like a struct, //but guarantees the block will be put right after the other //in this class you dont need to know it, but once more, if you want to learn struct DataSet* unionSet; unionSet = unionDataSet(setA, setB); printf("A UNION B:\n"); printDataSet(unionSet); //Intersection struct DataSet* intersectionSet; intersectionSet = intersectionDataSet(setA, setB); printf("A INTERSECTION B:\n"); printDataSet(intersectionSet); //Set difference struct DataSet* diffSet; diffSet = diffDataSet(setA, setB); printf("A DIFF B:\n"); printDataSet(diffSet); //Subset Test struct DataSet* subsetTest; subsetTest = subset(unionSet, 3, 7); printf("ORIGINAL SET:\n"); printDataSet(unionSet); printf("SUBSET:\n"); printDataSet(subsetTest); printf("subsetTest %s a subset of unionSet\n", isSubset(subsetTest, unionSet) ? "IS" : "IS NOT"); printf("unionSet %s a subset of subsetSet\n", isSubset(unionSet, subsetTest) ? "IS" : "IS NOT"); struct DataSet* emptySet = allocDataSet(); //no data added so it should be the nullSet printf("THE EMPTY SET LOOKS LIKE:\n"); printDataSet(emptySet); printf("emptySet %s equal to the NULL set\n", isNull(emptySet) ? "IS" : "IS NOT"); struct DataSet* reverseSet = allocDataSet(); for(i = unionSet->length - 1; i >= 0; --i){ appendDataSet(reverseSet, unionSet->data[i]); } printf("reverseSet %s equal unionSet\n", equals(unionSet, reverseSet) ? "IS" : "IS NOT"); printf("reverseSet %s %u\n", contains(reverseSet, unionSet->data[0]) ? "CONTAINSS" : "DOES NOT CONTAIN", unionSet->data[0]); printDataSet(reverseSet); //Statistics: printf("ORGINAL SET FOR STATISTICS:\n"); printDataSet(unionSet); printf("Min value %u\n", unionSet->min); printf("Max value %u\n", unionSet->max); printf("Avg value %f\n", AverageDataSet(unionSet)); printf("Range value %u\n", RangeDataSet(unionSet)); //Release the DataSets resources after finish their usage. releaseDataSet(setA); releaseDataSet(setB); return 0; }
huReturn hookUp(const vector<SplitEdge> &g, int s, vector<SplitEdge> &bIn, int k, vector<vector<int>> &Y, historyIndex &h) { if (cG(s, g) != 0) { cout << "cG(s) problem in hookup" << endl; throw logic_error(""); } vector<SplitEdge> H = g; vector<SplitEdge> G1 = g; vector<SplitEdge> B = bIn; vector<SplitEdge> B1; vector<vector<int>> XS; int maxNodeInd = getMaxNodeInd(G1); for (int i = 0; i < maxNodeInd; i++) XS.push_back(vector<int>()); for (int i = 0; i < maxNodeInd; i++) XS[i].push_back(i); //cout << "About to enter while loop" << endl; while (getNumUsedNodes(H) >= 4) { vector<int> ma = maOrderingHeap(H, s); int v = ma[ma.size() - 2]; int w = ma[ma.size() - 1]; if (v == s || w == s) throw logic_error("SET WAS V - S, S FOUND"); vector<int> X1; H = combineVertices(H, v, w); H = compress(H); XS[v] = setUnion(XS[v], XS[w]); if (XS[w].size() == 0) { cout << "Error: W, " << w << " was merged twice. Quitting" << endl; throw logic_error(""); } XS[w] = vector<int>(); if (cG(v, H) < k) { int numToGet = (int)ceil(.5*(double(k) - double(cG(G1, XS[v])))); vector<SplitEdge> GX = inducedSubgraph(G1, XS[v]); vector<SplitEdge> delB; int added = 0; for (unsigned i = 0; i < GX.size(); i++) { SplitEdge e = SplitEdge(GX[i].end0, GX[i].end1, GX[i].weight, GX[i].orig0, GX[i].orig1); if (isMem(e, B)) { int bW = B[indexOfEdge(B, e.end0, e.end1)].weight; if (bW < e.weight) e.weight = bW; if (e.weight > (numToGet - added)) { e.weight = numToGet - added; } added += e.weight; delB.push_back(e); } if (added == numToGet) break; } if (added != numToGet) { cout << "Error: GX did not contain " << numToGet << " entries in B. Quitting." << endl; throw logic_error(""); } if (!isSubset(delB, B)) { cout << "ERROR: delB is not a subset of B." << endl; cout << "B:" << endl; output(B); cout << "delB:" << endl; output(delB); cout << "This was the GX to choose from:" << endl; output(GX); cout << "V: " << v << endl; cout << "W: " << w << endl; cout << "S: " << s << endl; throw logic_error(""); } B = setRemove(delB, B); B = removeZeroWeighted(B); B1 = setUnion(delB, B1); H = removeZeroWeighted(H); G1 = hookUpHelper(s, G1, delB, h); G1 = removeZeroWeighted(G1); H = removeZeroWeighted(H); bool addedFromXSinH = false; numToGet *= 2; for (unsigned i = 0; i < H.size(); i++) { SplitEdge tester = SplitEdge(s, v, 0, 0, 0); if (equals(tester, H[i])) { //cout << "Increasing weight in hookUp in H between " << H[i].end0 << " and " << H[i].end1 << "from " << H[i].weight << " to " << H[i].weight + numToGet << endl; H[i].weight += numToGet; addedFromXSinH = true; break; } } if (!addedFromXSinH && numToGet != 0) { //cout << "Creating edge in hookUp in H between " << s << " and " << v << " with weight " << numToGet << endl; SplitEdge e(s, v, numToGet, s, v); H.push_back(e); } vector<vector<int>> newY; for (unsigned i = 0; i < Y.size(); i++) { if (!isProperSubset(Y[i], XS[v])) newY.push_back(Y[i]); } bool foundX1inY = false; for (unsigned i = 0; i < newY.size(); i++) { if (setsEqual(newY[i], XS[v])) foundX1inY = true; } if (!foundX1inY) newY.push_back(XS[v]); Y = newY; } } huReturn ret; ret.BP = B1; ret.G1 = G1; ret.Y = Y; return ret; }
void UnnecessaryValueParamCheck::check(const MatchFinder::MatchResult &Result) { const auto *Param = Result.Nodes.getNodeAs<ParmVarDecl>("param"); const auto *Function = Result.Nodes.getNodeAs<FunctionDecl>("functionDecl"); const size_t Index = std::find(Function->parameters().begin(), Function->parameters().end(), Param) - Function->parameters().begin(); bool IsConstQualified = Param->getType().getCanonicalType().isConstQualified(); // Skip declarations delayed by late template parsing without a body. if (!Function->getBody()) return; // Do not trigger on non-const value parameters when: // 1. they are in a constructor definition since they can likely trigger // misc-move-constructor-init which will suggest to move the argument. if (!IsConstQualified && (llvm::isa<CXXConstructorDecl>(Function) || !Function->doesThisDeclarationHaveABody())) return; auto AllDeclRefExprs = utils::decl_ref_expr::allDeclRefExprs( *Param, *Function->getBody(), *Result.Context); auto ConstDeclRefExprs = utils::decl_ref_expr::constReferenceDeclRefExprs( *Param, *Function->getBody(), *Result.Context); // 2. they are not only used as const. if (!isSubset(AllDeclRefExprs, ConstDeclRefExprs)) return; // If the parameter is non-const, check if it has a move constructor and is // only referenced once to copy-construct another object or whether it has a // move assignment operator and is only referenced once when copy-assigned. // In this case wrap DeclRefExpr with std::move() to avoid the unnecessary // copy. if (!IsConstQualified) { auto CanonicalType = Param->getType().getCanonicalType(); if (AllDeclRefExprs.size() == 1 && ((utils::type_traits::hasNonTrivialMoveConstructor(CanonicalType) && utils::decl_ref_expr::isCopyConstructorArgument( **AllDeclRefExprs.begin(), *Function->getBody(), *Result.Context)) || (utils::type_traits::hasNonTrivialMoveAssignment(CanonicalType) && utils::decl_ref_expr::isCopyAssignmentArgument( **AllDeclRefExprs.begin(), *Function->getBody(), *Result.Context)))) { handleMoveFix(*Param, **AllDeclRefExprs.begin(), *Result.Context); return; } } auto Diag = diag(Param->getLocation(), IsConstQualified ? "the const qualified parameter %0 is " "copied for each invocation; consider " "making it a reference" : "the parameter %0 is copied for each " "invocation but only used as a const reference; " "consider making it a const reference") << paramNameOrIndex(Param->getName(), Index); // Do not propose fixes when: // 1. the ParmVarDecl is in a macro, since we cannot place them correctly // 2. the function is virtual as it might break overrides // 3. the function is referenced outside of a call expression within the // compilation unit as the signature change could introduce build errors. const auto *Method = llvm::dyn_cast<CXXMethodDecl>(Function); if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()) || isReferencedOutsideOfCallExpr(*Function, *Result.Context)) return; for (const auto *FunctionDecl = Function; FunctionDecl != nullptr; FunctionDecl = FunctionDecl->getPreviousDecl()) { const auto &CurrentParam = *FunctionDecl->getParamDecl(Index); Diag << utils::fixit::changeVarDeclToReference(CurrentParam, *Result.Context); // The parameter of each declaration needs to be checked individually as to // whether it is const or not as constness can differ between definition and // declaration. if (!CurrentParam.getType().getCanonicalType().isConstQualified()) Diag << utils::fixit::changeVarDeclToConst(CurrentParam); } }
//Downloads the data (train, validation, test sets) into memory following specifications //in the attr file. //filenames may be empty strings, if correspondent data is not provided INDdata::INDdata(const char* trainFName, const char* validFName, const char* testFName, const char* attrFName, bool doOut) { LogStream clog; //read attr file, collect info about boolean attributes and attrN clog << "Reading the attribute file: \"" << attrFName << "\"\n"; fstream fattr; fattr.open(attrFName, ios_base::in); if(!fattr) throw OPEN_ATTR_ERR; char buf[LINE_LEN]; //buffer for reading from input files getLineExt(fattr, buf); //read list of attributes, collect information about them int attrId, colNo; // counters string tarName; //name of the response attribute bool foundClass = false; //response found flag weightColNo = -1; for(attrId = 0, colNo = 0; fattr.gcount(); attrId++, colNo++) { string attrStr(buf); //a line of an attr file (corresponds to 1 attribute) //check for response attribute if(attrStr.find("(class)") != string::npos) { if(foundClass) throw MULT_CLASS_ERR; tarColNo = colNo; attrId--; foundClass = true; string::size_type nameLen = attrStr.find(":"); tarName = attrStr.substr(0, nameLen); getLineExt(fattr, buf); continue; } if(attrStr.find("(weight)") != string::npos) { weightColNo = colNo; attrId--; getLineExt(fattr, buf); continue; } //parse attr name string::size_type nameLen = attrStr.find(":"); if((attrStr.find("contexts") != -1) || (nameLen == -1)) break; //end of listed attributes string attrName = attrStr.substr(0, nameLen); if(attrName.find_first_of("\\/*?\"<>|:") != string::npos) throw ATTR_NAME_DEF_ERR; attrNames.push_back(trimSpace(attrName)); //parse attr type string::size_type endType = attrStr.find("."); string typeStr = attrStr.substr(nameLen + 1, endType - nameLen - 1); typeStr = trimSpace(typeStr); if(typeStr.compare("0,1") == 0) boolAttrs.insert(attrId); else if(typeStr.compare("nom") == 0) nomAttrs.insert(attrId); else if(attrStr.find("cont") == string::npos) throw ATTR_TYPE_ERR; getLineExt(fattr, buf); } attrN = attrId; colN = colNo; if(!foundClass) throw NO_CLASS_ERR; //read contexts part (if any), add unused attributes into ignoreattrs while(fattr.gcount()) { string attrStr(buf); if(attrStr.find(" never") != string::npos) {//extract name of the attribute, find its number, insert it into ignoreattrs int nameLen = (int)attrStr.find(" "); string attrName = attrStr.substr(0, nameLen); attrName = trimSpace(attrName); int neverAttrId = getAttrId(attrName); if (neverAttrId == -1) clog << "\nWARNING: trying to exclude \"" << attrName << "\" - this is not a valid feature\n\n"; else ignoreAttrs.insert(neverAttrId); } getLineExt(fattr, buf); } fattr.close(); int activeAttrN = attrN - (int)ignoreAttrs.size(); clog << attrN << " attributes\n" << activeAttrN << " active attributes\n\n"; if(!isSubset(nomAttrs, ignoreAttrs)) throw NOM_ACTIVE_ERR; //Read data if(string(trainFName).compare("") != 0) {//Read train set clog << "Reading the train set: \"" << trainFName << "\"\n"; fstream fin; fin.open(trainFName, ios_base::in); if(fin.fail()) throw OPEN_TRAIN_ERR; hasMV = false; getLineExt(fin, buf); int caseNo; for(caseNo = 0; fin.gcount(); caseNo++) {//read one line of data file, save class value in targets, attribute values in data if(doOut && ((caseNo + 1)% 100000 == 0)) cout << "\tRead " << caseNo + 1 << " lines..." << endl; floatv item; //single data point try { readData(buf, fin.gcount(), item, colN); } catch (TE_ERROR err) { cerr << "\nLine " << caseNo + 1 << "\n"; throw err; } trainTar.push_back(item[tarColNo]); if(weightColNo != -1) trainW.push_back(item[weightColNo]); item.erase(item.begin() + max(tarColNo, weightColNo)); if(weightColNo != -1) item.erase(item.begin() + min(tarColNo, weightColNo)); for(intset::iterator boolIt = boolAttrs.begin(); boolIt != boolAttrs.end(); boolIt++) if((item[*boolIt] != 0) && (item[*boolIt] != 1) && !wxisNaN(item[*boolIt])) throw ATTR_NOT_BOOL_ERR; train.push_back(item); getLineExt(fin, buf); } trainN = caseNo; trainV = trainN; if(trainN == 0) throw TRAIN_EMPTY_ERR; if(weightColNo != -1) { double trainSum = 0; trainR.resize(trainN); for(int itemNo = 0; itemNo < trainN; itemNo++) trainSum += trainW[itemNo]; double trCoef = trainN / trainSum; for(int itemNo = 0; itemNo < trainN; itemNo++) { trainW[itemNo] *= trCoef; trainR[itemNo] = (itemNo == 0) ? trainW[itemNo] : trainW[itemNo] + trainR[itemNo - 1]; } } double trainStD = getTarStD(TRAIN); clog << trainN << " points in the train set, std. dev. of " << tarName << " values = " << trainStD << "\n\n"; fin.close(); //initialize bootstrap (bag of data) bootstrap.resize(trainN); newBag(); } else //no train set trainN = 0; if(string(validFName).compare("") != 0) {//Read validation set clog << "Reading the validation set: \"" << validFName << "\"\n"; fstream fvalid; fvalid.open(validFName, ios_base::in); if(fvalid.fail()) throw OPEN_VALID_ERR; getLineExt(fvalid, buf); int caseNo; for(caseNo=0; fvalid.gcount(); caseNo++) {//read one line of data file, save response value in validtar, attributes values in valid if (doOut && ((caseNo + 1) % 100000 == 0)) cout << "\tRead " << caseNo + 1 << " lines..." << endl; floatv item; //single data point try { readData(buf, fvalid.gcount(), item, colN); } catch (TE_ERROR err) { cerr << "\nLine " << caseNo + 1 << "\n"; throw err; } validTar.push_back(item[tarColNo]); if(weightColNo != -1) validW.push_back(item[weightColNo]); item.erase(item.begin() + max(tarColNo, weightColNo)); if(weightColNo != -1) item.erase(item.begin() + min(tarColNo, weightColNo)); valid.push_back(item); getLineExt(fvalid, buf); } validN = caseNo; if(validN == 0) throw VALID_EMPTY_ERR; double validStD = getTarStD(VALID); clog << validN << " points in the validation set, std. dev. of " << tarName << " values = " << validStD << "\n\n"; fvalid.close(); } else //no validation set validN = 0; if(string(testFName).compare("") != 0) {//Read test set clog << "Reading the test set: \"" << testFName << "\"\n"; fstream ftest; ftest.open(testFName, ios_base::in); if(ftest.fail()) throw OPEN_TEST_ERR; getLineExt(ftest, buf); int caseNo; for(caseNo=0; ftest.gcount(); caseNo++) {//read one line of data file, save response value in testtar, attributes in test if (doOut && ((caseNo + 1) % 100000 == 0)) cout << "\tRead " << caseNo + 1 << " lines...\n"; floatv item; //single data point try { readData(buf, ftest.gcount(), item, colN); } catch (TE_ERROR err) { cerr << "\nLine " << caseNo + 1 << "\n"; throw err; } testTar.push_back(item[tarColNo]); if(weightColNo != -1) testW.push_back(item[weightColNo]); item.erase(item.begin() + max(tarColNo, weightColNo)); if(weightColNo != -1) item.erase(item.begin() + min(tarColNo, weightColNo)); test.push_back(item); getLineExt(ftest, buf); } testN = caseNo; double testStD = getTarStD(TEST); clog << testN << " points in the test set, std. dev. of " << tarName << " values = " << testStD << "\n\n"; ftest.close(); } else //no test set testN = 0; }
bool BeliefBase::contains(const BeliefBase& other) const { return isSubset(other.items_, items_); }