当前位置: 首页>>代码示例>>C++>>正文


C++ blocked_range::begin方法代码示例

本文整理汇总了C++中blocked_range::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ blocked_range::begin方法的具体用法?C++ blocked_range::begin怎么用?C++ blocked_range::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在blocked_range的用法示例。


在下文中一共展示了blocked_range::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: indexArray

  void operator_2( const blocked_range<size_t>& r ) {   
	double value;
	IntVector indexArray(m_lenArray.size());
	DoubleVector argArray(m_lenArray.size());	
    Index1DToArray(r.begin(), m_lenArray, indexArray);

	int nStride0 = m_ControlGridArray[0].strides()[0];
	const char *pBegin0 = (const char*) (m_ControlGridArray[0].array().data());
	const char *pEnd0 = pBegin0 + (nStride0 * m_lenArray[0]);
	const char *pData0 = pBegin0 + (nStride0 * indexArray[0]);
	int nStride1 = m_ControlGridArray[1].strides()[0];
	const char *pBegin1 = (const char*) (m_ControlGridArray[1].array().data());
	const char *pEnd1 = pBegin1 + (nStride1 * m_lenArray[1]);
	const char *pData1 = pBegin1 + (nStride1 * indexArray[1]);
	
    for( size_t index=r.begin(); index!=r.end(); ++index ){
      argArray[0] = * (double*) pData0;
	  argArray[1] = * (double*) pData1;

  	  value = m_params.objectiveFunction(argArray);	  
      if (value > m_value_of_max) {
        m_value_of_max = value;
		m_argmax = argArray;
      }

	  pData1 += nStride1;
	  if (pData1 == pEnd1) {
	    pData1 = pBegin1;
	    pData0 += nStride0;
	  }	  
    }
  }
开发者ID:Twizanex,项目名称:bellman,代码行数:32,代码来源:maximizer.cpp

示例2: operator

 void operator() (blocked_range<size_t>& r) const {
     utility::FastRandom my_random((unsigned int)r.begin());
     for (size_t i=r.begin(); i!=r.end(); ++i) {
         for (size_t j=0; j<i; ++j) {
             if (die_toss(i, j, my_random))
                 edges[i].push_back(j);
         }
     }
 }
开发者ID:YoonJungsik,项目名称:Kinect,代码行数:9,代码来源:shortpath.cpp

示例3: operator

    void operator() (const blocked_range<int>& range) const
    {
        double di, dj;
        int i, j;
        double tarw = 1.0;
        double pixpitch = tarw/(double)width;
        unsigned char pa = 0;
        vector mainvector = m;
        //color *Color = c;
        color *Color = (color*)malloc(sizeof(color));
        //color *diffuse = (color*)malloc(sizeof(color));
        color diffuse;
        for (i = range.begin(); i != range.end(); i++)
            for (j = 0; j < height; j++)
            {
                Color->g = 0;
                diffuse.g = 0;
                di = (double)i;
                dj = (double)j;
                vector side;
                side.x = mainvector.y;
                side.y = -mainvector.x;
                side.z = 0.0;
                vector up;
                cross(up, mainvector, side);
                normalize(side, (di - (double)width/2.0)*pixpitch);
                normalize(up, (dj - (double)height/2.0)*pixpitch);
                vector ray;
                ray.x = Model.cameratarget.x + side.x + up.x - Model.camera.x;
                ray.y = Model.cameratarget.y + side.y + up.y - Model.camera.y;
                ray.z = Model.cameratarget.z + side.z + up.z - Model.camera.z;
                vector tempray;
                tempray.x = ray.x;
                tempray.y = ray.y;
                tempray.z = ray.z;
                raytrace( Color, Model.camera, ray, -1, 0, -1);
                if (Color->g < DIFFUSECOLORTHRESHOLD)
                {
                    diffusetrace(&diffuse, Model.camera, tempray, -1, 0 , -1);
                    Color->g += diffuse.g;
                }

                //Color->g += diffuse.g;
                if (Color->g >1) Color -> g = 1;
                pa = (unsigned char)(Color->g*255);
                //unsigned char pa = Color->g*255;
                memcpy(&pictureArray[i][j],&pa,sizeof(unsigned char));

            }
        printf("processing %d - %d x %d \n", range.begin(), range.end(), height );

    }
