parfor slice
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的更多相关文章
- Matlab slice方法和包络法绘制三维立体图
前言:在地球物理勘探,流体空间分布等多种场景中,定位空间点P(x,y,x)的物理属性值Q,并绘制三维空间分布图,对我们洞察空间场景有十分重要的意义. 1. 三维立体图的基本要件: 全空间网格化 网格节 ...
- jQuery之常用且重要方法梳理(target,arguments,slice,substring,data,trigger,Attr)-(一)
1.jquery data(name) data() 方法向被选元素附加数据,或者从被选元素获取数据. $("#btn1").click(function(){ $(" ...
- js url.slice(star,end) url.lastIndexOf('/') + 1, -4
var url = '"http://60.195.252.25:15518/20151228/XXSX/作三角形的高.mp4")' document.title = url.sl ...
- JavaScript中的slice,splice,substr,substring,split的区别
万恶的输入法,在sublime中会显示出繁体字,各位看官见谅. 1.slice()方法:该方法在数组和string对象中都拥有. var a = [1,2,3,4,5,6]; var s = 'thi ...
- Max double slice sum 的解法
1. 上题目: Task description A non-empty zero-indexed array A consisting of N integers is given. A tripl ...
- js中substr,substring,slice。截取字符串的区别
substr(n1,n2) n1:起始位置(可以为负数) n2:截取长度(不可以为0,不可以为负数,可以为空) 当n1为正数时,从字符串的n1下标处截取字符串(起始位置),长度为n2. 当n1为负数时 ...
- JS 中 Array.slice() 和 Array.splice()方法
slice slice()就是对应String的substring()版本,它截取Array的部分元素,然后返回一个新的Array: var arr = ['A', 'B', 'C', 'D', 'E ...
- 【javascript 技巧】Array.prototype.slice的妙用
Array.prototype.slice的妙用 开门见山,关于Array 的slice的用法可以参考这里 http://www.w3school.com.cn/js/jsref_slice_arra ...
- golang中的slice翻转存在以及map中的key判断
//slice翻转 func stringReverse(src []string){ if src == nil { panic(fmt.Errorf("the src can't be ...
随机推荐
- Cross Validation(交叉验证)
交叉验证(Cross Validation)方法思想 Cross Validation一下简称CV.CV是用来验证分类器性能的一种统计方法. 思想:将原始数据(dataset)进行分组,一部分作为训练 ...
- eclipse maven maven-compiler-plugin 报错 完全解决
报错如下: Maven install失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:comp ...
- requests:json请求中中文乱码处理
requests库中,在处理json格式的请求时调用的json.dumps方法参数ensure_ascii默认为True.表示序列化时对中文默认使用的ascii编码.如果想要显示中文,则将此参数的值改 ...
- 使用JDBC从数据库中查询数据的方法
* ResultSet 结果集:封装了使用JDBC 进行查询的结果 * 1. 调用Statement 对象的 executeQuery(sql) 方法可以得到结果集 * 2. ResultSet 返回 ...
- include
1. 自己写的文件都用:include "....." 2. 如果A类include了B,那么在主函数中,只用include A类,就可以使用B类了,但是此时不能再include ...
- CSS/让一个盒子消失的5中方法
1.display:none; 2.visibility:hidden; //这种方法隐藏了还是会占位的 3.raba(0,0,0,0.5); //可以调节a来改变透明度 a的取值 ...
- Codeforces 961E - Tufurama
961E - Tufurama 思路: 线段树或者分块 遍历 1 - n - 1,求 区间[i + 1, min(a[i], n)]大于等于 i 的个数,累加起来 线段树: #include<b ...
- PHP curl是什么
PHP curl是什么 一.总结 一句话总结:PHP支持的由Daniel Stenberg创建的libcurl库允许你与各种的服务器使用各种类型的协议进行连接和通讯. libcurl库 允许你与各种的 ...
- java ----> 基础之位运算
package test.ant; import java.util.Arrays; import java.io.UnsupportedEncodingException; public class ...
- python模块--time & datetime
time模块 #获取当前时间的时间戳 import time >>> time.time() 1535004894.0959966 #日期字符串转化成时间戳 >>> ...