在GAUSS10的USER GUIDE里面,16-7页(pp.227)有一个图:Fig 16.1 structure tree for e1。如何定义这个复杂的tree?我的做法是:
struct example3 {matrix w; string array sa;}; //定义第三层的structure.
struct example3 e3; //e3作为第三层的structure的instance.
struct example2 {matrix z; struct example3 e3;};//定义第2层的structure.
struct example2 e2; e2=reshape(e2,3,1);//将e2变成一个3*1的array。
struct example1 {matrix x; matrix y; string str; struct example2 e2;};//定义第1层的structure.
struct example1 e1;
e1.e2[1,1].e3=reshape(e1.e2[1,1].e3, 2,1); //将第一个e3变成2*1的array。该操作成功。
e1.e2[3,1].e3=reshape(e1.e2[3,1].e3, 2,1); //将第3个e3变成3*1的array。该操作失败。
问题出在最后一步。出现错误:(0) : error G0058 : Index out of range
各位GAUSS大师帮我看看,解答一下。先跪谢!