http://www.mathworks.cn/cn/help/distcomp/advanced-topics.html
PARFOR loops work by dividing the iterations of the loop among many
workers. Things work best when the inputs to the loop and outputs from
the loop can also be divided in the same way. The simplest example might
be:

N = 10;
in1 = rand(1, N);
in2 = rand(1, N);
out2 = 0;
parfor ii = 1:N
  out1(ii) = in1(ii) * 2 + max(in2);
  out2 = out2 + in1(ii);
end

In this case, both 'in1' and 'out1' are SLICED because PARFOR can see
how to divide them up - not all of 'in1' or 'out1' are required to
perform an iteration of the loop. 'in2' is *not* sliced, because the
whole value is needed for each loop iteration. 'out2' is not sliced
either, but PARFOR can still compute the value because it understands
that it is a REDUCTION variable. More info:

<http://www.mathworks.com/help/toolbox/distcomp/brdqtjj-1.html>

PARFOR warns you if you have a variable inside a PARFOR loop that you're
indexing, but that isn't sliced. This warning appears because you might
have intended the variable to be sliced, but PARFOR couldn't slice it.

PARFOR can slice multi-dimensional arrays providing that the indexing
expression matches various conditions layed out in the page referred to
above. For example:

in3 = rand(N);
parfor ii=1:N
  out3(:,ii) = 1 - in3(:,ii);
end

both 'in3' and 'out3' can be sliced.

Cheers,

Edric.

parfor slice的更多相关文章

  1. Matlab slice方法和包络法绘制三维立体图

    前言:在地球物理勘探,流体空间分布等多种场景中,定位空间点P(x,y,x)的物理属性值Q,并绘制三维空间分布图,对我们洞察空间场景有十分重要的意义. 1. 三维立体图的基本要件: 全空间网格化 网格节 ...

  2. jQuery之常用且重要方法梳理(target,arguments,slice,substring,data,trigger,Attr)-(一)

    1.jquery  data(name) data() 方法向被选元素附加数据,或者从被选元素获取数据. $("#btn1").click(function(){ $(" ...

  3. js url.slice(star,end) url.lastIndexOf('/') + 1, -4

    var url = '"http://60.195.252.25:15518/20151228/XXSX/作三角形的高.mp4")' document.title = url.sl ...

  4. JavaScript中的slice,splice,substr,substring,split的区别

    万恶的输入法,在sublime中会显示出繁体字,各位看官见谅. 1.slice()方法:该方法在数组和string对象中都拥有. var a = [1,2,3,4,5,6]; var s = 'thi ...

  5. Max double slice sum 的解法

    1. 上题目: Task description A non-empty zero-indexed array A consisting of N integers is given. A tripl ...

  6. js中substr,substring,slice。截取字符串的区别

    substr(n1,n2) n1:起始位置(可以为负数) n2:截取长度(不可以为0,不可以为负数,可以为空) 当n1为正数时,从字符串的n1下标处截取字符串(起始位置),长度为n2. 当n1为负数时 ...

  7. JS 中 Array.slice() 和 Array.splice()方法

    slice slice()就是对应String的substring()版本,它截取Array的部分元素,然后返回一个新的Array: var arr = ['A', 'B', 'C', 'D', 'E ...

  8. 【javascript 技巧】Array.prototype.slice的妙用

    Array.prototype.slice的妙用 开门见山,关于Array 的slice的用法可以参考这里 http://www.w3school.com.cn/js/jsref_slice_arra ...

  9. golang中的slice翻转存在以及map中的key判断

    //slice翻转 func stringReverse(src []string){ if src == nil { panic(fmt.Errorf("the src can't be ...

随机推荐

  1. vs2015 VS-Visual Studio-IIS Express 支持局域网访问

    使用Visual Studio开发Web网页的时候有这样的情况:想要在调试模式下让局域网的其他设备进行访问,以便进行测试.虽然可以部署到服务器中,但是却无法进行调试,就算是注入进程进行调试也是无法达到 ...

  2. Qt532的QString输出各种编码的16进制数组(测试代码)

    环境:Win7x64.Qt5.3.2 MSVC2010 OpenGL.vs2010 1.只测试了 4种:Utf8.Latin1.Local8Bit.unicode 2.测试代码:(这个是 " ...

  3. Spring Bean的生命周期例子

    以下例子源于:W3Cschool,在此作记录 HelloWorld.java package com.how2java.w3cschool.beanlife; public class HelloWo ...

  4. 学习笔记16—Matlab 基础集

    1.常用相关 [r, p] = corr(X,Y), [r, p] = partialcorr(X,Y, Z) , 其中Z是协变量. 2.TD_age = importdata('F:\BrainAg ...

  5. 牛客国庆集训派对Day3 G Stones

    Stones 思路: sg函数打表找规律 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #in ...

  6. USBCAN的使用和上位机开发(MFC)

    USBCAN使用手册 参见:https://blog.51cto.com/12572800/2062839 1. USB CAN软件安装与硬件接线 USB CAN是常用的CAN测试工具.它的软件资料存 ...

  7. Elasticsearch-基础介绍及索引原理分析

    介绍 Elasticsearch 是一个分布式可扩展的实时搜索和分析引擎,一个建立在全文搜索引擎 Apache Lucene(TM) 基础上的搜索引擎.当然 Elasticsearch 并不仅仅是 L ...

  8. LeetCode--349--两个数组的交集

    问题描述: 给定两个数组,编写一个函数来计算它们的交集. 示例 1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2] 示例 2: 输入: nums1 = [4 ...

  9. java.——最大子序列和(前提是:全部都是非负数)

    直接上代码吧: 情况一:全部是非负数整数的时候,其实非负实数处理也一样. package Person; import java.util.Scanner; public class Main{   ...

  10. ubuntu opencv

    sudo apt-get updatesudo apt-get upgrade sudo apt-get install build-essential libgtk2.0-dev libjpeg-d ...