int main(int argc, char *argv[]) { int info; int m = 6; int n = 4; if (argc > 2) { m = boost::lexical_cast<int>(argv[1]); n = boost::lexical_cast<int>(argv[2]); } std::cout << "m = " << m << "\nn = " << n << std::endl; int k = std::min(m, n); // generate random martix matrix_t mat = matrix_t::Random(m, n); std::cout << "Input random matrix A:\n" << mat << std::endl; // singular value decomposition matrix_t a = mat; // 'a' will be destroyed by dgesvd vector_t s(k), superb(k); matrix_t u(m, k), vt(k, n); info = LAPACKE_zgesvd(LAPACK_COL_MAJOR, 'S', 'S', m, n, &a(0, 0), m, &s(0), &u(0, 0), m, &vt(0, 0), k, &superb(0)); std::cout << "U:\n" << u << std::endl; std::cout << "S:\n" << s << std::endl; std::cout << "Vt:\n" << vt << std::endl; // check correctness of SVD matrix_t smat = matrix_t::Zero(k, k); for (int i = 0; i < k; ++i) smat(i, i) = s(i); matrix_t check = u * smat * vt; std::cout << "U * S * Vt:\n" << check << std::endl; std::cout << "| A - U * S * Vt | = " << (mat - check).norm() << std::endl; }
cv::Matx33d get_fundamental_matrix(std::vector<tutor::PPoint2d> x1 , std::vector<tutor::PPoint2d> x2) { cv::Mat_<double> W; cv::Mat_<double> u, d, vt; for (int i=0; i< (int)x1.size(); i++ ) { cv::Mat_<double> Wi = (cv::Mat_<double>(1, 9) << x1[i].x()*x2[i].x(), x1[i].y()*x2[i].x(), x2[i].x(), x1[i].x()*x2[i].y(), x1[i].y()*x2[i].y(), x2[i].y(), x1[i].x(), x1[i].y(), 1); W.push_back(Wi); } cv::SVD::compute(W, d, u, vt, cv::SVD::FULL_UV); // std::cout << "d=" << d << endl; // std::cout << "U=" << u << endl; // std::cout << "vt=" << vt << endl; cv::Mat_<double> F = (cv::Mat_<double>(3,3) << vt(8,0),vt(8,1),vt(8,2),vt(8,3),vt(8,4),vt(8,5),vt(8,6),vt(8,7),vt(8,8) ) ; // cv::Matx33d F(vt(8,0),vt(8,1),vt(8,2),vt(8,3),vt(8,4),vt(8,5),vt(8,6),vt(8,7),vt(8,8) ) ; //// decompose F //// Now, F's degree of freedom is 3, but actually F's degree of freedom is 2. so reduce F's degree of freedom cv::SVD::compute(F, d, u, vt, cv::SVD::FULL_UV); // std::cout << "d=" << d << std::endl; cv::Mat_<double> D = (cv::Mat_<double> (3,3) << d(0), 0, 0, 0, d(1), 0, 0, 0, 0); // std::cout << "Reduced D=" << D << std::endl; F = u*D*vt; F = F / F(2,2); std::cout << "F=" << F << std::endl; // std::cout << "Reduced F=" << F << std::endl; return F; }
void VirtualTerminal::init() { auto logind = LogindIntegration::self(); if (logind->vt() != -1) { setup(logind->vt()); } connect(logind, &LogindIntegration::virtualTerminalChanged, this, &VirtualTerminal::setup); if (logind->isConnected()) { logind->takeControl(); } else { connect(logind, &LogindIntegration::connectedChanged, logind, &LogindIntegration::takeControl); } }
osg::ref_ptr<osg::Geode> build_quad(void) { osg::ref_ptr<osg::Geometry> geom(new osg::Geometry); osg::ref_ptr<osg::Vec3Array> v(new osg::Vec3Array); geom->setVertexArray(v.get()); v->push_back(osg::Vec3(-4.f, 0.f, -4.f)); v->push_back(osg::Vec3(4.f, 0.f, -4.f)); v->push_back(osg::Vec3(4.f, 0.f, 4.f)); v->push_back(osg::Vec3(-4.f, 0.f, 4.f)); osg::ref_ptr<osg::Vec2Array> vt(new osg::Vec2Array); geom->setTexCoordArray(0, vt.get()); vt->push_back(osg::Vec2(0.f, 0.f)); vt->push_back(osg::Vec2(1.f, 0.f)); vt->push_back(osg::Vec2(1.f, 1.f)); vt->push_back(osg::Vec2(0.f, 1.f)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 4)); osg::ref_ptr<osg::Geode> result(new osg::Geode); result->addDrawable(geom.get()); return result; }
std::vector<double> WallModel::getUVs() { double pw = 1.0 / TEX_IMAGE_TILE_WIDTH; double ph = 1.0 / TEX_IMAGE_TILE_HEIGHT; double tileWidth = TEX_TILE_WIDTH * pw; double tileHeight = TEX_TILE_HEIGHT * ph; double height = top - bottom; double heightOffset = ((height - TILE_SIZE) / TILE_SIZE) * tileHeight; double hJump = tileWidth + 2 * pw; double vJump = tileHeight + 2 * ph; double uOffset = (hJump * textureCol) + pw; double vOffset = 1.0 - (vJump * (textureRow + 1)) + ph; double vtd[] = {uOffset, vOffset, uOffset + tileWidth, vOffset, uOffset + tileWidth, vOffset + tileHeight + heightOffset, uOffset, vOffset + tileHeight + heightOffset }; std::vector<double> vt(vtd, vtd + sizeof(vtd) / sizeof(double)); return vt; }
// static void LLLandmark::processRegionIDAndHandle(LLMessageSystem* msg, void**) { LLUUID region_id; msg->getUUID("ReplyBlock", "RegionID", region_id); mRegions.erase(region_id); CacheInfo info; const F32 CACHE_EXPIRY_SECONDS = 60.0f * 10.0f; // ten minutes info.mTimer.setTimerExpirySec(CACHE_EXPIRY_SECONDS); msg->getU64("ReplyBlock", "RegionHandle", info.mRegionHandle); region_map_t::value_type vt(region_id, info); mRegions.insert(vt); #if LL_DEBUG U32 grid_x, grid_y; grid_from_region_handle(info.mRegionHandle, &grid_x, &grid_y); lldebugs << "Landmark got reply for region: " << region_id << " " << grid_x << "," << grid_y << llendl; #endif // make all the callbacks here. region_callback_map_t::iterator it; while((it = sRegionCallbackMap.find(region_id)) != sRegionCallbackMap.end()) { (*it).second(region_id, info.mRegionHandle); sRegionCallbackMap.erase(it); } }
STDMETHODIMP CLogMessage::get_SysError(BSTR* pVal) { TRY_CATCH CComVariant vt(m_logMessage.GetProperty(CSingleton<CNetLogFieldsMap>::instance().GetFieldIndex(cLog::_FIELD_SYSTEM_ERROR))); if ( vt.vt == VT_EMPTY || vt.intVal == 0) { *pVal = NULL; return S_OK; } /// Getting syserror PTCHAR Buffer; DWORD BufferAllocated; //Formatting winerror message tstring intVal; if(!(BufferAllocated=FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, NULL, vt.intVal, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (PTCHAR) &Buffer, 16, NULL))) { intVal = i2tstring(vt.intVal); Buffer = const_cast<PTCHAR>(intVal.c_str()); } *pVal = CComBSTR(Buffer).Copy(); // Deallocating buffer if it was allocated before if (BufferAllocated) LocalFree( Buffer ); return S_OK; CATCH_LOG_COMERROR() }
vector<TParticle*> LMCphysGen::GenCerPhotons(TParticle *part, LMCstep *step, Int_t N) { const Double_t hbarc = 0.197326960277E-6; //GeV.nm vector <TParticle*> v; //rotation matrix to transform vectors from geom -> part TRotation rm; TVector3 vt(part->Px(), part->Py(), part->Pz()); rm.RotateX(vt.Theta()); //rotate on X rm.RotateZ(vt.Phi()); //rotate on Z TVector3 pdir = vt.Unit(); // rotation matrix from part->geom TRotation im = rm.Inverse(); //generate photons Double_t Emin = 2.*TMath::Pi()* hbarc / 200.; //GeV Double_t Emax = 2.*TMath::Pi()* hbarc / 700.; //GeV TVector3 InitPoint = step->GetInitPoint(); Double_t stepLength = step->GetStepLength(); for (int i=0; i< N; i++) { Double_t thetaCer = step->GetCerAngle(); Double_t phi = (RandGen->Rndm())*2.*TMath::Pi(); TVector3 photonDir(sin(thetaCer)*cos(phi), sin(thetaCer)*sin(phi), cos(thetaCer)); TVector3 photonDirDet = im*photonDir; //transform photon direction from particle to detector frame Double_t photonE = Emin + (RandGen->Rndm())*(Emax-Emin); //cerenkov photon flat on energy (GeV) TVector3 photonMomDet = photonE*photonDirDet; //on detector frame TVector3 GenPoint = InitPoint + stepLength*(RandGen->Rndm())*pdir; v.push_back(new TParticle(22,0,0,0,0,0,photonMomDet.X(),photonMomDet.Y(),photonMomDet.Z(),photonE,GenPoint.X(),GenPoint.Y(),GenPoint.Z(),0)); } return v; }
int main(int argc, char *argv[]) { if (argc != 3) { return -1; } try { std::vector<uint8_t> imageData; std::stringstream stream(argv[1]); std::string path(argv[2]); int size; stream >> size; ffmpegthumbnailer::VideoThumbnailer vt(size, false, true, 20, false); vt.generateThumbnail(path, ThumbnailerImageTypeEnum::Png, imageData); char *base64_data = toBase64(imageData.data(), imageData.size(), Base64Encoding); printf("%s", base64_data); fflush(stdout); } catch (std::logic_error e) { std::cerr << e.what(); return -1; } return 0; }
void rot (const T1 &t1, V1 &v1, const T2 &t2, V2 &v2) { typedef typename promote_traits<typename V1::value_type, typename V2::value_type>::promote_type promote_type; vector<promote_type> vt (t1 * v1 + t2 * v2); v2.assign (- t2 * v1 + t1 * v2); v1.assign (vt); }
// two pointers, dynamicly maintain window frame that contains all chars in T string minWindow(string S, string T) { vector<int> vt (256, 0); vector<int> vs (256, 0); for(int i = 0; i < T.size(); ++i) vt[T[i]]++; int count = 0; int slow = 0; int min_len = INT_MAX; int min_srt = 0; for(int fast = 0; fast < S.size(); ++fast){ if(vt[S[fast]]){ // create window vs[S[fast]]++; if(vs[S[fast]] <= vt[S[fast]]) count++; } if(count == T.size()){ while(!vt[S[slow]] || vs[S[slow]] > vt[S[slow]]){ // maintain window if(vt[S[slow]]) vs[S[slow]]--; slow++; } if(fast - slow + 1 < min_len){ min_len = fast - slow + 1; min_srt = slow; } } } return min_len == INT_MAX ? "" : S.substr(min_srt, min_len); }
int MultiPlasticityLinearSystem::singularValuesOfR(const std::vector<RankTwoTensor> & r, std::vector<Real> & s) { int bm = r.size(); int bn = 6; s.resize(std::min(bm, bn)); // prepare for gesvd or gesdd routine provided by PETSc // Want to find the singular values of matrix // ( r[0](0,0) r[0](0,1) r[0](0,2) r[0](1,1) r[0](1,2) r[0](2,2) ) // ( r[1](0,0) r[1](0,1) r[1](0,2) r[1](1,1) r[1](1,2) r[1](2,2) ) // a = ( r[2](0,0) r[2](0,1) r[2](0,2) r[2](1,1) r[2](1,2) r[2](2,2) ) // ( r[3](0,0) r[3](0,1) r[3](0,2) r[3](1,1) r[3](1,2) r[3](2,2) ) // ( r[4](0,0) r[4](0,1) r[4](0,2) r[4](1,1) r[4](1,2) r[4](2,2) ) // bm = 5 std::vector<double> a(bm * 6); // Fill in the a "matrix" by going down columns unsigned ind = 0; for (int col = 0; col < 3; ++col) for (int row = 0; row < bm; ++row) a[ind++] = r[row](0, col); for (int col = 3; col < 5; ++col) for (int row = 0; row < bm; ++row) a[ind++] = r[row](1, col - 2); for (int row = 0; row < bm; ++row) a[ind++] = r[row](2, 2); // u and vt are dummy variables because they won't // get referenced due to the "N" and "N" choices int sizeu = 1; std::vector<double> u(sizeu); int sizevt = 1; std::vector<double> vt(sizevt); int sizework = 16 * (bm + 6); // this is above the lowerbound specified in the LAPACK doco std::vector<double> work(sizework); int info; LAPACKgesvd_("N", "N", &bm, &bn, &a[0], &bm, &s[0], &u[0], &sizeu, &vt[0], &sizevt, &work[0], &sizework, &info); return info; }
STDMETHODIMP CLogMessage::put_AddedDate(DATE newVal) { TRY_CATCH CComVariant vt(newVal); m_logMessage.SetProperty(CSingleton<CNetLogFieldsMap>::instance().GetFieldIndex(cLog::_FIELD_TIME), vt); return S_OK; CATCH_LOG_COMERROR() }
STDMETHODIMP CLogMessage::put_TestSuite(BSTR newVal) { TRY_CATCH CComVariant vt(newVal); m_logMessage.SetProperty(CSingleton<CNetLogFieldsMap>::instance().GetFieldIndex(cLog::_FIELD_UTEST_SUITE), vt); return S_OK; CATCH_LOG_COMERROR() }
STDMETHODIMP CLogMessage::put_SysError(BSTR newVal) { TRY_CATCH CComVariant vt(newVal); m_logMessage.SetProperty(CSingleton<CNetLogFieldsMap>::instance().GetFieldIndex(cLog::_FIELD_SYSTEM_ERROR), vt); return S_OK; CATCH_LOG_COMERROR() }
STDMETHODIMP CLogMessage::put_FileLine(SHORT newVal) { TRY_CATCH CComVariant vt(newVal); m_logMessage.SetProperty(CSingleton<CNetLogFieldsMap>::instance().GetFieldIndex(cLog::_FIELD_LINE_NUMBER), vt); return S_OK; CATCH_LOG_COMERROR() }
//========================================================================== // null space basis up to epsi //========================================================================== tab_t null(base_t epsi = -1 )const { epsi = epsi < 0 ? nt2::eps(w_(1)) : epsi; int j = numel(w_); for(; (j > 0) && (w_(j)<= epsi); j--); j++; return nt2::fliplr(trans(vt()(_(j, last_index<1>(vt_)), _))); }
PopulationAlphabet::index_type PopulationAlphabet::getSymbol( const locus_t & l, const allele_t & a, bool createNew ) { // std::cout << "Getting symbol for: " << l << std::endl; locus_alleles_t res = m_db.left.equal_range( l ); variant_db_t::iterator it = m_db.end(); while( res.first != res.second ) { if( res.first->second == a ) { it = m_db.project_up( res.first ); } else { res.first++; } } size_t offset = m_db.size(); if( it == m_db.end() ) { if( !createNew ) return npos; variant_db_t::value_type vt(l, a); std::pair< variant_db_t::iterator, bool > res = m_db.insert( m_db.end(), vt); assert( res.second ); it = res.first; // std::cout << it->left << " ?== " << l << std::endl; assert( it->left == l ); // std::cout << "Added new variant to database: " << l << std::endl; } else { offset = (it - m_db.begin()); } // std::cout << "variant offset in database: " << offset << std::endl; if( m_free_list.size() <= offset ) { size_t fspace = m_free_list.find_first(); if( fspace == bitset_type::npos ) { fspace = m_free_list.size(); m_free_list.push_back(false); m_free_intersect.push_back(false); m_free_union.push_back(true); } // std::cout << "First free space: " << fspace << std::endl; if( fspace != offset ) { variant_db_t::iterator sit = m_db.begin() + fspace; variant_db_t::iterator nit = it + 1; m_db.relocate( sit, it); m_db.relocate( nit, sit); m_free_list[fspace] = false; offset = fspace; // } else { // std::cout << "Variant in first free space already" << std::endl; } } return offset; }
LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t cb) { LLLandmark* landmark = get_ptr_in_map(mList, asset_uuid); if(landmark) { LLVector3d dummy; if(cb && !landmark->getGlobalPos(dummy)) { // landmark is not completely loaded yet loaded_callback_map_t::value_type vt(asset_uuid, cb); mLoadedCallbackMap.insert(vt); } return landmark; } else { if ( mBadList.find(asset_uuid) != mBadList.end() ) { return NULL; } landmark_requested_list_t::iterator iter = mRequestedList.find(asset_uuid); if (iter != mRequestedList.end()) { const F32 rerequest_time = 30.f; // 30 seconds between requests if (gFrameTimeSeconds - iter->second < rerequest_time) { return NULL; } } if (cb) { loaded_callback_map_t::value_type vt(asset_uuid, cb); mLoadedCallbackMap.insert(vt); } gAssetStorage->getAssetData(asset_uuid, LLAssetType::AT_LANDMARK, LLLandmarkList::processGetAssetReply, NULL); mRequestedList[asset_uuid] = gFrameTimeSeconds; } return NULL; }
// static void LLLandmark::requestRegionHandle( LLMessageSystem* msg, const LLHost& upstream_host, const LLUUID& region_id, region_handle_callback_t callback) { if(region_id.isNull()) { // don't bother with checking - it's 0. lldebugs << "requestRegionHandle: null" << llendl; if(callback) { const U64 U64_ZERO = 0; callback(region_id, U64_ZERO); } } else { if(region_id == mLocalRegion.first) { lldebugs << "requestRegionHandle: local" << llendl; if(callback) { callback(region_id, mLocalRegion.second); } } else { region_map_t::iterator it = mRegions.find(region_id); if(it == mRegions.end()) { lldebugs << "requestRegionHandle: upstream" << llendl; if(callback) { region_callback_map_t::value_type vt(region_id, callback); sRegionCallbackMap.insert(vt); } lldebugs << "Landmark requesting information about: " << region_id << llendl; msg->newMessage("RegionHandleRequest"); msg->nextBlock("RequestBlock"); msg->addUUID("RegionID", region_id); msg->sendReliable(upstream_host); } else if(callback) { // we have the answer locally - just call the callack. lldebugs << "requestRegionHandle: ready" << llendl; callback(region_id, (*it).second.mRegionHandle); } } } // As good a place as any to expire old entries. expireOldEntries(); }
int main() { std::vector<Items> vt(10); vt.push_back(Items(8.2,2.8, 3)); for (int i = 0; i < 10; i++) vt[i].ShowItems(); return 0; }
int gmMatrix3::gmfTransformVector(gmThread *a_thread) { GM_CHECK_NUM_PARAMS(1); gmMat3Type* native = gmMatrix3::GetThisObject( a_thread ); GM_CHECK_VECTOR_PARAM(v,0); Vector3f vt(v.x,v.y,v.z); vt = *native * vt; a_thread->PushVector(vt.X(), vt.Y(), vt.Z()); return GM_OK; }
vector<int> searchRange(vector<int>& nums, int target) { int n = nums.size(); vector<int> vt(2,-1); if( n < 1 ) return vt; int low = lowerBound(nums, target); if( low >= 0 ){ vt[0] = low; vt[1] = upperBound(nums, target); } return vt; }
void GazeboRosSkidSteerDrive::publishOdometry(double step_time) { ros::Time current_time = ros::Time::now(); std::string odom_frame = tf::resolve(tf_prefix_, odometry_frame_); std::string base_footprint_frame = tf::resolve(tf_prefix_, robot_base_frame_); // TODO create some non-perfect odometry! // getting data for base_footprint to odom transform math::Pose pose = this->parent->GetWorldPose(); tf::Quaternion qt(pose.rot.x, pose.rot.y, pose.rot.z, pose.rot.w); tf::Vector3 vt(pose.pos.x, pose.pos.y, pose.pos.z); tf::Transform base_footprint_to_odom(qt, vt); if (this->broadcast_tf_) { transform_broadcaster_->sendTransform( tf::StampedTransform(base_footprint_to_odom, current_time, odom_frame, base_footprint_frame)); } // publish odom topic odom_.pose.pose.position.x = pose.pos.x; odom_.pose.pose.position.y = pose.pos.y; odom_.pose.pose.orientation.x = pose.rot.x; odom_.pose.pose.orientation.y = pose.rot.y; odom_.pose.pose.orientation.z = pose.rot.z; odom_.pose.pose.orientation.w = pose.rot.w; odom_.pose.covariance[0] = 0.00001; odom_.pose.covariance[7] = 0.00001; odom_.pose.covariance[14] = 1000000000000.0; odom_.pose.covariance[21] = 1000000000000.0; odom_.pose.covariance[28] = 1000000000000.0; odom_.pose.covariance[35] = 0.01; // get velocity in /odom frame math::Vector3 linear; linear = this->parent->GetWorldLinearVel(); odom_.twist.twist.angular.z = this->parent->GetWorldAngularVel().z; // convert velocity to child_frame_id (aka base_footprint) float yaw = pose.rot.GetYaw(); odom_.twist.twist.linear.x = cosf(yaw) * linear.x + sinf(yaw) * linear.y; odom_.twist.twist.linear.y = cosf(yaw) * linear.y - sinf(yaw) * linear.x; odom_.header.stamp = current_time; odom_.header.frame_id = odom_frame; odom_.child_frame_id = base_footprint_frame; odometry_publisher_.publish(odom_); }
bool PlayState::frameStarted(const Ogre::FrameEvent& evt) { // movimiento de camara luego quitar Ogre::Vector3 vt(0,0,0); Ogre::Real tSpeed = 1.0; if(InputManager::getSingleton().getKeyboard()->isKeyDown(OIS::KC_UP)) vt+=Ogre::Vector3(0,0,-1); if(InputManager::getSingleton().getKeyboard()->isKeyDown(OIS::KC_DOWN)) vt+=Ogre::Vector3(0,0,1); if(InputManager::getSingleton().getKeyboard()->isKeyDown(OIS::KC_LEFT)) vt+=Ogre::Vector3(-1,0,0); if(InputManager::getSingleton().getKeyboard()->isKeyDown(OIS::KC_RIGHT)) vt+=Ogre::Vector3(1,0,0); _camera->moveRelative(vt * 0.1 * tSpeed); return true; }
void MazeSolver::solveByDFSRecursive() { VisitedTracker vt(maze->numRows(), maze->numCols()); int numSquares = maze->numRows() * maze->numCols(); std::vector<Direction> p( numSquares ); int numExplored = 0; dfsHelper(maze->getStartRow(), maze->getStartCol(), vt, p, numExplored); std::vector<Direction> path = pathCreator(p); display->reportSolution(path, vt, numExplored); return; }
// Applies a transformation in the form of a matrix to a list of vertices. vector<glm::vec4> transformVertices(const glm::mat4 & transMatrix, const vector<glm::vec4> & vertices) { vector<glm::vec4> transformedVertices; for (unsigned int i = 0; i < vertices.size(); i++) { glm::vec4 vt(transMatrix * vertices[i]); transformedVertices.push_back(vt); } return transformedVertices; } // end transformVertices
// Build Recent File menu entries from given generic_string BuildMenuFileName(int filenameLen, unsigned int pos, const generic_string &filename) { generic_string strTemp; if (pos < 9) { strTemp.push_back('&'); strTemp.push_back('1' + (TCHAR)pos); } else if (pos == 9) { strTemp.append(TEXT("1&0")); } else { strTemp.append(uintToString(pos + 1)); } strTemp.append(TEXT(": ")); if (filenameLen > 0) { std::vector<TCHAR> vt(filenameLen + 1); //--FLS: W removed from PathCompactPathExW due to compiler errors for ANSI version. PathCompactPathEx(&vt[0], filename.c_str(), filenameLen + 1, 0); strTemp.append(convertFileName(vt.begin(), vt.begin() + lstrlen(&vt[0]))); } else { // (filenameLen < 0) generic_string::const_iterator it = filename.begin(); if (filenameLen == 0) it += PathFindFileName(filename.c_str()) - filename.c_str(); // MAX_PATH is still here to keep old trimming behaviour. if (filename.end() - it < MAX_PATH) { strTemp.append(convertFileName(it, filename.end())); } else { strTemp.append(convertFileName(it, it + MAX_PATH / 2 - 3)); strTemp.append(TEXT("...")); strTemp.append(convertFileName(filename.end() - MAX_PATH / 2, filename.end())); } } return strTemp; }
vector<vector<int>> generateMatrix(int n) { vector< vector<int> > matrix(n); //vector< vector<int> > matrix; //matrix.clear(); for(int i = 0; i < n; i++){ vector<int> vt(n, 0); matrix[i] = vt; // matrix.push_back(vt); } int pos = 1; for(int i = 0; i < n/2; i++) { putCircle(matrix, pos, i, i, n-1-i, n-1-i); } if(n%2) matrix[n/2][n/2] = pos; return matrix; }
// static bool LLService::registerCreator(const std::string& name, creator_t fn) { llinfos << "LLService::registerCreator(" << name << ")" << llendl; if(name.empty()) { return false; } creators_t::value_type vt(name, fn); std::pair<creators_t::iterator, bool> rv = sCreatorFunctors.insert(vt); return rv.second; // alternately... //std::string name_str(name); //sCreatorFunctors[name_str] = fn; }