开发者ID:Eugenpaul,项目名称:Raytracing,代码行数:52,代码来源:main.cpp

示例4: operator_cp

  void operator_cp( const blocked_range<size_t>& r ) {   
    char *pData = NULL;    
	double value;

    CartesianProductIterator iter(m_ControlGridArray, r.begin());    
	CartesianProductIterator end(m_ControlGridArray, r.end());    
    for( size_t index=r.begin(); index!=r.end(); ++index, iter++ ){
	  value = m_params.objectiveFunction(*iter);
      if (value > m_value_of_max) {
        m_value_of_max = value;
		m_argmax = *iter;
      }
    }
  }
开发者ID:Twizanex,项目名称:bellman,代码行数:14,代码来源:maximizer.cpp

示例5: operator

    void operator() (const blocked_range<uint64>& r)
    {
        const size_t size = v.size();
        for ( uint64 i=r.begin(); i<r.end(); ++i )
        {
            int len = 1;
            uint64 n = i;
            while ( n != 1 )
            {
                if ( n % 2 == 0 )
                {
                    n = n/2;
                    if ( n<size )
                    {
                        // TODO: Remove if here
                        const short len1 = -v[size_t(n)];
                        if ( len1 > 0 )
                        {
                            len += len1;
                            break;
                        }
                    }
                }
                else
                    n = 3*n + 1;

                ++len;
            }
            updateResult(res, i, len);
        }
    }
开发者ID:stefan0x53,项目名称:sparrow,代码行数:31,代码来源:P1_Collatz.cpp

示例6: operator

 void operator()( const blocked_range<int*>& r ) {
     int temp = value;
     for( int* a=r.begin(); a!=r.end(); ++a ) {
         temp += *a;
     }
     value = temp;
 }
开发者ID:DarkDimius,项目名称:scala-blitz,代码行数:7,代码来源:tbb_array_reduce.cpp

示例7: operator

 void operator()( const blocked_range<MyString*> range ) const {
     for( MyString* p=range.begin(); p!=range.end(); ++p ) {
         StringTable::accessor a;
         table.insert( a, *p );
         a->second += 1;
     }
 }
开发者ID:Klaim,项目名称:aos-cpp-dependencies,代码行数:7,代码来源:count_strings.cpp

示例8: sqrt

void
SOMap::epoch_update_range( SOM_element const &s, int epoch, int min_x, int min_y, double radius, double learning_rate, blocked_range<int> &r) {
    int min_xiter = (int)((double)min_x - radius);
    if(min_xiter < 0) min_xiter = 0;
    int max_xiter = (int)((double)min_x + radius);
    if(max_xiter > (int)my_map.size()-1) max_xiter = (int)my_map.size()-1;
    for(int xx = r.begin(); xx <= r.end(); ++xx) {
        double xrsq = (xx-min_x)*(xx-min_x);
        double ysq = radius*radius - xrsq;  // max extent of y influence
        double yd;
        if(ysq > 0) {
            yd = sqrt(ysq);
            int lb = (int)(min_y - yd);
            int ub = (int)(min_y + yd);
            for(int yy = lb; yy < ub; ++yy) {
                if(yy >= 0 && yy < (int)my_map[xx].size()) {
                    // [xx, yy] is in the range of the update.
                    double my_rsq = xrsq + (yy-min_y)*(yy-min_y);  // distance from BMU squared
                    double theta = exp(-(radius*radius) /(2.0* my_rsq)); 
                    add_fraction_of_difference(my_map[xx][yy], s, theta * learning_rate);
                }
            }
        }
    }
}
开发者ID:adiog,项目名称:tbb,代码行数:25,代码来源:som.cpp

