mathematica 递阶结构模型的建立

为了保证程序不出错 这里贴的是代码格式而非纯文本 请粘贴到mathematica中后阅读

m = ( {
     {1, \[Placeholder], \[Placeholder], \[Placeholder], \
\[Placeholder], \[Placeholder], \[Placeholder]},
     {1, 1, \[Placeholder], \[Placeholder], \[Placeholder], \
\[Placeholder], \[Placeholder]},
     {\[Placeholder], \[Placeholder], 1, 1, 1, 1, \[Placeholder]},
     {\[Placeholder], \[Placeholder], \[Placeholder], 1, 1, 
      1, \[Placeholder]},
     {\[Placeholder], \[Placeholder], \[Placeholder], \[Placeholder], 
      1, \[Placeholder], \[Placeholder]},
     {\[Placeholder], \[Placeholder], \[Placeholder], 1, 1, 
      1, \[Placeholder]},
     {1, 1, \[Placeholder], \[Placeholder], \[Placeholder], \
\[Placeholder], 1}
    } ) /. \[Placeholder] -> 0;
r = Flatten[Position[#, 1] & /@ m, {3, 1}](*可达集*)
a = Flatten[Position[#, 1] & /@ Transpose@m, {3, 1}](*先行集*)
c = MapThread[Intersection, {r, a}](*共同集*)
b = Flatten@Position[MapThread[Equal, {c, a}], True]

r=DeleteCases[r,Alternatives@@b,2](*删去已分层要素*)
a=DeleteCases[a,Alternatives@@b,2]
b=Flatten@Position[MapThread[Equal,{c,a}],True]

猜你喜欢

转载自blog.csdn.net/u011086331/article/details/83029627