我正在运行 Mathematica 7,并且正在尝试Do
使用ParallelDo
. 以下标准的顺序代码可以正常工作:
len = 10;
A = Table[0, {len}];
Do[
A[[i]] = i*10;
, {i, 1, len}]
但是,如果我使用ParallelDo
而不是 standard Do
,则此代码会给出错误消息:
len = 10;
A = Table[0, {len}];
ParallelDo[
A[[i]] = i*10;
, {i, 1, len}]
我收到的错误消息是:
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
General::stop: Further output of Set::noval will be suppressed during this calculation.
General::stop: Further output of Set::noval will be suppressed during this calculation.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
我能做些什么来并行运行这个Do循环吗?
谢谢!
安德鲁·德扬
卡内基·梅隆大学