• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ blocked_range类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: operator_2

  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


示例8: operator

    void operator() (const blocked_range<uint64>& r)
    {
        const size_t size = v.size();
        const size_t size2 = 2*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<size2 )
                    {
                        len += v[size_t(n - size)];
                        break;
                    }
                }
                else
                    n = 3*n + 1;

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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: operator

 void operator()( const blocked_range<int> &r, Tag tag) {
     for( int k = r.begin(); k < r.end(); ++k ) {
         // Code performs an "exclusive" scan, which outputs a value *before* updating the product.
         // For an "inclusive" scan, output the value after the update.
         if( tag.is_final_scan() )
             output[k] = product.v[0][1];
         product = product * Matrix1110;
     }
 }
开发者ID:artog,项目名称:Raytracer,代码行数:9,代码来源:Fibonacci.cpp


示例15: operator

		void operator()(const blocked_range<uint>& r) const {
			for(uint i=r.begin(); i!=r.end(); ++i) {
				uint base_index = c->bucket_accum[i];

				for(uint elem=0; elem < c->buckets[i].size(); ++elem) {
					(*(c->arr))[base_index + elem] = c->buckets[i][elem];
				}
			}
		}
开发者ID:Goon83,项目名称:parallel-sort,代码行数:9,代码来源:radix.tbb.cpp


示例16: operator

void operator() (blocked_range<size_t>&r)const
{
double *vA,*vB,*vR;
vA=vectA;
vB=vectB;
vR=resultVect;
for(size_t count=r.begin();count!=r.end();count++)
vR[count]=vA[count]*vB[count];
}
开发者ID:gauravkumar28,项目名称:btech-programs,代码行数:9,代码来源:vector_mul_2.cpp


示例17: operator

  void operator()(blocked_range<size_t>&r) {
    const float *a = array;
    for (size_t i = r.begin();  i != r.end(); ++i) {
      float value = array[i];
      if (value < value_of_min) {
	value_of_min = value;
	ind_of_min = i;
      }
    }
  }
开发者ID:mindis,项目名称:cpp-learn,代码行数:10,代码来源:minind.cpp


示例18: operator

 void operator()(const blocked_range<size_t>& r)
 {
     double rectWidth = * my_rects;
     double x;
     for(size_t i = r.begin(); i != r.end(); ++i)
     {
         x = (i + 0.5) * rectWidth;
         partialHeight += 4.0 / (1.0 + x * x );
     }
 }
开发者ID:markmontymark,项目名称:kitchen-sink,代码行数:10,代码来源:intel_tbb.cpp


示例19: operator

  void operator() (blocked_range<size_t> const& r)
  {
    float* arr = m_arr;
    float  sum = m_sum;
    size_t end = r.end();
    for (size_t i=r.begin(); i!=end; ++i)
      sum += Foo(arr[i]);

    m_sum = sum;
  }
开发者ID:MagnusTiberius,项目名称:code,代码行数:10,代码来源:reduce.cpp


示例20: operator

    void operator()( const blocked_range<int>& range ) const {
        for( int i=range.begin(); i!=range.end(); ++i ) {
            int start = i<n ? 0 : i-n+1;
            int finish = i<m ? i+1 : m; 
            T sum = 0;
#pragma omp parallel for reduction(+:sum)
            for( int j=start; j<finish; ++j ) 
                sum += my_a[j]*my_b[i-j];
            my_c[i] = sum;
        }
    }
开发者ID:Zer0code,项目名称:LoLUpdater,代码行数:11,代码来源:test_openmp.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ bo类代码示例发布时间:2022-05-31
下一篇:
C++ block类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap