当x是维数为dim的数组时,fx_:=Flattenx的倒数是多少?
发布于 2010-09-28 06:07:35
虽然没有内置的函数,但是结合使用Fold和Partition非常简单:
In[47]:= x1 = RandomReal[{0, 1}, {3, 4, 5}];
In[48]:= dims = Dimensions[x1]
Out[48]= {3, 4, 5}
In[49]:= x2 = Fold[Partition, Flatten[x1], Most[Reverse[dims]]];
In[50]:= x1 == x2
Out[50]= True发布于 2010-09-28 06:06:16
您可能需要Partition[]或它的某个相关成员。
https://stackoverflow.com/questions/3807976
复制相似问题