/* Parse and Translate a Boolean Factor with Leading NOT */ void NotFactor() { if (Token == '!') { Next(); Relation(); NotIt(); } else { Relation(); } }
void NotFactor(void) { message("NotFactor"); if (Token[0]=='!') { MatchString("!"); Relation(); NotIt(); } else { Relation(); } }
void NotFactor() { if(Look == '!') { Match('!'); Relation(); NotIt(); } else { Relation(); } }
Relation Relation::join(Relation r2) { // Combine the schemes and make a new empty relation that uses the combined schemes Relation join_result = Relation("temp_join"); join_result.scheme = join_scheme(r2); // Find which attributes they have in common to prep for the join std::vector<std::pair<int, int>> common_attributes = get_common_attributes(r2); for (Tuple t1 : this->tuples) { for (Tuple t2 : r2.tuples) { if (common_attributes.size() > 0) { // Check if the tuples can join bool join = can_join(t1, t2, common_attributes); if (join) { // Build the joined tuple and add it to the new relation Tuple t = join_tuples(t1, t2, common_attributes); join_result.tuples.insert(t); } } else { Tuple t = do_product(t1, t2); join_result.tuples.insert(t); } } } return join_result; }
int32 SearchForSignatureEntryList::Relation(const BMessage* entriesToOpen, const Model* applicationModel, const entry_ref* preferredApp, const entry_ref* preferredAppForFile) { for (int32 index = 0; ; index++) { entry_ref ref; if (entriesToOpen->FindRef("refs", index, &ref) != B_OK) break; // need to init a model so that typeless folders etc. will still appear to // have a mime type Model model(&ref, true, true); if (model.InitCheck()) continue; int32 result = Relation(&model, applicationModel); if (result != kNoRelation) { if (preferredAppForFile && *applicationModel->EntryRef() == *preferredAppForFile) return kPreferredForFile; if (result == kSupportsType && preferredApp && *applicationModel->EntryRef() == *preferredApp) // application matches cached preferred app, we are done return kPreferredForType; return result; } } return kNoRelation; }
int32 SearchForSignatureEntryList::Relation(const BMessage* entriesToOpen, const Model* model) const { return Relation(entriesToOpen, model, fPreferredAppCount == 1 ? &fPreferredRef : 0, fPreferredAppForFileCount == 1 ? &fPreferredRefForFile : 0); }
Relation Relation::rename(std::vector<std::string> names) { Relation temp = Relation(this->name); temp.tuples = this->tuples; for (auto name : names) { temp.scheme.push_back(name); } return temp; }
// Returns a pointer to the relation with the specified name. Relation Database::accessRelation( string name ) { Relation* r = findRelation(name); if( r == NULL ){ return Relation(); } return *r; }
Family::Family(Person *husband, Person *wife) { members = new Person*[2]; members[0] = husband; members[1] = wife; size = 2; relations = new Relation[1]; relations[0] = Relation(members[0], members[1], HUSBAND_WIFE); relation_count = 1; }
std::set<Relation> Object::getRelation(std::string const& type) const { std::vector<mongo::BSONElement> tmpVec = DataObj::data.getField("relation").Array(); std::set<Relation> relation; for (int i = 0; i < tmpVec.size(); i++) { mongo::BSONObj obj = tmpVec[i].Obj(); if ( strcmp(obj.getStringField("type"), type.c_str()) == 0 ) { relation.insert(Relation(obj)); } } return relation; }
Relation Relation::select(int index1, int index2) { Relation temp = Relation(this->name); temp.scheme = this->scheme; for (Tuple tuple : this->tuples) { if(tuple.at(index1) == tuple.at(index2)) { temp.tuples.insert(tuple); } } return temp; }
Relation Relation::select(int index, std::string value) { Relation temp = Relation(this->name); temp.scheme = this->scheme; for (Tuple tuple : this->tuples) { if (tuple.at(index) == value) { temp.tuples.insert(tuple); } } return temp; }
// <bool_factor> ::= <bool> | <relation> // <bool> ::= true | false void Factor(CPU *cpu, Files file){ if(Peek("true", file)){ Match("true", file); cpu->True(); } else if(Peek("false", file)){ Match("false", file); cpu->False(); } else Relation(cpu, file); }
void BoolFactor() { if (IsBoolean(Look)) { if (GetBoolean()) { EmitLn("movl $-1, %eax"); } else { EmitLn("xor %eax, %eax"); } } else { Relation(); } }
/*!\func * constructor * \params no * \return no */ EdgeDirectList::EdgeDirectList(GraphBody *graphWidget, INode *sourceNode, INode *destNode, const QString&data) : Edge(graphWidget, sourceNode, destNode, "") { QStringList listData = data.split("\n"); foreach(QString data, listData) { QStringList list = data.split("|"); if(list.count() == 2) { relations.append(Relation(list[0].toInt(), list[1])); } }
void BoolFactor() { if(IsBoolean(Look)) { if(GetBoolean()) { EmitLn("mov rax, -1"); } else { EmitLn("xor rax, rax"); } } else { Relation(); } }
bool ReactiveLayer::handleSalutation(bool& someoneIsPresent) { someoneIsPresent = false; //Handle the salutation of newcomers list<Entity*> allAgents = iCub->opc->Entities(EFAA_OPC_ENTITY_TAG, "==", EFAA_OPC_ENTITY_AGENT); list<Relation> salutedAgents = iCub->opc->getRelations("saluted"); list<Relation> identity = iCub->opc->getRelationsMatching("partner", "named"); string identityName = "unknown"; if (identity.size() > 0) identityName = identity.front().object(); for (list<Entity*>::iterator currentAgentIt = allAgents.begin(); currentAgentIt != allAgents.end(); currentAgentIt++) { Agent* currentAgent = dynamic_cast<Agent*>(*currentAgentIt); if (currentAgent->name() != "icub" && currentAgent->m_present) { someoneIsPresent = true; string currentPartner = currentAgent->name(); //cout<<"Testing salutation for "<<currentPartner<<" with name "<<identityName<<endl; bool saluted = false; for (list<Relation>::iterator it = salutedAgents.begin(); it != salutedAgents.end(); it++) { //cout<< it->toString()<<endl; if (it->subject() == identityName) { //cout<<"Same agent detected... Reseting salutation lifetime"<<endl; //This guy has already been saluted, we reset the lifetime iCub->opc->setLifeTime(it->ID(), salutationLifetime); saluted = true; } } if (!saluted) { iCub->look(currentPartner); iCub->say(salutationEffects["humanEnter"].getRandomSentence(), false); iCub->playChoregraphy("wave"); if (identityName != "unknown") iCub->say(identityName + "! nice to see you again!", false); iCub->opc->addRelation(Relation(identityName, "is", "saluted"), salutationLifetime); return true; } } } return false; }
Relation Relation::project(vector<int> &indexList){ Relation r = Relation(name); for(int i = 0; i < (int)indexList.size(); i++) r.schema.attributes.push_back(schema.attributes[indexList[i]]); if(indexList.size() != 0){ set<Tuple>::iterator it; for(it = tuples.begin(); it != tuples.end(); it++){ Tuple newTuple = Tuple(); for(int j = 0; j < (int)indexList.size(); j++) newTuple.push_back((*it)[indexList[j]]); r.tuples.insert(newTuple); } } return r; }
Relation Relation::project(std::vector<int> indices) { Relation temp = Relation(this->name); int num_indices = indices.size(); for (int i = 0; i < num_indices; i++) { temp.scheme.push_back(this->scheme.at(indices.at(i))); } for (Tuple tuple : this->tuples) { Tuple t; for (int i = 0; i < num_indices; i++) { t.push_back(tuple.at(indices.at(i))); } temp.tuples.insert(t); } return temp; }
Query::Subexpression Query::Or(const Subexpression& a, const Subexpression& b) { int sa = a.val; int sb = b.val; assert(sa != 0); assert(sb != 0); if (sa > 0) assert(sa <= (ssize_t)m_restrictions.size()); else assert(-sa <= (ssize_t)m_relations.size()); if (sb > 0) assert(sb <= (ssize_t)m_restrictions.size()); else assert(-sb <= (ssize_t)m_relations.size()); m_relations.push_back(Relation(false, sa, sb)); return Subexpression((int) -m_relations.size()); }
void store_dependence(ddnature nature, a_access from_access,a_access to_access, dir_and_diff_info *d_info) { #if defined newTimeTrials if (!storeResult) return ; #endif ddnode *ddn = new ddnode(d_info->nest); ddn->ddtype = nature; ddn->ddpred = from_access; ddn->ddsucc = to_access; ddn->ddlink = NULL; ddn->ddflags = d_info->flags; dir_and_diff_into_ddnode(d_info, ddn); #if ! defined NDEBUG if (d_info->dd_relation!=NULL) { Relation tmp = *d_info->dd_relation; for (DNF_Iterator d = tmp.query_DNF(); d; d++) (*d)->assert_leading_info(); } #endif if (d_info->dd_relation!=NULL) { ddn->dd_relation = new Relation(*(d_info->dd_relation)); *d_info->dd_relation = Relation(); if (!ddn->dd_relation->is_exact()) ddn->ddflags |= ddMemIncompFlags; ddn->dd_relation->compress(); } else { ddn->dd_relation = d_info->dd_relation; } write_ddnode_to_graph(ddn); }
Database::Database(char* filename) { this->full_output = false; Parser p = Parser(filename); try { p.parse(); //loop through schemes and create new Relation for each scheme for (auto &scheme : p.scheme_list) { vector<Parameter> temp = scheme.get_relevant(); vector<Parameter> columns; for (auto &i : temp) { columns.push_back(i.get_chars()); } Relation r = Relation(columns); this->relations.insert({scheme.get_name(), r}); } //loop through facts and populate table for (auto &fact : p.fact_list) { relations.at(fact.name).add(fact.get_relevant()); } //save queries this->queries = p.query_list; } catch (Token bad_token) { cout << "Failure!" << endl; cout << " " << bad_token.toStr(); } }
const Relation operator()( const BOOST_DEDUCED_TYPENAME Relation::above_view & r ) const { return Relation(r); }
const Relation operator()(const BOOST_DEDUCED_TYPENAME ::lslboost::bimaps::relation::support:: pair_type_by<Tag,Relation>::type & p) const { return Relation(p); }
int User_Program::Execute (int _record) { int stat; bool test; memset (out_flag, '\0', num_files * sizeof (int)); stat = 0; s = stack [sindex = 1]; loop = 0; if (_record < 0) { record++; } else { record = _record; } //---- process each command ---- for (cmd_ptr = command.First (); cmd_ptr; cmd_ptr = command.Next ()) { s1 = stack [sindex - 1]; switch (cmd_ptr->type) { case LIMIT: if (cmd_ptr->token != EQUALS) { exe->Error ("Unrecognized Limit Token = %d (stack=%d)", cmd_ptr->token, command.Record_Index ()); return (-1); } cmd_ptr = command.Next (); if (!Assign ()) return (-1); break; case LOGICAL: if (cmd_ptr->token == IF || cmd_ptr->token == WHILE) { if (s->type == INT_DATA) { test = (s->lvalue != 0); } else if (s->type == FLOAT_DATA) { test = (s->fvalue != 0.0); } else if (s->type == STRING_DATA) { test = (s->svalue [0] != '\0'); } else { test = false; } s = stack [sindex = 1]; if (test) continue; } cmd_ptr = command [cmd_ptr->value]; break; case RELATION: if (!Relation ()) return (-1); break; case MATH: if (!Math ()) return (-1); break; case FUNCTION: if (!Function ()) return (-1); break; case CONVERT: if (!Convert ()) return (-1); break; case DATETIME: if (!Date_Time ()) return (-1); break; case IN_OUT: if (!Input_Output ()) return (-1); break; case TABLE: if (!Table ()) return (-1); break; case RETURN: if (s->type == INT_DATA) { stat = s->lvalue; } else if (s->type == FLOAT_DATA) { stat = (int) s->fvalue; } return (stat); break; default: if (!Read_Value ()) return (-1); break; } } return (stat); }
bool XmlParser::startElement ( const QString & /*namespaceURI*/, const QString & /*localName*/, const QString & qName, const QXmlAttributes & atts ) { if ( qName == "node" ) { m_node = Node(); m_id = atts.value( "id" ).toInt(); m_node.lon = atts.value( "lon" ).toFloat(); m_node.lat = atts.value( "lat" ).toFloat(); m_element = NodeType; } else if ( qName == "way" ) { m_id = atts.value( "id" ).toInt(); m_way = Way(); m_element = WayType; } else if ( qName == "nd" ) { m_way.nodes.push_back( atts.value( "ref" ).toInt() ); } else if ( qName == "relation" ) { m_id = atts.value( "id" ).toInt(); m_relation = Relation(); m_relation.nodes.clear(); m_element = RelationType; } else if ( qName == "member" ) { if ( atts.value( "type" ) == "node" ) { m_relation.nodes.push_back( atts.value( "ref" ).toInt() ); } else if ( atts.value( "type" ) == "way" ) { RelationRole role = None; if ( atts.value( "role" ) == "outer" ) role = Outer; if ( atts.value( "role" ) == "inner" ) role = Inner; m_relation.ways.push_back( QPair<int, RelationRole>( atts.value( "ref" ).toInt(), role ) ); } else if ( atts.value( "type" ) == "relation" ) { m_relation.relations.push_back( atts.value( "ref" ).toInt() ); } else { qDebug() << "Unknown relation member type " << atts.value( "type" ); } } else if ( qName == "tag" && m_element == RelationType ) { if ( atts.value( "k" ) == "boundary" && atts.value( "v" ) == "administrative" ) { m_relation.isAdministrativeBoundary = true; } else if ( atts.value( "k" ) == "admin_level" ) { m_relation.adminLevel = atts.value( "v" ).toInt(); } else if ( atts.value( "k" ) == "name" ) { m_relation.name = atts.value( "v" ); } else if ( atts.value( "k" ) == "type" && atts.value( "v" ) == "multipolygon" ) { m_relation.isMultipolygon = true; } } else if ( qName == "tag" && m_element == WayType ) { QString const key = atts.value( "k" ); QString const value = atts.value( "v" ); if ( key == "name" ) { m_way.name = value; } else if ( key == "addr:street" ) { m_way.street = value; m_way.save = true; } else if ( key == "addr:housenumber" ) { m_way.houseNumber = value; m_way.save = true; } else if ( key == "addr:city" ) { m_way.city = value; m_way.save = true; } else if ( key == "building" && value == "yes" ) { m_way.isBuilding = true; } else { if ( shouldSave( WayType, key, value ) ) { m_way.save = true; } setCategory( m_way, key, value ); } } else if ( qName == "tag" && m_element == NodeType ) { QString const key = atts.value( "k" ); QString const value = atts.value( "v" ); if ( key == "name" ) { m_node.name = value; } else if ( key == "addr:street" ) { m_node.street = value; m_node.save = true; } else if ( key == "addr:housenumber" ) { m_node.houseNumber = value; m_node.save = true; } else if ( key == "addr:city" ) { m_node.city = value; m_node.save = true; } else { if ( shouldSave( NodeType, key, value ) ) { m_node.save = true; } setCategory( m_node, key, value ); } } return true; }
/*!\func * get relation by id * \param no * \return no */ Relation Data::getRelation(const qint32 id) const { if(relations.contains(id)) return relations[id]; else return Relation(0,-1, -1); }
bool SearchForSignatureEntryList::CanOpenWithFilter(const Model* appModel, const BMessage* entriesToOpen, const entry_ref* preferredApp) { ThrowOnAssert(appModel != NULL); if (!appModel->IsExecutable() || !appModel->Node()) { // weed out non-executable #if xDEBUG BPath path; BEntry entry(appModel->EntryRef()); entry.GetPath(&path); PRINT(("filtering out %s- not executable \n", path.Path())); #endif return false; } if (strcasecmp(appModel->MimeType(), B_APP_MIME_TYPE) != 0) { // filter out pe containers on PPC etc. return false; } BFile* file = dynamic_cast<BFile*>(appModel->Node()); ASSERT(file != NULL); char signature[B_MIME_TYPE_LENGTH]; if (GetAppSignatureFromAttr(file, signature) == B_OK && strcasecmp(signature, kTrackerSignature) == 0) { // special case the Tracker - make sure only the running copy is // in the list app_info trackerInfo; if (*appModel->EntryRef() != trackerInfo.ref) { // this is an inactive copy of the Tracker, remove it #if xDEBUG BPath path1; BPath path2; BEntry entry(appModel->EntryRef()); entry.GetPath(&path1); BEntry entry2(&trackerInfo.ref); entry2.GetPath(&path2); PRINT(("filtering out %s, sig %s, active Tracker at %s, " "result %s, refName %s\n", path1.Path(), signature, path2.Path(), strerror(be_roster->GetActiveAppInfo(&trackerInfo)), trackerInfo.ref.name)); #endif return false; } } if (FSInTrashDir(appModel->EntryRef())) return false; if (ShowAllApplications()) { // don't check for these if we didn't look for every single app // to not slow filtering down uint32 flags; BAppFileInfo appFileInfo(dynamic_cast<BFile*>(appModel->Node())); if (appFileInfo.GetAppFlags(&flags) != B_OK) return false; if ((flags & B_BACKGROUND_APP) || (flags & B_ARGV_ONLY)) return false; if (!signature[0]) // weed out apps with empty signatures return false; } int32 relation = Relation(entriesToOpen, appModel, preferredApp, 0); if (relation == kNoRelation && !ShowAllApplications()) { #if xDEBUG BPath path; BEntry entry(appModel->EntryRef()); entry.GetPath(&path); PRINT(("filtering out %s, does not handle any of opened files\n", path.Path())); #endif return false; } if (relation != kNoRelation && relation != kSuperhandler && !fGenericFilesOnly) { // we hit at least one app that is not a superhandler and // handles the document fFoundOneNonSuperHandler = true; } return true; }
void SearchForSignatureEntryList::RelationDescription(const BMessage* entriesToOpen, const Model* applicationModel, BString* description, const entry_ref* preferredApp, const entry_ref* preferredAppForFile) { for (int32 index = 0; ;index++) { entry_ref ref; if (entriesToOpen->FindRef("refs", index, &ref) != B_OK) break; if (preferredAppForFile && ref == *preferredAppForFile) { description->SetTo(B_TRANSLATE("Preferred for file")); return; } Model model(&ref, true, true); if (model.InitCheck()) continue; BMimeType mimeType; int32 result = Relation(&model, applicationModel); switch (result) { case kDoesNotSupportType: continue; case kSuperhandler: description->SetTo(B_TRANSLATE("Handles any file")); return; case kSupportsSupertype: { mimeType.SetTo(model.MimeType()); // status_t result = mimeType.GetSupertype(&mimeType); char* type = (char*)mimeType.Type(); char* tmp = strchr(type, '/'); if (tmp != NULL) *tmp = '\0'; //PRINT(("getting supertype for %s, result %s, got %s\n", // model.MimeType(), strerror(result), mimeType.Type())); description->SetTo(B_TRANSLATE("Handles any %type")); //*description += mimeType.Type(); description->ReplaceFirst("%type", type); return; } case kSupportsType: { mimeType.SetTo(model.MimeType()); if (preferredApp != NULL && *applicationModel->EntryRef() == *preferredApp) { // application matches cached preferred app, we are done description->SetTo(B_TRANSLATE("Preferred for %type")); } else description->SetTo(B_TRANSLATE("Handles %type")); char shortDescription[256]; if (mimeType.GetShortDescription(shortDescription) == B_OK) description->ReplaceFirst("%type", shortDescription); else description->ReplaceFirst("%type", mimeType.Type()); return; } } } description->SetTo(B_TRANSLATE("Does not handle file")); }
std::string PerformanceMeasurerStorage::Report(bool sse42_, bool align, bool raw) const { struct Statistic { std::pair<Pm, Pm> simd; std::pair<Pm, Pm> base; Pm sse42; std::pair<Pm, Pm> sse2; std::pair<Pm, Pm> ssse3; std::pair<Pm, Pm> sse41; std::pair<Pm, Pm> avx2; std::pair<Pm, Pm> vsx; }; typedef std::map<std::string, Statistic> StatisticMap; StatisticMap statistic; double timeMax = 0; size_t sizeMax = 8; bool sse2 = false, ssse3 = false, sse41 = false, sse42 = false, avx2 = false, vsx = false; for(Map::const_iterator it = _map.begin(); it != _map.end(); ++it) { const std::string & desc = it->second->Description(); std::string name = FunctionShortName(desc); Statistic & s = statistic[name]; if(desc.find("Simd::") == std::string::npos && desc.find("Simd") == 0) { if(Aligned(desc)) s.simd.first = *it->second; else s.simd.second = *it->second; } if(desc.find("Simd::Base::") != std::string::npos) { if(Aligned(desc)) s.base.first = *it->second; else s.base.second = *it->second; } if(desc.find("Simd::Sse2::") != std::string::npos || desc.find("Simd::Sse::") != std::string::npos) { if(Aligned(desc)) s.sse2.first = *it->second; else s.sse2.second = *it->second; sse2 = true; } if(desc.find("Simd::Ssse3::") != std::string::npos) { if(Aligned(desc)) s.ssse3.first = *it->second; else s.ssse3.second = *it->second; ssse3 = true; } if(desc.find("Simd::Sse41::") != std::string::npos) { if(Aligned(desc)) s.sse41.first = *it->second; else s.sse41.second = *it->second; sse41 = true; } if(desc.find("Simd::Sse42::") != std::string::npos) { s.sse42 = *it->second; sse42 = true && sse42_; } if(desc.find("Simd::Avx2::") != std::string::npos || desc.find("Simd::Avx::") != std::string::npos) { if(Aligned(desc)) s.avx2.first = *it->second; else s.avx2.second = *it->second; avx2 = true; } if(desc.find("Simd::Vsx::") != std::string::npos) { if(Aligned(desc)) s.vsx.first = *it->second; else s.vsx.second = *it->second; vsx = true; } timeMax = std::max(timeMax, it->second->Average()); sizeMax = std::max(name.size(), sizeMax); } const size_t ic = 1 + (size_t)::log10(std::max(timeMax*1000, 1.0)); const size_t ir = 3; const size_t fc = 3; std::vector<std::string> statistics; for(StatisticMap::const_iterator it = statistic.begin(); it != statistic.end(); ++it) { const Statistic & s = it->second; std::stringstream ss; ss << ExpandToRight(it->first, sizeMax) << " | "; ss << ToString(s.simd.first.Average()*1000.0, ic, fc) << " "; ss << ToString(s.base.first.Average()*1000.0, ic, fc) << " "; if(sse2) ss << ToString(s.sse2.first.Average()*1000.0, ic, fc) << " "; if(ssse3) ss << ToString(s.ssse3.first.Average()*1000.0, ic, fc) << " "; if(sse41) ss << ToString(s.sse41.first.Average()*1000.0, ic, fc) << " "; if(sse42) ss << ToString(s.sse42.Average()*1000.0, ic, fc) << " "; if(avx2) ss << ToString(s.avx2.first.Average()*1000.0, ic, fc) << " "; if(vsx) ss << ToString(s.vsx.first.Average()*1000.0, ic, fc) << " "; ss << "| "; if(sse2 || ssse3 || sse41 || sse42 || avx2 || vsx) { if(sse2) ss << ToString(Relation(s.base.first, s.sse2.first), ir, fc) << " "; if(ssse3) ss << ToString(Relation(s.base.first, s.ssse3.first), ir, fc) << " "; if(sse41) ss << ToString(Relation(s.base.first, s.sse41.first), ir, fc) << " "; if(sse42) ss << ToString(Relation(s.base.first, s.sse42), ir, fc) << " "; if(avx2) ss << ToString(Relation(s.base.first, s.avx2.first), ir, fc) << " "; if(vsx) ss << ToString(Relation(s.base.first, s.vsx.first), ir, fc) << " "; ss << "| "; } if(sse2 && (ssse3 || sse41)) { if(ssse3) ss << ToString(Relation(s.sse2.first, s.ssse3.first), ir, fc) << " "; if(sse41) ss << ToString(Relation(s.sse2.first, s.sse41.first), ir, fc) << " "; ss << "| "; } if((sse2 || ssse3 || sse41) && avx2) { if(sse2) ss << ToString(Relation(s.sse2.first, s.avx2.first), ir, fc) << " "; if(ssse3) ss << ToString(Relation(s.ssse3.first, s.avx2.first), ir, fc) << " "; if(sse41) ss << ToString(Relation(s.sse41.first, s.avx2.first), ir, fc) << " "; ss << "| "; } if(align) { ss << ToString(Relation(s.base.second, s.base.first), ir, fc) << " "; if(sse2) ss << ToString(Relation(s.sse2.second, s.sse2.first), ir, fc) << " "; if(ssse3) ss << ToString(Relation(s.ssse3.second, s.ssse3.first), ir, fc) << " "; if(sse41) ss << ToString(Relation(s.sse41.second, s.sse41.first), ir, fc) << " "; if(avx2) ss << ToString(Relation(s.avx2.second, s.avx2.first), ir, fc) << " "; if(vsx) ss << ToString(Relation(s.vsx.second, s.vsx.first), ir, fc) << " "; ss << "| "; } statistics.push_back(ss.str()); } std::sort(statistics.begin(), statistics.end()); std::stringstream header; header << ExpandToRight("Function", sizeMax) << " | "; header << ExpandToLeft("Simd", ic + fc + 1) << " "; header << ExpandToLeft("Base", ic + fc + 1) << " "; if(sse2) header << ExpandToLeft("Sse2", ic + fc + 1) << " "; if(ssse3) header << ExpandToLeft("Ssse3", ic + fc + 1) << " "; if(sse41) header << ExpandToLeft("Sse41", ic + fc + 1) << " "; if(sse42) header << ExpandToLeft("Sse42", ic + fc + 1) << " "; if(avx2) header << ExpandToLeft("Avx2", ic + fc + 1) << " "; if(vsx) header << ExpandToLeft("Vsx", ic + fc + 1) << " "; header << "| "; if(sse2 || ssse3 || sse41 || sse42 || avx2 || vsx) { if(sse2) header << ExpandToLeft("B/S2", ir + fc + 1) << " "; if(ssse3) header << ExpandToLeft("B/S3", ir + fc + 1) << " "; if(sse41) header << ExpandToLeft("B/S41", ir + fc + 1) << " "; if(sse42) header << ExpandToLeft("B/S42", ir + fc + 1) << " "; if(avx2) header << ExpandToLeft("B/A2", ir + fc + 1) << " "; if(vsx) header << ExpandToLeft("B/Vs", ir + fc + 1) << " "; header << "| "; } if(sse2 && (ssse3 || sse41)) { if(ssse3) header << ExpandToLeft("S2/S3", ir + fc + 1) << " "; if(sse41) header << ExpandToLeft("S2/S41", ir + fc + 1) << " "; header << "| "; } if((sse2 || ssse3 || sse41) && avx2) { if(sse2) header << ExpandToLeft("S2/A2", ir + fc + 1) << " "; if(ssse3) header << ExpandToLeft("S3/A2", ir + fc + 1) << " "; if(sse41) header << ExpandToLeft("S41/A2", ir + fc + 1) << " "; header << "| "; } if(align) { header << ExpandToLeft("B:U/A", ir + fc + 1) << " "; if(sse2) header << ExpandToLeft("S2:U/A", ir + fc + 1) << " "; if(ssse3) header << ExpandToLeft("S3:U/A", ir + fc + 1) << " "; if(sse41) header << ExpandToLeft("S41:U/A", ir + fc + 1) << " "; if(avx2) header << ExpandToLeft("A2:U/A", ir + fc + 1) << " "; if(vsx) header << ExpandToLeft("Vs:U/A", ir + fc + 1) << " "; header << "| "; } std::stringstream separator; for(size_t i = 0; i < header.str().size(); ++i) separator << "-"; std::stringstream report; if(raw) { report << std::endl << "Raw performance report:" << std::endl << std::endl; for(Map::const_iterator it = _map.begin(); it != _map.end(); ++it) report << it->second->Statistic() << std::endl; } report << std::endl << "Performance report:" << std::endl << std::endl; report << separator.str() << std::endl; report << header.str() << std::endl; report << separator.str() << std::endl; for(size_t i = 0; i < statistics.size(); ++i) report << statistics[i] << std::endl; report << separator.str() << std::endl; return report.str(); }