示例9: operator

	// Processing operator - in real life processes data for the range defined by 'r'
	//
	// This just calls TestThread.callback(r.begin(), r.end())
	// Designed to be called on any thread
	//
	void operator() (const blocked_range<int>& r ) const {
		// printf("operator() %d->%d\n", r.begin(), r.end());

		// Attach the current thread to the JVM, allowing access to the JVM environment through 'thrdEnv'
		JNIEnv *thrdEnv;
		jvm->AttachCurrentThread ((void **) &thrdEnv, NULL);

		// Get the TestThread instance as a jclass
		jclass cls = thrdEnv->GetObjectClass(testThread);
		if(cls==0) {
			fprintf(stderr, "GetObjectClass returned null\n");
			return;
		}

		// Get the method id for 'void TestThread.callback(int, int)'
		jmethodID mid = thrdEnv->GetMethodID(cls, "callback", "(II)V");
		if(mid==0) {
			fprintf(stderr, "GetMethodID returned null\n");
			return;
		}

		// Now call the actual method
		jint s = r.begin();
		jint e = r.end();
		thrdEnv->CallVoidMethod(testThread, mid, s, e );

		// And detach our thread
		jvm->DetachCurrentThread();
	};
开发者ID:openparallel,项目名称:JavaTBB_POC,代码行数:34,代码来源:NativeThread.cpp

示例10: operator

 void operator() (const blocked_range<int>& range) const{
   int begin=range.begin();
   begin++;
   for ( int i = begin; i<=range.end(); ++i){
      input[i]=input[i-1]+input[i];
   }
 }
开发者ID:Gorfaal,项目名称:CIS410Parallel,代码行数:7,代码来源:tbbNotQuiteRight.cpp

示例11: operator

	void operator()( const blocked_range<int>& range ) const
	{
		for( int i=range.begin(); i!=range.end(); ++i )
		{
			(*proc)(tiles[i],ImgRef1,ImgRef2,FeatMat);
		}
	}
开发者ID:evansf,项目名称:SWPhase2,代码行数:7,代码来源:InspectPrivateWave.cpp

示例12: operator

                void operator()(const blocked_range<int>& r) const {
                	char tempChar = ciChar;
                	for(int i = r.begin(); i!= r.end(); i++) {
                        	tempChar = tempChar ^ getBit((&list[i]),loop); 	
                        }
				cyText[loop] = tempChar;
  	           
                 }
开发者ID:mleef,项目名称:Parallel-Programming-Projects,代码行数:8,代码来源:tbb_crypto.cpp

示例13: operator

 void operator()( const blocked_range<size_t>& r ) const {
     for( size_t i=r.begin(); i!=r.end(); ++i )
     {
     	Iterate(*object_points, *image_points, *camera_matrix, *dist_coeffs,
     	        *resultRvec, *resultTvec, max_dist, min_inlier_num,
     	        inliers, use_extrinsic_guess, rvecInit, tvecInit, *rng, ResultsMutex);
     }
 }
开发者ID:RoboWGT,项目名称:robo_groovy,代码行数:8,代码来源:pnp_ransac.cpp

示例14: operator

void Render::operator()(const blocked_range<int>& r) const
{
	for (int j = r.begin(); j != r.end(); j++) {
		for (int i = 0; i < rt->cam.pw; i++) {
			rt->getPixel(i, j);
		}
	}
}
开发者ID:rxtsolar,项目名称:rtanimate,代码行数:8,代码来源:raytracer.cpp

示例15: operator

			void operator()( const blocked_range<size_t> &r ) const
			{
				Imath::Rand32 rand;
				for( size_t i=r.begin(); i!=r.end(); ++i )
				{
					std::string s = lexical_cast<std::string>( rand.nexti() % 1000 );
					InternedString ss( s );
				}
			}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:9,代码来源:InternedStringTest.cpp


注:本文中的blocked_range::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。