int main() { JobRecord jfirstj {1991, 2001, "Global", "junior developer"}; JobRecord jsecondj {2001, 2002, "Global", "junior developer"}; CV johnsCV {"John Jonson", 1978,"C++, Java"}; if (jfirstj.isValid() && jsecondj.isValid()) { johnsCV.addJobRecord(jfirstj); johnsCV.addJobRecord(jsecondj); } JobRecord dfirstj {1994, 2000, "Global", "junior developer"}; JobRecord dsecondj {1994, 2000, "Global", "junior developer"}; CV dansCV("Dan Davidson", 1988, "C++, Java"); if (dfirstj.isValid() && dsecondj.isValid()) { dansCV.addJobRecord(dfirstj); dansCV.addJobRecord(dfirstj); } vector<CV> resume_list {johnsCV, dansCV}; int min_exp {5}; for ( auto& cv: resume_list) { int sum_ex = cv.Total_experience(); if (cv.isValid() && sum_ex >= min_exp) cv.print(); } return 0; }
// [[Rcpp::export]] CV icd9ChildrenShortUnordered(const CV &icd9Short, const VecStr &icd9cmReal, const bool onlyReal) { icd_set out; if (icd9Short.size() == 0) { CV out; out.attr("icd_short_diag") = true; return out; } List parts = icd9ShortToParts(icd9Short, ""); CV mjr = parts[0]; CV mnr = parts[1]; CV::iterator itmjr = mjr.begin(); CV::iterator itmnr = mnr.begin(); for (; itmjr != mjr.end(); ++itmjr, ++itmnr) { Str thismjr = as<Str>(*itmjr); Str thismnr = as<Str>(*itmnr); const CV newminors = icd9ExpandMinor(thismnr, icd9IsASingleE(thismjr.c_str())); VecStr newshort = as<VecStr>(icd9MajMinToShort(thismjr, newminors)); out.insert(newshort.begin(), newshort.end()); } if (onlyReal) { icd_set out_real; icd_set reals(icd9cmReal.begin(), icd9cmReal.end()); for (icd_set::iterator j = out.begin(); j != out.end(); ++j) { if (reals.find(*j) != reals.end()) out_real.insert(*j); } out = out_real; } CV rcppOut = wrap(out); rcppOut.attr("icd_short_diag") = true; return rcppOut; }
// [[Rcpp::export]] CV icd9ChildrenDecimalCpp(CV icd9Decimal, const VecStr &icd9cmReal, bool onlyReal) { CV shrt = icd9DecimalToShort(icd9Decimal); CV kids = icd9ChildrenShort(shrt, icd9cmReal, onlyReal); CV out = icd9ShortToDecimal(kids); out.attr("icd_short_diag") = false; return out; }
// [[Rcpp::export]] CV icd9ChildrenShort(CV icd9Short, const VecStr &icd9cmReal, bool onlyReal) { std::set<Str> out; if (icd9Short.size() == 0) { icd9Short.attr("icd_short_diag") = true; return icd9Short; } List parts = icd9ShortToParts(icd9Short, ""); CV mjr = parts[0]; CV mnr = parts[1]; CV::iterator itmjr = mjr.begin(); CV::iterator itmnr = mnr.begin(); for (; itmjr != mjr.end(); ++itmjr, ++itmnr) { Str thismjr = as<Str>(*itmjr); Str thismnr = as<Str>(*itmnr); const CV newminors = icd9ExpandMinor(thismnr, icd9IsASingleE(thismjr.c_str())); VecStr newshort = as<VecStr>(icd9MajMinToShort(thismjr, newminors)); out.insert(newshort.begin(), newshort.end()); } if (onlyReal) { std::set<Str> out_real; const std::set<Str> reals(icd9cmReal.begin(), icd9cmReal.end()); std::set_intersection(out.begin(), out.end(), reals.begin(), reals.end(), std::inserter(out_real, out_real.begin())); out = out_real; } CV rcppOut = wrap(out); rcppOut.attr("icd_short_diag") = true; return rcppOut; }
void Relevant::buildCodeSetCV(const CV &codes) { // over-reserve (and maybe expand), target is unique number allCodesSet.reserve(allCodesSet.size() + codes.size()); DEBUG_VEC(codes); for (String c : codes) { if (c != NA_STRING) { allCodesSet.insert(c.get_cstring()); } } }
int main() { CV johnsCV {"John Jonson", 1978,"C++, Java"}; JobRecord JohnsRecord {1991,1993,"junior","Microsoft"}; JobRecord JohnsRecord2 {1993,1995,"developer","IBM"}; johnsCV.addJobRecord(JohnsRecord); johnsCV.addJobRecord(JohnsRecord2); CV dansCV("Dan Davidson", 1988, "C#, Objective C"); JobRecord DansRecord {1993,1995,"junior","Microsoft"}; JobRecord DansRecord2 {1995,2000,"senior software developer","Apple Inc"}; dansCV.addJobRecord(DansRecord); dansCV.addJobRecord(DansRecord2); CV jeffsCV("Jeff Hardy", 1973, "C/C++"); JobRecord JeffsRecord {2005,2007,"junior","IBM"}; JobRecord JeffsRecord2 {2009,2014,"developer","Microsoft"}; jeffsCV.addJobRecord(JeffsRecord); jeffsCV.addJobRecord(JeffsRecord2); // std::array<CV, 3> cvList {johnsCV, dansCV, {"Will Walker", 197, "C++, Java", "IBM 1990-1999; Microsoft 1999-2010"} }; std::vector<CV> cvList {johnsCV, dansCV , jeffsCV}; for (const auto& cv: cvList) { if (cv.isValid()&&(cv.TotalJobTime>5)) { cv.print(); } else { std::cout << "ERROR: CV is invalid" << std::endl; } } return 0; }
int main() { CV johnsCV {"John Jonson", 1978,"C++, Java"}; CV dansCV("Dan Davidson", 1988, "C++, Java"); johnsCV.addJobRecord(JobRecord(1997,2000,"Junior Developer", "Microsoft" )); dansCV.addJobRecord(JobRecord(1999, 2001, "Developer", "IBM")); std::vector<CV> cvList {johnsCV, dansCV}; for (const auto& cv: cvList) { if (cv.isValid()) { cv.print(); } else { std::cout << "Error: CV is invalid" << std::endl; } } return 0; }
void V_Mult_Generic (typename CV::const_value_type& c, const CV& C, typename AV::const_value_type& ab, const AV& A, const BV& B) { using Kokkos::ALL; using Kokkos::subview; typedef Kokkos::Details::ArithTraits<typename AV::non_const_value_type> ATA; typedef Kokkos::Details::ArithTraits<typename CV::non_const_value_type> ATC; typedef typename CV::execution_space execution_space; const SizeType numRows = C.dimension_0 (); Kokkos::RangePolicy<execution_space, SizeType> policy (0, numRows); if (c == ATC::zero ()) { if (ab == ATA::zero ()) { typedef V_MultFunctor<CV, AV, BV, 0, 0, SizeType> functor_type; functor_type op (c, C, ab, A, B); Kokkos::parallel_for (policy, op); } else { typedef V_MultFunctor<CV, AV, BV, 2, 0, SizeType> functor_type; functor_type op (c, C, ab, A, B); Kokkos::parallel_for (policy, op); } } else { // c != 0 if (ab == ATA::zero ()) { typedef V_MultFunctor<CV, AV, BV, 0, 2, SizeType> functor_type; functor_type op (c, C, ab, A, B); Kokkos::parallel_for (policy, op); } else { typedef V_MultFunctor<CV, AV, BV, 2, 2, SizeType> functor_type; functor_type op (c, C, ab, A, B); Kokkos::parallel_for (policy, op); } } }