gpt4 book ai didi

wolfram-mathematica - Mathematica 中 Flatten 的倒数?

转载 作者:行者123 更新时间:2023-12-04 16:30:16 26 4
gpt4 key购买 nike

f[x_]:=Flatten[x] 的倒数是什么,其中 x 是维度变暗的数组?

最佳答案

没有内置函数,但结合 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

关于wolfram-mathematica - Mathematica 中 Flatten 的倒数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3807976/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com