text:
# generators corresponding to the invariants for E8
gam[3] := (1/2)*c(3);
gam[4] := (1/3)*(c(4)+2*t[0]^4);
gam[5] := (1/2)*(c(5)-3*t[0]*gam[4]+2*t[0]^2*gam[3]);
gam[6] := (1/5)*(c(6)-2*gam[3]^2-t[0]*gam[5]+t[0]^2*gam[4]-2*t[0]^6);
gam[9] := (1/2)*(2*c(6)*gam[3]+t[0]*c(8)+t[0]^2*c(7)-3*t[0]^3*c(6));
gam[10] := (1/3)*(gam[5]^2-2*c(7)*gam[3]-t[0]^2*c(8)+3*t[0]^3*c(7));
gam[15] := (1/2)*((c(8)-t[0]^2*c(6)+2*t[0]^3*gam[5]+3*t[0]^4*gam[4]-t[0]^8)*(c(7)-3*t[0]*c(6))-2*(gam[3]^2+c(6))*(gam[9]-c(6)*gam[3])):

# degree 2
    t[1] := -w[1]+w[2];
    t[2] := w[1]+w[2]-w[3];
    t[3] := w[2]+w[3]-w[4];
    t[4] := w[4]-w[5];
    t[5] := w[5]-w[6];
    t[6] := w[6]-w[7];
    t[7] := w[7]-w[8];
    t[8] := w[8];
    t[0] := w[2];

# Schubert class generators for E8
# X[[5,4,2]]
    x[3] := gam[3]-t[0]^3;
# X[[6,5,4,2]]
    x[4] := gam[4]-t[0]^4;
# X[[7,6,5,4,2]]
    x[5] := gam[5];
# X[[1,3,6,5,4,2]]
	x[6] := gam[6]-t[0]*gam[5]+t[0]^2*gam[4];
# X[[1,5,4,3,7,6,5,4,2]]
    x[9] := gam[9]-2*gam[3]^3-4*gam[3]*gam[6]-gam[4]*gam[5]-6*t[0]*gam[4]^2+5*t[0]*c(8)-4*t[0]^2*c(7)-2*t[0]^3*gam[3]^2+14*t[0]^3*gam[6]-5*t[0]^4*gam[5]-10*t[0]^5*gam[4]+10*t[0]^6*gam[3]+4*t[0]*gam[3]*gam[5]+14*t[0]^2*gam[3]*gam[4];
# X[[1,6,5,4,3,7,6,5,4,2]]
    x[10] := -gam[10]+gam[5]^2+2*t[0]^10-2*gam[3]^2*gam[4]-4*gam[4]*gam[6]+2*t[0]^2*gam[4]^2+2*t[0]^4*gam[3]^2+4*t[0]^4*gam[6]-4*t[0]^6*gam[4];
# X[[1,3,4,2,7,6,5,4,3,8,7,6,5,4,2]]
 	x[15] := 382*gam[3]*t[0]^12+241*gam[4]*t[0]^11+18*gam[3]^2*t[0]^9+4*gam[5]*t[0]^10-685*gam[3]*gam[4]*t[0]^8+gam[6]*t[0]^9+198*gam[3]*gam[5]*t[0]^7+22*t[0]^8*c(7)+604*gam[3]^2*gam[4]*t[0]^5+1094*gam[3]*gam[6]*t[0]^6+133*gam[4]*gam[5]*t[0]^6+3*t[0]^7*c(8)+130*gam[3]^2*gam[5]*t[0]^4+117*gam[3]*gam[4]^2*t[0]^4-194*gam[3]*t[0]^5*c(7)+513*gam[4]*gam[6]*t[0]^5+gam[9]*t[0]^6-795*gam[3]^3*gam[4]*t[0]^2-674*gam[3]^2*gam[6]*t[0]^3-83*gam[3]*gam[4]*gam[5]*t[0]^3+26*gam[3]*t[0]^4*c(8)+31*gam[4]*t[0]^4*c(7)+139*gam[5]*gam[6]*t[0]^4+gam[3]^5-181*gam[3]^3*gam[5]*t[0]+276*gam[3]^2*gam[4]^2*t[0]+190*gam[3]^2*t[0]^2*c(7)-945*gam[3]*gam[4]*gam[6]*t[0]^2+134*gam[3]*gam[9]*t[0]^3-6*gam[4]^2*gam[5]*t[0]^2-123*gam[4]*t[0]^3*c(8)-31*gam[5]*t[0]^3*c(7)+3*gam[6]^2*t[0]^3-gam[3]^3*gam[6]+4*gam[3]^2*gam[4]*gam[5]-258*gam[3]^2*t[0]*c(8)+32*gam[3]*gam[4]*t[0]*c(7)-96*gam[3]*gam[5]*gam[6]*t[0]+48*gam[3]*gam[10]*t[0]^2+165*gam[4]^2*gam[6]*t[0]+93*gam[4]*gam[9]*t[0]^2+11*gam[5]*t[0]^2*c(8)+107*gam[6]*t[0]^2*c(7)+5*gam[3]^2*gam[9]-29*gam[3]*gam[4]*c(8)-12*gam[3]*gam[5]*c(7)+6*gam[3]*gam[6]^2-6*gam[5]*gam[9]*t[0]-167*gam[6]*t[0]*c(8)+gam[5]*gam[10]+16*gam[6]*gam[9]+gam[15]:

# relations
# rational relations
rho[2] := c[2] -4*t[0]^2;
rho[8] := -3*c[8]+3*G[4]^2-2*G[3]*G[5]+t[0]*(2*c[7]-6*G[3]*G[4])+t[0]^2*(2*G[3]^2-5*G[6])+3*t[0]^3*G[5]+4*t[0]^4*G[4]-6*t[0]^5*G[3]+t[0]^8:
rho[12] := 15*G[6]^2+2*G[3]*G[4]*G[5]-2*c[7]*G[5]+2*G[3]^4+10*G[3]^2*G[6]-3*c[8]*G[4]-2*G[4]^3+t[0]*(c[8]*G[3]-2*G[3]^2*G[5]+4*c[7]*G[4]+6*G[3]*G[4]^2)+t[0]^2*(3*G[10]-25*G[4]*G[6]-c[7]*G[3]-16*G[3]^2*G[4])+t[0]^3*(25*G[3]*G[6]-3*G[4]*G[5]+10*G[3]^3)+t[0]^4*(3*c[8]+3*G[3]*G[5]+5*G[4]^2)+t[0]^5*(-3*c[7]-5*G[3]*G[4])+4*t[0]^6*G[3]^2-7*t[0]^8*G[4]+4*t[0]^9*G[3];
rho[14] := c[7]^2-3*c[8]*G[6]+6*G[4]*G[10]-4*c[8]*G[3]^2+6*c[7]*G[3]*G[4]-6*G[3]^2*G[4]^2-12*G[4]^2*G[6]-2*G[3]*G[5]*G[6]+t[0]*(24*G[3]*G[4]*G[6]-8*c[7]*G[3]^2-8*c[7]*G[6]+4*c[8]*G[5]-6*G[3]*G[10]+12*G[3]^3*G[4])+t[0]^2*(-2*G[3]*G[4]*G[5]+6*G[4]^3+2*G[3]^2*G[6]+20*G[6]^2-4*G[3]^4-c[7]*G[5])+t[0]^3*(-12*G[3]*G[4]^2+8*c[8]*G[3]-5*c[7]*G[4]+3*G[5]*G[6])+t[0]^4*(3*G[10]-26*G[4]*G[6]+6*c[7]*G[3]-4*G[3]^2*G[4])+t[0]^5*(24*G[3]*G[6]+3*G[4]*G[5]+12*G[3]^3)+t[0]^6*(-6*c[8]+2*G[4]^2)-4*t[0]^7*c[7]+t[0]^8*(6*G[6]-6*G[3]^2)-6*t[0]^10*G[4]+12*t[0]^11*G[3]-2*t[0]^14;
rho[18] := 4*G[3]^6-10*G[6]^3-9*c[7]*c[8]*G[3]-2*G[3]^3*G[4]*G[5]+2*c[7]*G[3]^2*G[5]+2*c[7]*G[5]*G[6]+c[8]*G[3]^2*G[4]+3*c[8]*G[4]*G[6]-6*c[7]*G[3]*G[4]^2+2*G[3]*G[5]*G[10]-10*G[3]*G[6]*G[9]+10*t[0]^18-2*G[3]*G[4]*G[5]*G[6]+G[9]^2+6*t[0]^13*G[5]+t[0]^12*(60*G[6]+18*G[3]^2)+t[0]^11*(3*c[7]+27*G[3]*G[4])+t[0]^10*(-4*c[8]-6*G[4]^2-13*G[3]*G[5])+t[0]^9*(6*G[9]-42*G[3]^3-99*G[3]*G[6])-12*t[0]^15*G[3]-9*t[0]^14*G[4]-9*c[8]*G[10]-6*G[4]^2*G[10]-4*G[3]^3*G[9]+6*G[3]^2*G[4]^3+12*G[4]^3*G[6]+2*c[7]^2*G[4]+t[0]^2*(24*G[3]^4*G[4]-2*c[8]^2-c[7]*G[9]-11*G[3]^2*G[10]+2*G[3]*G[4]*G[9]-2*c[8]*G[3]*G[5]+16*c[7]*G[3]*G[6]-3*c[7]*G[4]*G[5]+75*G[4]*G[6]^2-6*G[4]^4-9*c[8]*G[4]^2+81*G[3]^2*G[4]*G[6]-13*G[6]*G[10]+4*G[3]*G[4]^2*G[5]-c[7]*G[3]^3)+t[0]*(-2*G[3]*G[5]*G[9]-24*c[7]*G[4]*G[6]+8*c[8]*G[4]*G[5]+4*c[7]*G[3]^2*G[4]+4*c[7]*G[10]-c[8]*G[9]+2*c[7]^2*G[3]+4*c[8]*G[3]*G[6]+12*G[3]*G[4]*G[10]-36*G[3]*G[4]^2*G[6]+12*G[3]^2*G[5]*G[6]+c[8]*G[3]^3+6*G[3]^4*G[5]-18*G[3]^3*G[4]^2)+15*G[3]^2*G[6]^2+18*G[3]^4*G[6]+t[0]^3*(-3*G[5]*G[10]-150*G[3]*G[6]^2-135*G[3]^3*G[6]+6*G[3]^2*G[9]-2*c[7]*G[3]*G[5]+21*c[7]*G[4]^2+15*c[7]*c[8]+3*G[4]*G[5]*G[6]-3*G[3]^2*G[4]*G[5]+18*G[3]*G[4]^3+15*G[6]*G[9]+14*c[8]*G[3]*G[4]-30*G[3]^5)+t[0]^4*(-13*c[8]*G[6]+2*G[4]*G[10]-5*c[7]^2-33*G[3]^2*G[4]^2+3*G[5]*G[9]-28*G[3]*G[5]*G[6]-45*G[4]^2*G[6]-41*c[7]*G[3]*G[4]-13*G[3]^3*G[5]-9*c[8]*G[3]^2)+t[0]^5*(3*c[7]*G[6]-6*G[4]^2*G[5]+23*c[7]*G[3]^2+105*G[3]*G[4]*G[6]-6*c[8]*G[5]-3*G[4]*G[9]+45*G[3]^3*G[4])+t[0]^6*(11*G[4]^3-4*G[3]*G[9]+4*c[7]*G[5]+9*G[3]*G[4]*G[5]+12*G[3]^4+66*G[3]^2*G[6]+75*G[6]^2+2*c[8]*G[4])+t[0]^7*(-33*G[3]*G[4]^2+12*G[3]^2*G[5]+15*G[5]*G[6])+t[0]^8*(-4*G[10]+21*G[3]^2*G[4]-5*c[7]*G[3]-3*G[4]*G[6]);
rho[20] := 9*u[1]^20+45*u[1]^14*u[6]+12*u[1]^10*u[10]+60*u[1]^8*u[6]^2+30*u[1]^4*u[6]*u[10]+10*u[1]^2*u[6]^3+3*u[10]^2;
rho[24] := 11*u[1]^24+60*u[1]^18*u[6]+21*u[1]^14*u[10]+105*u[1]^12*u[6]^2+60*u[1]^8*u[6]*u[10]+60*u[1]^6*u[6]^3+9*u[1]^4*u[10]^2+30*u[1]^2*u[6]^2*u[10]+5*u[6]^4;
rho[30] := -9*u[15]^2-12*u[1]^9*u[6]*u[15]-6*u[1]^5*u[10]*u[15]+9*u[1]^14*u[6]*u[10]-10*u[1]^12*u[6]^3-3*u[1]^10*u[10]^2+30*u[1]^8*u[6]^2*u[10]-35*u[1]^6*u[6]^4+6*u[1]^4*u[6]*u[10]^2-10*u[1]^2*u[6]^3*u[10]-4*u[6]^5-2*u[10]^3;

# mod prime relations
rho[3] := c[3] - 2*G[3];
rho[4] := c[4]+2*t[0]^4 - 3*G[4];
rho[5] := c[5]-t[0]*c[4]+t[0]^2*c[3]-2*t[0]^5 - 2*G[5];
rho[6] := (c[6]-2*G[3]^2-t[0]*G[5]+t[0]^2*G[4]-2*t[0]^6) - 5*G[6];
rho[9] := c[6]*c[3]+t[0]*c[8]+t[0]^2*c[7]-3*t[0]^3*c[6] -2*G[9];
rho[10] := G[5]^2-2*c[7]*G[3]-t[0]^2*c[8]+3*t[0]^3*c[7] - 3*G[10];
rho[15]:=((c[8]-t[0]^2*c[6]+2*t[0]^3*G[5]+3*t[0]^4*G[4]-t[0]^8)*(c[7]-3*t[0]*c[6])-2*(G[3]^2+c[6])*(G[9]-c[6]*G[3])) - 2*G[15];

# auxiliary variables
aux :=
u[15] = -t^14*u[1]-12*t^15+131*t^4*u[1]^11+(-17*t^8+t^6*u[1]^2+11*t^5*u[1]^3+14*t^4*u[1]^4-4*t^2*u[1]^6+118*t*u[1]^7+3*u[1]^8)*G[3]*G[4]-6*G[3]^5-233*t^2*u[1]^13+(-2*t^12+6*t^11*u[1]+2*t^10*u[1]^2-20*t^9*u[1]^3+11*t^8*u[1]^4+22*t^7*u[1]^5-8*t^6*u[1]^6+83*t^5*u[1]^7+15*t^4*u[1]^8+5*t^3*u[1]^9-116*t^2*u[1]^10+t*u[1]^11+117*u[1]^12)*G[3]+175*t*u[1]^14-13*t^10*u[1]^5+9*t^8*u[1]^7-t^7*u[1]^8+3*u[1]*G[4]*G[10]-u[1]*G[5]*G[9]-58*u[1]^15+(-3*t+2*u[1])*G[3]^3*G[5]-3*u[1]*G[3]^2*G[4]^2-20*G[3]*G[6]^2+3*G[3]^2*G[9]-23*G[3]^3*G[6]+4*G[6]*G[9]+(-6*t^3-2*t^2*u[1]-6*t*u[1]^2+5*u[1]^3)*G[3]^4+(3*t^2*u[1]+u[1]^3)*G[4]^3+G[15]-6*u[1]*G[4]^2*G[6]+(t^2+t*u[1]-u[1]^2)*c[7]*G[3]^2+(-t^2-u[1]^2)*G[4]*G[9]+(5*t^2+6*t*u[1]+2*u[1]^2)*G[3]^3*G[4]+(3*t^2+4*t*u[1]+u[1]^2)*c[7]*G[6]-u[1]^3*G[3]*G[9]+(-2*t^4-4*t^3*u[1]-3*t*u[1]^3+3*u[1]^4)*c[7]*G[4]+(2*t^2*u[1]+3*t*u[1]^2)*c[7]*G[5]+(-33*t^3+t^2*u[1]-31*t*u[1]^2+13*u[1]^3)*G[3]^2*G[6]+(t^3-2*t^2*u[1]+t*u[1]^2-u[1]^3)*G[3]*G[4]*G[5]+6*t^12*u[1]^3+(-45*t^3+10*t^2*u[1]-40*t*u[1]^2)*G[6]^2+3*u[1]*c[7]*G[3]*G[4]+(-4*t+4*u[1])*G[3]*G[5]*G[6]+(9*t^2+12*t*u[1]+5*u[1]^2)*G[3]*G[4]*G[6]+(-9*t^4-6*t^3*u[1]-18*t^2*u[1]^2+5*t*u[1]^3-3*u[1]^4)*G[5]*G[6]+(-3*t^4-3*t^3*u[1]-7*t^2*u[1]^2+5*t*u[1]^3-4*u[1]^4)*G[3]^2*G[5]+(-t^4-6*t^3*u[1]-t^2*u[1]^2-3*t*u[1]^3)*G[3]*G[4]^2+(-3*t^4*u[1]-6*t^3*u[1]^2+3*t^2*u[1]^3+15*t*u[1]^4)*G[10]+(-3*t^4*u[1]+t^3*u[1]^2+5*t^2*u[1]^3+10*t*u[1]^4-u[1]^5)*c[7]*G[3]+(39*t^5-13*t^4*u[1]+8*t^3*u[1]^2+35*t^2*u[1]^3-31*t*u[1]^4-3*u[1]^5)*G[4]*G[6]+(15*t^5-2*t^4*u[1]+3*t^3*u[1]^2+14*t^2*u[1]^3-16*t*u[1]^4+3*u[1]^5)*G[3]^2*G[4]+(t^6-t^4*u[1]^2-t^3*u[1]^3-t^2*u[1]^4-t*u[1]^5-u[1]^6)*G[9]+(-13*t^6+12*t^5*u[1]+5*t^4*u[1]^2-56*t^3*u[1]^3+8*t^2*u[1]^4+21*t*u[1]^5+2*u[1]^6)*G[3]*G[6]+(6*t^6+3*t^5*u[1]+2*t^4*u[1]^2+7*t^3*u[1]^3+t^2*u[1]^4-8*t*u[1]^5+3*u[1]^6)*G[4]*G[5]+(-8*t^6+6*t^5*u[1]+2*t^4*u[1]^2-22*t^3*u[1]^3+6*t^2*u[1]^4+8*t*u[1]^5-2*u[1]^6)*G[3]^3+(-6*t^7+t^6*u[1]-7*t^4*u[1]^3+5*t^3*u[1]^4+3*t^2*u[1]^5+3*t*u[1]^6-63*u[1]^7)*G[4]^2+(-t^7+2*t^6*u[1]+t^5*u[1]^2-11*t^4*u[1]^3+6*t^3*u[1]^4+5*t^2*u[1]^5+6*t*u[1]^6+39*u[1]^7)*G[3]*G[5]-118*t^6*u[1]^9+(2*t^8+6*t^7*u[1]+3*t^6*u[1]^2-4*t^5*u[1]^3-15*t^4*u[1]^4+6*t^3*u[1]^5+3*t^2*u[1]^6-40*t*u[1]^7+59*u[1]^8)*c[7]-18*t^5*u[1]^10-6*t^3*u[1]^12+(-48*t^9+3*t^8*u[1]-41*t^7*u[1]^2+18*t^6*u[1]^3+16*t^5*u[1]^4-13*t^4*u[1]^5-67*t^3*u[1]^6+125*t^2*u[1]^7-15*t*u[1]^8-291*u[1]^9)*G[6]+(-18*t^9-3*t^8*u[1]-16*t^7*u[1]^2+10*t^6*u[1]^3-4*t^5*u[1]^4-8*t^4*u[1]^5-16*t^3*u[1]^6-23*t^2*u[1]^7-10*t*u[1]^8-115*u[1]^9)*G[3]^2+(-6*t^10-3*t^9*u[1]-9*t^8*u[1]^2+5*t^7*u[1]^3-5*t^6*u[1]^4-14*t^4*u[1]^6-52*t^3*u[1]^7+6*t^2*u[1]^8-60*t*u[1]^9+117*u[1]^10)*G[5]+(18*t^11-3*t^10*u[1]+5*t^9*u[1]^2+11*t^8*u[1]^3-28*t^7*u[1]^4+8*t^6*u[1]^5+20*t^5*u[1]^6-64*t^4*u[1]^7-15*t^3*u[1]^8+54*t^2*u[1]^9+178*t*u[1]^10-177*u[1]^11)*G[4]-31*t^9*u[1]^6+7*t^11*u[1]^4-10*t^13*u[1]^2,
u[10] = G[10]+u[1]*G[9]-u[1]^3*c[7]-u[1]*G[4]*G[5]+2*u[1]^2*G[4]^2-2*u[1]^2*G[3]*G[5]+G[3]*G[4]*(-6*t*u[1]^2+2*u[1]^3)+G[3]^2*(2*t^2*u[1]^2+2*t*u[1]^3-2*u[1]^4)+G[6]*(-5*t^2*u[1]^2+5*t*u[1]^3)+G[5]*(t^4*u[1]+3*t^3*u[1]^2+t^2*u[1]^3)+G[4]*(6*t^4*u[1]^2-3*t^3*u[1]^3-2*t^2*u[1]^4-t*u[1]^5+u[1]^6)+G[3]*(-6*t^5*u[1]^2-2*t^4*u[1]^3+4*t^3*u[1]^4+6*t^2*u[1]^5-4*t*u[1]^6+u[1]^7)+4*t^7*u[1]^3-6*t^5*u[1]^5+2*t^4*u[1]^6+t^3*u[1]^7-t^2*u[1]^8,
u[6] = 2*G[6]+G[3]^2-u[1]*G[5]+G[4]*(-t^2+u[1]^2)-u[1]^3*G[3]+t^6-t^4*u[1]^2+t^3*u[1]^3+t^2*u[1]^4-t*u[1]^5,
u[1] = t[8],
t = w[2];
#
rho[20] := subs(aux, rho[20]);
rho[24] := subs(aux, rho[24]);
rho[30] := subs(aux, rho[30]);

max_stars_repo_name: shizuo-kaji/Maple-flag-cohomology

max_issues_repo_name: shizuo-kaji/Maple-flag-cohomology

max_forks_repo_name: shizuo-kaji/Maple-flag-cohomology


text:
(*
 Copyright (C) 2017 M.A.L. Marques

 This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0. If a copy of the MPL was not distributed with this
 file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)

(* type: work_gga_x *)

f0 := x -> 1 + 0.0055*x^2/(1 + 0.0253*x*arcsinh(x)):
f1 := x -> -0.072*x/(1 + 2*4^(1/3)*x):

f := x -> f0(x) + f1(x):

ext: mpl

max_stars_repo_name: rdietric/lsms

max_issues_repo_name: rdietric/lsms

max_forks_repo_name: rdietric/lsms


text:
#This module implements `Partition`---Hakaru's replacement for Maple's
#endogenous and unwieldy `piecewise`.

#The outer data structure for a Partition is a function, PARTITION(...), (just like it
#is for piecewise.
Partition:= module()
  option package;

  # Constructor for Partition pieces
  global Piece;

local
  Umap := proc(f,x,$)
    f(op(0,x))( map( p -> Piece(f(condOf(p)),f(valOf(p))), piecesOf(x) )
              , `if`(nops(x)>1,map(f,[op(2..-1,x)]),[])[] )
  end proc,

  isPartitionPieceOf := proc( p, elem_t := anything )
    type(p, 'Piece(PartitionCond, elem_t)');
  end proc,

  isPartitionOf := proc( e, elem_t := anything )
    type(e, 'PARTITION(list(PartitionPiece(elem_t)))' ) or
    type(e, 'PARTITION(list(PartitionPiece(Or(elem_t,PieceRef))),list(elem_t))' );
  end proc,

  TYPES := table(
    [(PieceRef = 'And(specfunc(nonnegint,PieceRef),satisfies(x->nops(x)>0))')
    ,(PartitionCond = '{relation, boolean, `::`, specfunc({`And`,`Or`,`Not`}), `and`, `or`, `not`}')
    ,(PartitionPiece = 'isPartitionPieceOf')
    ,(Partition = 'isPartitionOf')
    ]),

  ModuleLoad::static:= proc()
    :-`print/PARTITION`:= proc()
      local SetOfRecords, branch;
      SetOfRecords := piecesOf(PARTITION(args));
      `print/%piecewise`(
        seq([ condOf(eval(branch)), valOf(eval(branch))][], branch= SetOfRecords))
    end proc;

    BindingTools:-load_types_from_table(TYPES);

    # global extensions to maple functionality
    :-`eval/PARTITION` :=
    proc(p, eqs, $)
      Umap(x->eval(x,eqs), p);
    end proc;

    # :-`depends/PARTITION` :=
    # proc(parts, nms, $)
    # local dp := (x -> depends(x, nms));
    #   # `or`(op ( map(p-> dp(condOf(p)) or dp(valOf(p)), parts) ), dp(x,);
    # end proc;

    :-`diff/PARTITION` := proc()
      local pw, wrt, dpw, r, r0, r1;
      wrt := args[-1];
      pw := PARTITION(args[1..-2]);
      pw  := PartitionToPW(pw);
      dpw := diff(pw, wrt);
      r   := thismodule:-PWToPartition(dpw, 'do_solve');
      r   := Pmap(simplify, r);
    end proc;

    :-`simplify/PARTITION` := Simpl;

    :-`convert/piecewise` := overload(
      [proc(p::Partition)
         option overload(callseq_only);
         PartitionToPW(Simpl:-stable_order(p));
       end proc, :-`convert/piecewise`]);

    VerifyTools[AddVerification](same_partition = proc(a,b,$) evalb(a=b) or SamePartition((x,y)->evalb(x=y),(x,y)->evalb(x=y),a,b) end proc);

    NULL
  end proc,

  ModuleUnload::static:= proc()
    NULL
  end proc,

  # abstract out all argument checking for map-like functions
  map_check := proc(p)
  local pos, err;
    if p::indexed then
      pos:= op(p);
      if not [pos]::[posint] then
        err := sprintf("Expected positive integer index; received %a", [pos]);
        return err;
      end if
    else
      pos:= 1
    end if;
    if nargs-1 <= pos then
      err := sprintf("Expected at least %d arguments; received %d", pos+1, nargs-1);
      return err;
    end if;
    if not args[pos+2]::Partition then
      err := sprintf("Expected a Partition; received %a", args[pos+2]);
      return err;
    end if;
    return pos;
  end proc,

  extr_conjs := proc(x,$)
    if x::{specfunc(`And`), `and`} then
      map(extr_conjs, [op(x)])[];
    else
      x
    end if
  end proc;
export
  piecesOf := proc(x, $)
    local ps, rs;
    ps := op(1,x);
    if nops(x)=2 then
      rs := op(2,x);
      ps := map(mapPiece(proc(c0,v0)
                  local c,c1,v,s; c,v := c0,v0; s := (x->x);
                  if v::PieceRef then
                    c1 := is_lhs((s,_)->type(s,name),c);
                    if c1<>FAIL then s := x->subs(c1,x) end if;
                    c, s(op(op(1,v),rs))
                  else
                    c, v
                  end if; end proc), ps );
    elif has(x,PieceRef) then
      error "found piece references (%1) but no table of pieces: %2", indets(x,PieceRef), x
    end if;
    ps;
  end proc,

  condOf := proc(x::specfunc(`Piece`),$)
    op(1,x);
  end proc,

  valOf := proc(x::specfunc(`Piece`),$)
    op(2,x);
  end proc,

  mapPiece := proc(f,$) proc(x::PartitionPiece,$) Piece(f(condOf(x), valOf(x))) end proc; end proc,
  ident := proc() args end proc,
  unPiece := mapPiece(ident),

  # This is an alternate (to PARTITION) constructor for partition, which has the
  # same call convention as piecewise, except there are no implicit cases. if
  # there is an otherwise case, its condition is the conjunction of negations of
  # the other conditions.
  ModuleApply := proc()::Partition;
    local ps, as, ops_r, i;
    if nargs=0 then
      error "empty partition";
    end if;
    ps := [args]; ops_r := iquo(nops(ps),2);
    if nops(ps)::odd then
      ps := [op(1..-2,ps), Not(bool_Or(seq(op(2*i-1,ps),i=1..ops_r))), op(-1,ps)];
      ops_r := ops_r+1;
    end if;
    ps := [seq(Piece(op(2*i-1,ps),op(2*i,ps)),i=1..ops_r)];
    PARTITION(ps);
  end proc,

  Pieces := proc(cs0,es0)::list(PartitionPiece);
    local es, cs, e, c;
    es := `if`(es0::{set,list},x->x,x->{x})(es0);
    cs := `if`(cs0::{set,list,specfunc(`And`),`and`},x->x,x->{x})(cs0);
    [seq(seq(Piece(c,e),c=cs),e=es)];
  end proc,

  #This is just `map` for Partitions.
  #Allow additional args, just like `map`
  Pmap::static:= proc(f)::Partition;
    local pair,pos,res;
    res := map_check(procname, args);
    if res::string then error res else pos := res; end if;
    PARTITION([seq(
      Piece(condOf(pair)
            ,f(args[2..pos], valOf(pair), args[pos+2..])
         ),pair= piecesOf(args[pos+1]))])
  end proc,

  # a more complex mapping combinator which works on all 3 parts
  # not fully general, but made to work with KB
  # also, does not handle extra arguments (on purpose!)
  Amap::static:= proc(
    funcs::[anything, anything, anything], #`appliable` not inclusive enough.
    part::Partition)::Partition;
    local pair,pos,f,g,h,doIt;
    (f,g,h) := op(funcs);
    #sigh, we don't have a decent 'let', need to use a local proc
    doIt := proc(pair)
    local kb0 := h(condOf(pair));
      Piece( f(condOf(pair), kb0),
             g(valOf(pair), kb0));
    end proc;
    PARTITION(map(doIt,piecesOf(part)));
  end proc,

  Foldr := proc( cons, nil, prt :: Partition, $ )
    foldr(proc(p, x) cons(condOf(p), valOf(p), x); end proc,nil,op(piecesOf(prt)));
  end proc,
  Foldr_mb := proc(cons,nil,prt)
    Case(Partition, x->Foldr(cons,nil,x), x->cons(true,x,nil))
  end proc,

  PartitionToPW := module()
    export ModuleApply; local pw_cond_ctx;
    ModuleApply := proc(x::Partition, $)
      option remember,system;
      local p, parts := piecesOf(x);
      if nops(parts) = 1 and is(op([1,1],parts)) then return op([1,2], parts) end if;
      parts := foldl(pw_cond_ctx, [ [], {} ], op(parts) );
      parts := [seq([condOf(p), valOf(p)][], p=op(1,parts))];
      if op(-2, parts) :: identical(true) then
        parts := subsop(-2=NULL, parts);
      end if;
      piecewise(op(parts));
    end proc;

    pw_cond_ctx := proc(ctx_, p, $)
    local ps, ctx, ctxN, cond, ncond;
      ps, ctx := op(ctx_); cond := condOf(p);
      cond := {extr_conjs(cond)};
      cond := remove(x->x in ctx, cond);
      ncond := `if`(nops(cond)=1
                    , negate_rel(op(1,cond))
                    , `Not`(bool_And(op(cond))) );
      cond := bool_And(op(cond));
      ctx := ctx union { ncond };
      [ [ op(ps), Piece(cond, valOf(p)) ], ctx ]
    end proc;
  end module,
  PartitionToPW_mb := Case(Partition, PartitionToPW, x->x),

  isShape := kind ->
  module()
    option record;

    export MakeCtx := proc(p0,_rec,kb)
      local p := p0, pw, p1, wps, ws, vs, cs, w, ps;
      if kind='piecewise' then
        p := Partition:-PWToPartition(p);
      end if;
      p1 := Partition:-Simpl:-remove_false_pieces(p,kb);
      w, p1 := Partition:-Simpl:-single_nonzero_piece(p1);
      if not w :: identical(true) or p1 <> p then
        [ w, p1 ]
      else
        ps := piecesOf(p);
        wps := map((x->_rec(valOf(x),kb)), ps);
        ws, vs, cs := map2(op, 1, wps), map2(op, 2, wps), map(condOf, ps);
        if nops(vs) > 0 and
          andmap(v->op(1,vs)=v, vs) and
          ormap(a->a<>{}, ws)
        then
          [ `bool_Or`( op( zip(`bool_And`, ws, cs) ) ) , op(1,vs) ];
        else
          [ true, p0 ];
        end if;
      end if;
    end proc;
    export MapleType := `if`(kind=`PARTITION`,'Partition','specfunc(piecewise)');
  end module,

  # Checks if the given Partition is semantically valid, i.e. the conditions are
  # all disjoint. This exploits the property that if each adjacent pair of
  # conditions is pairwise disjoint, then they are all disjoint
  # (i.e. disjointness is transitive).
  IsValid := proc(p::Partition,$)
    option remember, system;
    local i, cs; cs := map(condOf, piecesOf(p));
    for i from 2 to nops(cs) do
      if rel_coulditbe(op(i  ,cs), op(i-1,cs)) or
         rel_coulditbe(op(i-1,cs), op(i  ,cs)) then
        return false; end if;
    end do;
    return true;
  end proc,

  # convert a piecewise to a partition, which is straightforward except:
  # - if any of the branches are unreachable, they are removed
  # - if the last clause is (implicitly) `otherwise`, that clause is filled in
  #     appropriately
  # note that if the piecewise does not cover the entire domain,
  #   then this Partition will be 'invalid' (in the sense that it also
  #   will not cover the entire domain) - the 'correct' thing to do would
  #   probably be to add a new clause whose value is 'undefined'
  # the logic of this function is already essentially implemented, by KB
  # in fact, kb_piecewise does something extremely similar to this
  PWToPartition := module()
    export ModuleApply := proc(x::specfunc(piecewise),{_kb::t_kb:=KB:-empty})
      option remember, system;
      local p;
      p := semantically_Partition(x);
      if p=FAIL then general(x,_kb,_rest);
      else           p
      end if;
    end proc;

    # A special case in which the piecewise is of the form
    # piecewise(A {<=,<} C_0, V_0, ..,
    #           A {<=,<,=} C_i, V_i, ..,
    #           A {<=,<} C_n, V_n, V_{n+1})
    # Such a piecewise is semantically a Partition, but not syntactically so.
    # Returns FAIL if the piecewise is not of this form
    local semantically_Partition := proc(x::specfunc(piecewise), $)
                                 ::{Partition,identical(FAIL)};
      local ns, cs, i, vs;
      ns := nops(x);
      if ns <= 3 then return FAIL; end if;
      cs[0] := [seq(op(2*i-1, x),i=1..iquo(ns,2))];
      if ormap(c->not(c::relation), cs[0]) then return FAIL; end if;
      if ns::odd then
        # Assuming it is semantically a Partition, construct the otherwise case
        cs[0] := [ cs[0][], negate_rel(cs[0][-1]) ];
      end if;
      # Check if the conditions are of the desired form...
      cs[1] := map(c->classify_relation(c,x->type(x,realcons)),
                   cs[0]);
      if has(cs[1], FAIL)
         # Relations must be in {<,<=,=}
      or ormap(c->not(op(1,c) in { B_LO, B_HI, B_EQ }), cs[1])
         # First and last conditions may not be equalities
      or (op([1,1],c)=B_EQ or op([-1,1],c)=B_EQ)
         # Value branched on must be identical in each condition
      or not(the(map2(op,4,cs[1])))
         # Must be ordered accordingly
      or (cs[1] <> sort(cs[1],key=bnd_key))
      then return FAIL end if;
      # ...they are; build the resulting conditions
      cs[2] := map(negate_rel, cs[0]);
      cs[3] := [ true  , op(1..-2, cs[2]) ];
      cs[4] := [ true$2, op(1..-3, cs[2]) ];
      cs[3] := zip_k(
        proc(x,y,z)
          # No need to take the previous negated condition; it's implied by the
          # equality
          if    x::`=`   then  x
          # Skip over the previous negated condition if it's an inequality; take
          # the one before that instead (and strenghten it, since this condition
          # also includes the negation of the equality)
          elif  y::`<>`  then  bool_And(x, table([`<=`=`<`, `<`=`<`])[op(0,z)](op(z)))
          # General case
          else                 bool_And(x,y)
          end if;
        end proc, cs[0], cs[3], cs[4] );
      # Finally build the Partition
      vs    := [seq(op(2*i, x),i=1..iquo(ns,2)), `if`(ns::odd,op(-1,x),NULL)];
      PARTITION(zip(Piece, cs[3], vs));
    end proc;
    local bnd_key := (x->[op(3,x), table([B_LO, B_EQ, B_HI] =~ [0,1,2])[op(1,x)]]);

    local general := proc(x, kb::t_kb)::Partition;
      # each clause evaluated under the context so far, which is the conjunction
      # of the negations of all clauses so far
      local ctx := true, n := nops(x), cls := [], cnd, ncnd, i, q, ctxC, cl, p;

      # Checks if the piecewise is valid when translated literally to a Partition
      # if so, that Partition can be returned directly. This is not done by
      # default because the check calls `coulditbe' many times which is
      # potentially much more expensive than just building the Partition from
      # scratch. This should only be used when the piecewise comes from a solver
      # which may or may not already return a 'partition', and when it does return
      # a 'partition', the set of conditions is typically so complicated that
      # rebuilding it produces an unwieldy monster (e.g. SemiAlgebraic in the case
      # of e.g. RoundTrip/t62).
      if 'check_valid' in {_rest} then
        p := Partition(op(x));
        if IsValid(p) then return p end if;
      end if;

      # handles all but the `otherwise` case if there is such a case
      for i in seq(q, q = 1 .. iquo(n, 2)) do
        cnd := op(2*i-1,x); # the clause as given
        # if this clause is unreachable, then every subsequent clause will be as well
        if ctx :: identical(false) then return PARTITION( cls );
        else
          ctxC := bool_And(cnd, ctx);              # the condition, along with the context (which is implicit in pw)
          ctxC := Simpl:-condition(ctxC, kb, _rest);

        if cnd :: `=` then ncnd := lhs(cnd) <> rhs(cnd);
        else               ncnd := bool_Not(cnd) end if;

          ctx  := bool_And(ncnd, ctx);             # the context for the next clause

          if ctx :: identical(false,[]) then    # this clause is actually unreachable
            return(PARTITION(cls));
          else
          cls := [ op(cls), op(Pieces(ctxC,[op(2*i,x)])) ];
          end if;
        end if;
      end do;

      # if there is an otherwise case, handle that.
      if n::odd then
        ctx := Simpl:-condition(ctx, kb, _rest);
        if not ctx :: identical(false,[]) then
          cls := [ op(cls), op(Pieces(ctx,[op(n,x)])) ];
        end if;
      end if;

      if nops(cls) = 0 then
        WARNING("PWToPartition: the piecewise %1 produced an empty partition", x);
        return 0;
      end if;
      PARTITION( cls );
    end proc;
  end module,
  PWToPartition_mb := Case(specfunc(piecewise), PWToPartition, x->x),

  # applies a function to the arg if arg::Partition,
  # and if arg::piecewise, then converts the piecewise to a partition,
  # applies the function, then converts back to piecewise
  # this mainly acts as a sanity check
  AppPartOrPw := proc(f,x::Or(Partition,specfunc(piecewise)),
                      to_opts:=[], from_opts:=[])
    if x::Partition then f(x);
    else
      thismodule:-PartitionToPW(f(PWToPartition(x,op(to_opts))),op(from_opts))
    end if;
  end proc,

  #Check whether the conditions of a Partition satisfy a type (or a proc return
  #truefalse)
  ConditionsSatisfy := proc(P::Partition, test, $)
    local p, ty; ty := `if`(test::type,test,satisfies(test));
    for p in piecesOf(P) do if condOf(p)::ty then return true end if end do;
    false
  end proc,

  #Check whether the conditions of a Partition depend on any of a set of names.
  ConditionsDepend:= proc(P::Partition, V::{name, list(name), set(name)}, $)
    ConditionsSatisfy(P, x->depends(x,V));
  end proc,

  # The cartesian product of two Partitions
  PProd := proc(p0::Partition,p1::Partition,{_add := `+`})::Partition;
  local ps0, ps1, cs, cs0, rs, rs0, rs1, condOrder;
    # This first part is a special case to handle the subsets of Partitions
    # whose conditions are the same - we can add those directly.
    ps0 := piecesOf(p0); cs0 := map(condOf, ps0);
    condOrder := proc(c)
      # This relies on the fact that integers (numeric types in general) are
      # 'less than' everything else. This sorts the 2nd partition with pieces in
      # common with the 1st coming before other pieces (in the order they appear
      # in the first).
      local i := ListTools:-Search(c, cs0);
      `if`(i=0, c, i);
    end proc;
    ps1 := sort(piecesOf(p1), key=condOrder@condOf);
    # Add those pieces with identical conditions directly; return the rest as a
    # pair of pieces.
    cs := zip(proc(p0,p1)
                if condOf(p0)=condOf(p1) then
                  Piece(condOf(p0),_add(valOf(p0),valOf(p1))) ;
                else [p0,p1];
                end if;
              end proc, ps0,ps1);
    # Extract the pieces already processed above; those not processed are lists
    rs, cs := selectremove(c->type(c,list),cs);
    # Unzip the list of remaining pieces
    rs0, rs1 := map(k->map(r->op(k,r),rs),[1,2])[];
    # The actual cartesian product (of whats left)
    rs := map(r0->map(r1-> Piece( bool_And(condOf(r0),condOf(r1)), _add(valOf(r0),valOf(r1)) )
                      ,rs1)[],rs0);
    PARTITION([op(cs),op(rs)]);
  end proc,

  Simpl := module()
    export ModuleApply := proc()
      local p;
      p := do_Simpl_fin("outer",args);
      p := subsindets[flat](p,Partition,Factor);
    end proc;

    local do_Simpl_fin := proc(io::identical("inner","outer"))
      local k, r; k, r := do_Simpl(_rest)[];
      if io="inner" and r::Partition then
        Pmap(k, r)
      else
        k(r)
      end if;
    end proc;
    local do_Simpl := proc(p)
      option remember, system;
      local ps, qs, qs1, mk, as; as := _rest;
      if p :: Partition then
        [ (x->x),
        foldr((f,x)->f(x,as), p,
              reduce_branches,
              coalesce_equalities,
              remove_false_pieces,
              flatten,
              singular_pts) ];
      elif not hastype(p, Partition) then
        [ (x->x), p ]
      elif assigned(distrib_op_Partition[op(0,p)]) then
        ps := simpl_op_Partition[op(0,p)](p);
        if op(0,p)=op(0,ps) then
          mk := distrib_op_Partition[op(0,ps)];
          ps := [op(ps)];
          ps := map(x->do_Simpl_fin("inner",x,as), ps);
          ps, qs := selectremove_outerPartitions(ps);
          if nops(ps)=0 then
            return [(x->x), mk(op(qs))]
          end if;
          ps := foldr(((a,b)->
                       remove_false_pieces(Partition:-PProd(a,b,_add=mk))),
                      op(ps));
          [ x->mk(op(qs),x), ps ];
        else
          do_Simpl(ps,as);
        end if;
      else
        [ (x->x),
          subsindets(p,{Partition,indices(distrib_op_Partition,nolist)},
                     x->do_Simpl_fin("outer",x,as)) ];
      end if;
    end proc;
    local  simpl_op_Partition := table([`+`=factor,`*`=(x->x)]);
    export distrib_op_Partition := table([`+`=`+`,`*`=`*`]);

    # Selects those list elements which are Partitions, and those which are
    # `applyintegrand' with a Partition argument. In the latter case, the
    # `applyintegrand' is pushed down over the pieces.
    local selectremove_outerPartitions :=
    proc(ps0::list,$)::list(Partition),list;
      local ps, rs;
      ps[1], rs[1] := selectremove(type, ps0, Partition);
      ps[2], rs[2] := selectremove(type, rs[1],
                                   'NewSLO:-applyintegrand'
                                     (anything, Partition));
      ps[2] := map(p->Pmap(x->NewSLO:-applyintegrand(op(1,p),x),op(2,p)),
                   ps[2]);

      map(op, [ps[1],ps[2]]),
      [op(rs[2])] ;
    end proc;

    local Factor := proc(p::Partition)
      local ps, qs, zs, tycands, v, p1;
      ps := piecesOf(p);
      qs, zs := selectremove(x->valOf(x)<>0,ps);
      # Deal with only the simple case of one non-zero piece
      if not (nops(qs)=1 and nops(zs)=1) then return p end if;
      ps := valOf(op(1,ps));
      if not(ps :: factor_op_Partition) then return p end if;
      # Deal only with simple weights
      tycands := [ specfunc(NewSLO:-applyintegrand) ];
      tycands := select(`<>`,map(t -> indets[flat](ps, t), tycands), {});
      # Expect to find exactly one 'atom' type
      if nops(tycands)<>1 then return p end if;
      tycands := op([1,1,0],tycands);

      if ps::`+` then
        v[0] := ps;
        if has(ps, exp) then
          v[0] := convert(v[0], exp);
          v[0], v[1] := selectremove(type, convert(v[0], list, `*`), `+`);
          v[0], v[1] := map(`*`@op, [v[0], v[1]])[];
          v[0] := collect(v[0], tycands);

          v[2] := convert(v[0], exp);
        else
          v[0] := factor(v[0]);
          v[0], v[1] := selectremove(type, convert(v[0], list, `*`), `+`);
          v[0], v[1] := map(`*`@op, [v[0], v[1]])[];
        end if;
      elif ps::`*` then
        v[0] := [op(ps)];
        v[0], v[1] := selectremove(has, v[0], tycands);
        v[0], v[1] := map(`*`@op, [v[0],v[1]])[];
      else error "impossible"; end if;

      p1 := v[1]*subs(ps=v[0], p);
    end proc;
    # TODO: factor for `*` is completely untested
    local factor_op_Partition := {`+`};

    export flatten := module()
      export ModuleApply;
      local unpiece, unpart, flatten_with;

      ModuleApply := proc(pr0, { _with := [ 'Partition', unpart ] } )
        local ty, un_ty, pr1, pr2;
        ty, un_ty := op(_with);

        pr1 := subsindets(pr0, ty, un_ty);
        if pr0 <> pr1 then
          ModuleApply(pr1, _with=[ Or('Partiton',`*`), unpart ]);
        else
          pr0
        end if;
      end proc;

      # like Piece, but tries to not be a Piece
      unpiece := proc(c, pr, $)
        flatten_with(proc(mk_q, ps)
                       map(q -> Piece(bool_And(condOf(q),c),mk_q(valOf(q))), ps)[]
                     end proc,
                     x->Piece(c,x),
                     pr);
      end proc;

      unpart := curry(
        flatten_with,proc(mk_q, ps)
                       PARTITION(map(q -> unpiece(condOf(q),valOf(q)), ps))
                     end proc, x->x);

      flatten_with := proc(rec, fail, pr, $)
      local ps, ws;
        if pr :: Partition then
          ps := piecesOf(pr); ws := [];
        elif pr :: `*` then
          ps, ws := selectremove(q->type(q,Partition), [op(pr)]);
          if nops(ps) = 1 then
            ps := piecesOf(op(1,ps));
          else return fail(pr) end if;
        else
          return fail(pr);
        end if;
        rec(x->`*`(op(ws),x), ps);
      end proc;
    end module;

    # Technically a no-op since Partitions have set semantics, but provides a
    # stable (hopefully) order of pieces, which will matter once the Partition
    # is returned to Haskell; the final condition will be erased (replaced by an
    # 'otherwise') and we would like 1) for that to always be the same one (in
    # case changes to Partition simplification order the pieces slightly
    # differently) and 2) for that to be the most 'complex' one.
    export stable_order := proc(e::Partition)
      # hopefully `sort' is actually a stable sort...
      PARTITION( sort(piecesOf(e),key=condition_complexity@condOf) );
    end proc;

    export single_nonzero_piece_cps := proc(k)
      local r,p; r, p := single_nonzero_piece(_rest);
      if r :: identical(true) then
        args[2]
      else
        k(r, p);
      end if;
    end proc;

    export single_nonzero_piece := proc(e, { _testzero := Testzero })
      local zs, nzs;
      if e :: Partition then
        zs, nzs := selectremove(p -> _testzero(valOf(p)), piecesOf(e));
        if nops(nzs) = 1 then
          return condOf(op(1,nzs)) , valOf(op(1,nzs))
        end if;
      end if;
      true, e
    end proc;

    export remove_false_pieces := proc(e::Partition, kb := KB:-empty)
      PARTITION(remove(p -> type(KB:-assert(condOf(p), kb), t_not_a_kb), piecesOf(e)));
    end proc;

    local `&on` := proc(f,k,$) proc(a,b,$) f(k(a),k(b)) end proc end proc;
    local condition_complexity := proc(x)
      nops(indets(x,PartitionCond)) + nops(indets(x,specfunc({exp, ln})))
    end proc;

    local try_eval := proc(x,s,$)
      try eval(x,s)
      catch "numeric exception: division by zero": FAIL; end try;
    end proc;

    # Combines pieces whose conditions are of the form `x=A' and (`x<A' or
    # `A<x') and whose values are equal under the evaluation `x=A'
    export coalesce_equalities :=
    proc(e::Partition,{ _testequal := ((a,b) -> Testzero(a-b)) })
      local ps, eqs, rest, p, pcond, pval, pbnds, cand, cands, sb;
      ps := piecesOf(e);
      eqs, rest[0] := selectremove(x->condOf(x)::`=`, ps);
      for p in eqs do
        pcond := condOf(p); pval := valOf(p);
        pbnds := {`<`(op(pcond)), `>`(op(pcond))};
        cands, rest[1] := selectremove(x-> has(condOf(x),pbnds), rest[0]);
        cands, rest[2] := selectremove((x->try_eval(x,pcond)=pval)@valOf, cands);
        if nops(cands) = 0 then
          rest[0] := [ p, op(rest[0]) ];
        elif nops(cands) <= 2 then
          cand := op(1,cands);
          sb := select(b->has(condOf(cand),b), pbnds);
          ASSERT(nops(sb)=1); # assumes that both `x<A' and `x>A' won't appear
                              # in a single condition
          sb := op(1,sb);
          rest[0] :=
          [ applyop(x->subs(sb=`<=`(op(sb)),x), 1, cand),
            `if`(nops(cands)=2, op(2,cands), NULL),
            op(rest[2]), op(rest[1]) ];
        else
          error "should be impossible (invalid Partition?): %1", cands;
        end if;
      end do;
      PARTITION(rest[0]);
    end proc;

    export reduce_branches := proc(e::Partition, kb := KB:-empty, { _testequal := ((a,b) -> Testzero(a-b)) })
      local k, ks, i, ps1, ps; ps := piecesOf(e);
      userinfo(3, :-reduce_branches, printf("Input: %a\n", ps));

      if nops(ps)=1 then return op([1,2],ps); end if;

      # Categorize(group) by equality of piece values
      ps1 := [ListTools:-Categorize(_testequal &on valOf, ps)];
      # unless there are fewer groups than original pieces ...

      ks  := map(nops, ps1); # number of pieces per group

      # build the result
      ps1 := zip((p,k)->
                 Piece(bool_Or(condition(bool_Or(map(condOf,p)[]), kb,
                         `if`(k<>1,
                              ['do_solve', 'do_kb', 'do_check'],
                              ['reduce_conjs', 'do_kb']
                             )[])[]),
                       valOf(op(1,p)))
                 ,ps1, ks);
      userinfo(3, :-reduce_branches, printf("condition: %a\n", ps1));

      # replace the condition of each piece built from many others
      if nops(ps1) < nops(ps) and nops(ps1)>1 then
        for i in select(x->op(1,x)>1,sort(zip(`[]`,ks,[seq(1..nops(ks))]), key=(x->-op(1,x)))) do
          ps1 := piecesOf( replace_piece_cond(PARTITION(ps1), op(2,i)) );
        end do;
      end if;

      return PARTITION(ps1);
    end proc;

    # Replaces a piece (at given index) condition with the logically equivalent
    # one formed from the other pieces.
    export replace_piece_cond := proc(e::Partition, n::integer := -1, failure:=(x->x), cmp_score := [ (x->x), (x->x+1) ], $)
      local p_n, p_n1,ps,cmp; ps := piecesOf(e);
      if abs(n)>nops(ps) then
        error "index out of bound: %1", n;
      elif nops(ps)=1 then
        error "cannot replace in single piece Partition: %1", e
      end if;
      p_n := condOf(op(n, ps));                              # old condition
      p_n1 := Not(bool_Or(map(condOf,subsop(n=NULL,ps))[])); # new condition
      cmp := map(condition_complexity, [p_n1, p_n]);

      # a cheap metric for determining if the new condition is an improvement
      if `<=`(zip(apply, cmp_score, cmp)[]) then
        ps := subsop([n,1]=p_n1, ps);
        PARTITION(ps);
      else
        failure(PARTITION(ps));
      end if;
    end proc;

    # Removal of singular points from partitions
    # works with other things too!
    export singular_pts := module()
      local t_constant := (ns->x->(indets(x,And(name,Not(constant))) minus ns)={});
      local can_remove := proc(ns)
        local t1, t2;
        t1 := satisfies(t_constant(ns));
        t2 := satisfies(n->n in ns);
        'Or'(`=`(t2,{t1,t2}),`=`(t1,t2));
      end proc;

      local weakening := {`<=`=`<`, `>=`=`>`};
      local can_replace := proc(ns)
        local t := satisfies(n->n in ns);
        'And'('specfunc'(map(lhs,weakening)),
              {'anyfunc'('anything',t),'anyfunc'(t,'anything')});
      end proc;
      local do_replace := proc(c)
        table([op(weakening)])[op(0,c)](op(c));
      end proc;

      export ModuleApply := proc(sh, kb::t_kb:=KB:-empty,{_name_cands::list := [] })
        local ns, sh1; sh1 := sh;
        # todo: work with array types as well?
        ns := select(type, [op(kb)], And(KB:-t_kb_Introduce,anyfunc(anything,specfunc(`AlmostEveryReal`))));
        ns := map(curry(op,1), ns);
        ns := { op(ns), op(_name_cands) };
        if ns={} then return sh end if;

        sh1 := subsindets(sh1, can_remove(ns), _->false);
        sh1 := eval(eval(sh1, [`And`=bool_And,`Or`=bool_Or]));
        sh1 := subsindets(sh1, 'specfunc'('specfunc'(map(op,weakening)),Not), bool_Not@op);
        sh1 := subsindets(sh1, can_replace(ns), do_replace);
        subsindets[flat](sh1, Partition, pr->remove_false_pieces(pr,kb));
      end proc;
    end module; # singular_pts

    export condition := module()
      local is_extra_sol := x -> (x :: `=` and rhs(x)=lhs(x) and lhs(x) :: name);
      local postproc_for_solve := proc(ctx, ctxSlv)
                               ::{identical(false), list({boolean,relation,specfunc(boolean,And),`and`(boolean)})};
        local c, ctxC := ctxSlv;
        if ctxC = [] then
          ctxC := [] ;
        elif nops(ctxC)> 1 then
          ctxC := map(x -> postproc_for_solve(ctx, [x], _rest)[], ctxC);
        elif nops(ctxC) = 1 then
          ctxC := op(1,ctxC);
          if ctxC :: set then
            if ctxC :: identical('{}') then
              ctxC := NULL;
            else
              ctxC := remove(is_extra_sol, ctxC);
               # if all the solutions are 'extra', the solution is actually just
               # garbage. Maple can't really tell and doesn't just return the
               # empty set (no solutions) for these cases.
              if ctxC = {} then
                ctxC := ctx;
              else
                ctxC := bool_And(op(ctxC));
              end if;
            end if ;
            ctxC := [ctxC];
          elif ctxC :: specfunc('piecewise') then
            ctxC := PWToPartition(ctxC, _rest);
            ctxC := [ seq( map( o -> condOf(c) and o
                                , postproc_for_solve(ctx, valOf(c), _rest))[]
                           , c=piecesOf(ctxC) )] ;
          else
            ctxC := FAIL;
          end if;
        else
          ctxC := FAIL;
        end if;
        if ctxC = FAIL then
          error "don't know what to do with %1", ctxSlv;
        else
          ctxC;
        end if;
      end proc;

      # Removes each conjunct if it is true under the assumption of the others
      local do_reduce_conj := proc(x::specfunc(And), $)
        local i;
        if has(x, {idx,size}) then return x end if;

        bool_And(seq(
          `if`((is(op(i,x)) assuming
                op(subsop(i=NULL,[op(x)]))),
               NULL, op(i,x)),
          i=1..nops(x)));
      end proc;

      # For some reason, solve just disregards these sorts of conditions
      # altogether, but not when they appear on their own! e.g.
      #  solve( {a<>b} )       = {a=a,a<>b}
      #  solve( {Not(a<>b)} )  = {a=a,b=b}  -- but should be {..,a=b}
      #  solve( {a=0,b<>1} )   = {a=0,b=b}
      local can_solve := proc(c,$)
        evalb(not hastype(c, '`<>`({name,constant},{name,constant})')
          and not has(c, '{idx, PARTITION, Branch}'));
      end proc;

      export do_condition := proc(ctx, kb::t_kb := KB:-empty)::list(PartitionCond);
        option remember, system;
        local ctxC, ctxC1, ctxC_c, ctxC1_c, t;
        ctxC := ctx;
        if ctx :: identical(true) then
          error "Simpl:-condition: don't know what to do with %1", ctxC;
        end if;
        if 'do_kb' in {_rest} then
          ctxC1 := KB:-kb_subtract( KB:-assert( ctxC, kb ), kb );
          if nops(ctxC1)=1 and op([1,1], ctxC1)=KB:-assert then
            ctxC1 := op([1,2], ctxC1);
            ctxC1_c, ctxC_c := map(condition_complexity, [ctxC1,ctxC])[];
            if ctxC1_c < ctxC_c then
              ctxC := ctxC1;
            end if;
          end if;
        end if;
        if condition_complexity(ctxC)=1 then
          return [ctxC];
        end if;

        ctxC := KB:-chill(ctxC);
        if 'reduce_conjs' in {_rest} then
          ctxC := subsindets(ctxC,specfunc(And),do_reduce_conj)
        elif 'do_solve' in {_rest} and _Env_HakaruSolve<>false and can_solve(ctxC) then
          ctxC1 := solve({ctxC}, 'useassumptions'=true);
          if ctxC1 = ctxC then
            # sometimes solve returns unevaluated which confuses postproc because
            # it expects the typical output of solve
            ctxC := [ctxC];
          elif ctxC1 = NULL and indets(ctx, specfunc(`exp`)) <> {} then
            ctxC := [ctxC];
          else
            ctxC1 := postproc_for_solve(ctxC, [ctxC1], _rest);
            if 'do_check' in {_rest} and condition_complexity(ctxC)>condition_complexity(ctxC1) then
              ctxC := ctxC1;
            end if;
          end if;
          if indets(ctxC, specfunc({`Or`, `or`})) <> {} then
            userinfo(10, 'Simpl:-condition',
                     printf("output: \n"
                            "  %a\n\n"
                            , ctxC ));
          end if;
        else
          ctxC1 := ctxC;
          ctxC := [seq(simpl_relation(ctxC1, norty=t), t=['DNF','CNF'])];
          ctxC := eval(ctxC,`And`=bool_And);
          ctxC := op(1, sort(ctxC, key=condition_complexity));
          if ctxC :: specfunc(`Or`) then
            ctxC := [op(ctxC)]
          else
            ctxC := [ctxC];
          end if;
        end if;
        if 'no_split_disj' in {_rest} then
          ctxC := [ bool_Or(op(ctxC)) ];
        end if;
        ctxC := KB:-warm(ctxC);
        `if`(ctxC::list, ctxC, [ctxC]);
      end proc;

      export ModuleApply := ProfileFn(do_condition, 1);

    end module; #Simpl:-condition
  end module, #Simpl

  SamePartition := proc(eqCond, eqPart, p0 :: Partition, p1 :: Partition, $)
    local ps0, ps1, pc0, the;
    ps0, ps1 := map(piecesOf,[p0,p1])[];
    if nops(ps0) <> nops(ps1) then return false end if;
    for pc0 in ps0 do
      the, ps1 :=
        selectremove(pc1 ->
          eqCond( condOf(pc1), condOf(pc0) ) and
          eqPart( valOf(pc1) , valOf(pc0)  )     ,ps1);
      if nops(the) <> 1 then
        return false;
      end if;
    end do;
    true;
  end proc
;
  uses Hakaru, Utilities;
  ModuleLoad();
end module:

max_stars_repo_name: vmchale/hakaru

max_issues_repo_name: vmchale/hakaru

max_forks_repo_name: vmchale/hakaru


text:
(*
 Copyright (C) 2017 M.A.L. Marques

 This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0. If a copy of the MPL was not distributed with this
 file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)

(* type: gga_exc *)

$define lda_c_pw_params
$include "lda_c_pw.mpl"

pw91_C_c0  := 4.235e-3:
pw91_alpha := 0.09:
pw91_nu    := 16/Pi * (3*Pi^2)^(1/3):
pw91_beta  := pw91_nu*pw91_C_c0:

pw91_c1 := pw91_beta^2/(2*pw91_alpha):
pw91_c2 := 2*pw91_alpha/pw91_beta:

(* Equation (14) *)
A := (rs, z) -> pw91_c2/(exp(-2*pw91_alpha*f_pw(rs, z)/(mphi(z)^3*pw91_beta^2)) - 1):

(* Equation (13) *)
H0 := (rs, z, t) -> pw91_c1*mphi(z)^3*log(1
  + pw91_c2*(t^2 + A(rs, z)*t^4) / (1 + A(rs, z)*t^2 + A(rs, z)^2*t^4)
):

(* Pade parametrized form of C-xc found in
   M Rasolt & DJW Geldart, Phys. Rev. B 34, 1325 (1986)
*)
RS_a := [2.568, 23.266, 0.007389]:
RS_b := [1, 8.723, 0.472]:
RG_C_xc := rs -> (RS_a[1] + RS_a[2]*rs + RS_a[3]*rs^2)/(1000*(RS_b[1] + RS_b[2]*rs + RS_b[3]*rs^2)):

(* Equation (15) *)
C_xc0 := 2.568e-3:
C_x   := -0.001667:
h_a1  := -100 * 4/Pi * (4/(9*Pi))^(1/3):

H1 := (rs, z, t) -> pw91_nu * (RG_C_xc(rs) - C_xc0 - 3*C_x/7)
 * mphi(z)^3*t^2*exp(h_a1*rs*mphi(z)^4*t^2):

f_pw91 := (rs, z, xt, xs0, xs1) ->
  f_pw(rs, z) + H0(rs, z, tt(rs, z, xt)) + H1(rs, z, tt(rs, z, xt)):
f      := (rs, z, xt, xs0, xs1) -> f_pw91(rs, z, xt, xs0, xs1):


text:
(*
 Copyright (C) 2017 M.A.L. Marques

 This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0. If a copy of the MPL was not distributed with this
 file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)

(* type: work_mgga_x *)

a1 := (10/(3*(6*Pi*Pi)^(2/3)))^(4/5): (* (2/C_F)^(4/5) *):

f := (rs, x, t, u) -> a1*t^(4/5):


text:
var $myStruct < struct{
    @number i32,
    @p <* i8> }>
func $main ()i32{
     #Character
     var %sChar i8
     var %usChar i8
     #signed and unsigned short integer
     var %shortInt i16
     var %shortInt2 i16
     var %sShortInt i16
     var %sShortInt2 i16
     var %usShortInt i16
     var %usShortInt2 i16
     #signed and unsigned integer
     var %int1 i32
     var %sInt i32
     var %usInt i32
     var %usInt2 i32
     #signed and unsigned long integer
     var %long1 i64
     var %long2 i64
     var %sLong1 i64
     var %sLong2 i64
     var %usLong i64
     var %usLong2 i64
     var %lLong1 i64
     var %iLong2 i64
     var %sLlong1 i64
     var %sLlonog2 i64
     var %usLlong i64
     var %usLlong2 i64
     #float
     var %Float f32
     #double
     var %Double f64
     #long double
     var %lDouble f64
     #Address
     var %array <[10] i8>
     iassign<* i8>(
      array 1 a64<*[10] i8>(addrof a64 %array, constval i64 1),
      constval i32 120)}
 # EXEC: %irbuild Main.mpl
 # EXEC: %irbuild Main.irb.mpl
 # EXEC: %cmp Main.irb.mpl Main.irb.irb.mpl

max_stars_repo_name: harmonyos-mirror/OpenArkCompiler-test

max_issues_repo_name: harmonyos-mirror/OpenArkCompiler-test

max_forks_repo_name: harmonyos-mirror/OpenArkCompiler-test


text:
flavor 1
srclang 3
id 65535
numfuncs 7
import "InterfaceTest.mplt"
import "/home/bravewtz/Desktop/openarkcompiler/libjava-core/libjava-core.mplt"
entryfunc &LInterfaceTest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V
fileinfo {
  @INFO_filename "InterfaceTest.jar"}
srcfileinfo {
  1 "InterfaceTest.java"}
type $__class_meta__ <struct {
  @shadow <* void> final,
  @monitor i32 final,
  @classloader u16 final,
  @objsize u16 final,
  @itab <* void> final,
  @vtab <* void> final,
  @gctib <* void> final,
  @classinforo <* void> final,
  @clinitbridge <* void> final}>
type $__class_meta_ro__ <struct {
  @classname <* void> final,
  @ifields <* void> final,
  @methods <* void> final,
  @superclass_or_componentclass <* void> final,
  @numoffields u16 final,
  @numofmethods u16 final,
  @flag u16 final,
  @numofsuperclasses u16 final,
  @padding u32 final,
  @mod i32 final,
  @annotation i32 final,
  @clinitAddr i32 final}>
type $__method_info__ <struct {
  @method_in_vtab_index i64 final,
  @declaringclass i64 final,
  @addr i64 final,
  @mod i32 final,
  @methodname i32 final,
  @signaturename i32 final,
  @annotationvalue i32 final,
  @flag u16 final,
  @argsize u16 final,
  @padding u32 final}>
type $__method_info_compact__ <struct {
  @method_in_vtab_index i32 final,
  @addr i32 final,
  @lebPadding0 u8 final}>
type $__field_info__ <struct {
  @offset u64 final,
  @mod u32 final,
  @flag u16 final,
  @index u16 final,
  @typeName i64 final,
  @fieldname u32 final,
  @annotation u32 final,
  @declaringclass <* void> final}>
type $__field_info_compact__ <struct {
  @offset u32 final,
  @lebPadding0 u8 final}>
type $__superclass_meta__ <struct {
  @superclassinfo <* void> final}>
type $MUIDFuncDefTabEntry <struct {
  @funcUnifiedAddr u64}>
type $MUIDFuncInfTabEntry <struct {
  @funcSize u32,
  @funcName u32}>
type $MUIDFuncDefMuidTabEntry <struct {
  @muidLow u64,
  @muidHigh u64}>
type $MUIDDataDefTabEntry <struct {
  @dataUnifiedAddr u64}>
type $MUIDDataDefMuidTabEntry <struct {
  @muidLow u64,
  @muidHigh u64}>
type $MUIDUnifiedUndefTabEntry <struct {
  @globalAddress u64}>
type $MUIDUnifiedUndefMuidTabEntry <struct {
  @muidLow u64,
  @muidHigh u64}>
type $MUIDRangeTabEntry <struct {
  @tabBegin <* void>,
  @tabEnd <* void>}>
javaclass $LBase_3B <$LBase_3B>
javaclass $LDerived_3B <$LDerived_3B>
javainterface $LInter_3B <$LInter_3B> abstract
javaclass $LInterfaceTest_3B <$LInterfaceTest_3B> public
var $_C_STR_477e2dc723978d7245344fc51fc13e2b fstatic <[4] u64> readonly = [0, 0x1500000000, 0x65736142062a270a, 0x29286f6f662e]
var $_C_STR_d820ddedd204b763a52374e860ce318e fstatic <[5] u64> readonly = [0, 0x1b00000000, 0x69726544357c6116, 0x286f6f662e646576, 41]
var $_C_STR_a3cc511f7ef4b5079c824f99850ea7ef fstatic <[4] u64> readonly = [0, 0x1700000000, 0x65746e497a755c95, 0x29286f6f662e72]
var $Ljava_2Flang_2FSystem_3B_7Cout extern <* <$Ljava_2Fio_2FPrintStream_3B>> final public static
var $__cinf_Ljava_2Flang_2FString_3B <$__class_meta__>
func &MCC_GetOrInsertLiteral () <* <$Ljava_2Flang_2FString_3B>>
var $__vtb_LBase_3B fstatic <[12] <* void>> = [16, 24, 32, 36, 8, 4, 48, 12, 20, 44, 28, 10]
var $__itb_LBase_3B fstatic <[16] <* void>> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10]
var $__vtb_LInterfaceTest_3B fstatic <[11] <* void>> = [16, 24, 32, 36, 8, 4, 48, 12, 20, 44, 28]
var $__vtb_LDerived_3B fstatic <[12] <* void>> = [16, 24, 32, 36, 8, 4, 48, 12, 20, 44, 28, 18]
var $__itb_LDerived_3B fstatic <[16] <* void>> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18]
var $__cinf_LInter_3B <$__class_meta__> public
var $__methods_info__LInter_3B fstatic <[1] <$__method_info__>> public = [[1= 0, 2= addrof ptr $__cinf_LInter_3B, 3= addroffunc ptr &LInter_3B_7Cfoo_7C_28_29V, 4= 0x400001, 5= 36, 6= 52, 7= 68, 8= 0x2e00, 9= 1, 10= 0]]
var $__classinforo__LInter_3B fstatic <$__class_meta_ro__> public = [1= 4, 2= 0, 3= addrof ptr $__methods_info__LInter_3B, 4= 0, 5= 0, 6= 1, 7= 0, 8= 0, 9= 0, 10= 0x600, 11= 68, 12= 0]
var $MCC_GCTIB__LInter_3B fstatic <* void> public
var $classStateInitialized u64
var $__cinf_LInter_3B <$__class_meta__> public = [1= 0x17efaac0f65c2f, 2= 0, 3= 0xffff, 4= 0, 5= 0, 6= 0, 7= addrof ptr $MCC_GCTIB__LInter_3B, 8= addrof ptr $__classinforo__LInter_3B, 9= addrof ptr $classStateInitialized]
var $__cinf_LBase_3B <$__class_meta__> public
var $__methods_info__LBase_3B fstatic <[2] <$__method_info__>> public = [[1= 11, 2= addrof ptr $__cinf_LBase_3B, 3= addroffunc ptr &LBase_3B_7Cfoo_7C_28_29V, 4= 1, 5= 36, 6= 52, 7= 68, 8= 0x2e00, 9= 1, 10= 0], [1= 0xfff6, 2= addrof ptr $__cinf_LBase_3B, 3= addroffunc ptr &LBase_3B_7C_3Cinit_3E_7C_28_29V, 4= 0x10000, 5= 112, 6= 52, 7= 68, 8= 0xad81, 9= 1, 10= 0]]
var $__cinf_Ljava_2Flang_2FObject_3B extern <$__class_meta__> public
var $__superclasses__LBase_3B fstatic <[2] <$__superclass_meta__>> public = [[1= 0x4000000000000000], [1= 0x2000000000000003]]
var $__classinforo__LBase_3B fstatic <$__class_meta_ro__> public = [1= 84, 2= 0, 3= addrof ptr $__methods_info__LBase_3B, 4= addrof ptr $__superclasses__LBase_3B, 5= 0, 6= 2, 7= 0, 8= 2, 9= 0, 10= 32, 11= 68, 12= 0]
var $MCC_GCTIB__LBase_3B fstatic <* void> public
var $__cinf_LBase_3B <$__class_meta__> public = [1= 0x1d0741a94f96, 2= 0, 3= 0xffff, 4= 0, 5= addrof ptr $__itb_LBase_3B, 6= addrof ptr $__vtb_LBase_3B, 7= addrof ptr $MCC_GCTIB__LBase_3B, 8= addrof ptr $__classinforo__LBase_3B, 9= addrof ptr $classStateInitialized]
var $__cinf_LInterfaceTest_3B <$__class_meta__> public
var $__methods_info__LInterfaceTest_3B fstatic <[2] <$__method_info__>> public = [[1= 0xfff6, 2= addrof ptr $__cinf_LInterfaceTest_3B, 3= addroffunc ptr &LInterfaceTest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V, 4= 9, 5= 204, 6= 224, 7= 68, 8= 0xa201, 9= 1, 10= 0], [1= 0xfff6, 2= addrof ptr $__cinf_LInterfaceTest_3B, 3= addroffunc ptr &LInterfaceTest_3B_7C_3Cinit_3E_7C_28_29V, 4= 0x10001, 5= 112, 6= 52, 7= 68, 8= 0xad81, 9= 1, 10= 0]]
var $__superclasses__LInterfaceTest_3B fstatic <[1] <$__superclass_meta__>> public = [[1= 0x4000000000000000]]
var $__classinforo__LInterfaceTest_3B fstatic <$__class_meta_ro__> public = [1= 140, 2= 0, 3= addrof ptr $__methods_info__LInterfaceTest_3B, 4= addrof ptr $__superclasses__LInterfaceTest_3B, 5= 0, 6= 2, 7= 0, 8= 1, 9= 0, 10= 33, 11= 68, 12= 0]
var $MCC_GCTIB__LInterfaceTest_3B fstatic <* void> public
var $__cinf_LInterfaceTest_3B <$__class_meta__> public = [1= 0x31d3c74ca034cbdc, 2= 0, 3= 0xffff, 4= 0, 5= 0, 6= addrof ptr $__vtb_LInterfaceTest_3B, 7= addrof ptr $MCC_GCTIB__LInterfaceTest_3B, 8= addrof ptr $__classinforo__LInterfaceTest_3B, 9= addrof ptr $classStateInitialized]
var $__cinf_LDerived_3B <$__class_meta__> public
var $__methods_info__LDerived_3B fstatic <[2] <$__method_info__>> public = [[1= 11, 2= addrof ptr $__cinf_LDerived_3B, 3= addroffunc ptr &LDerived_3B_7Cfoo_7C_28_29V, 4= 1, 5= 36, 6= 52, 7= 68, 8= 0x2e00, 9= 1, 10= 0], [1= 0xfff6, 2= addrof ptr $__cinf_LDerived_3B, 3= addroffunc ptr &LDerived_3B_7C_3Cinit_3E_7C_28_29V, 4= 0x10000, 5= 112, 6= 52, 7= 68, 8= 0xad81, 9= 1, 10= 0]]
var $__superclasses__LDerived_3B fstatic <[1] <$__superclass_meta__>> public = [[1= 0x2000000000000002]]
var $__classinforo__LDerived_3B fstatic <$__class_meta_ro__> public = [1= 316, 2= 0, 3= addrof ptr $__methods_info__LDerived_3B, 4= addrof ptr $__superclasses__LDerived_3B, 5= 0, 6= 2, 7= 0, 8= 1, 9= 0, 10= 32, 11= 68, 12= 0]
var $MCC_GCTIB__LDerived_3B fstatic <* void> public
var $__cinf_LDerived_3B <$__class_meta__> public = [1= 0x4171f2415194822a, 2= 0, 3= 0xffff, 4= 0, 5= addrof ptr $__itb_LDerived_3B, 6= addrof ptr $__vtb_LDerived_3B, 7= addrof ptr $MCC_GCTIB__LDerived_3B, 8= addrof ptr $__classinforo__LDerived_3B, 9= addrof ptr $classStateInitialized]
var $__muid_classmetadata_bucket$$InterfaceTest_jar <[4] <* void>> public = [addrof ptr $__cinf_LInter_3B, addrof ptr $__cinf_LBase_3B, addrof ptr $__cinf_LInterfaceTest_3B, addrof ptr $__cinf_LDerived_3B]
func &MCC_Reflect_ThrowCastException nosideeffect () void
func &MCC_Reflect_Check_Casting_NoArray nosideeffect () void
func &MCC_Reflect_Check_Casting_Array nosideeffect () void
func &MCC_CheckThrowPendingException nosideeffect () void
func &MCC_PreNativeCall (var %caller ref) <* void>
func &MCC_PostNativeCall (var %env <* void>) void
func &MCC_DecodeReference nosideeffect (var %obj ref) ref
func &MCC_CallFastNative (var %func <* void>) <* void>
func &MCC_CallSlowNative0 (var %func <* void>) <* void>
func &MCC_CallSlowNative1 (var %func <* void>) <* void>
func &MCC_CallSlowNative2 (var %func <* void>) <* void>
func &MCC_CallSlowNative3 (var %func <* void>) <* void>
func &MCC_CallSlowNative4 (var %func <* void>) <* void>
func &MCC_CallSlowNative5 (var %func <* void>) <* void>
func &MCC_CallSlowNative6 (var %func <* void>) <* void>
func &MCC_CallSlowNative7 (var %func <* void>) <* void>
func &MCC_CallSlowNative8 (var %func <* void>) <* void>
func &MCC_CallFastNativeExt (var %func <* void>) <* void>
func &MCC_CallSlowNativeExt (var %func <* void>) <* void>
func &MCC_SetReliableUnwindContext nosideeffect () void
var $__reg_jni_func_tab$$InterfaceTest_jar <[0] <* void>>
var $__cinf_Ljava_2Flang_2FSystem_3B extern <$__class_meta__>
func &MCC_getFuncPtrFromItabSecondHash64 nosideeffect () ptr
var $__muid_func_def_tab$$InterfaceTest_jar fstatic <[7] <$MUIDFuncDefTabEntry>> = [[1= addroffunc ptr &LBase_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &LBase_3B_7Cfoo_7C_28_29V], [1= addroffunc ptr &LDerived_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &LDerived_3B_7Cfoo_7C_28_29V], [1= addroffunc ptr &LInter_3B_7Cfoo_7C_28_29V], [1= addroffunc ptr &LInterfaceTest_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &LInterfaceTest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V]]
var $__muid_func_inf_tab$$InterfaceTest_jar fstatic <[7] <$MUIDFuncInfTabEntry>> = [[1= addroffunc ptr &LBase_3B_7C_3Cinit_3E_7C_28_29V, 2= addroffunc ptr &LBase_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &LBase_3B_7Cfoo_7C_28_29V, 2= addroffunc ptr &LBase_3B_7Cfoo_7C_28_29V], [1= addroffunc ptr &LDerived_3B_7C_3Cinit_3E_7C_28_29V, 2= addroffunc ptr &LDerived_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &LDerived_3B_7Cfoo_7C_28_29V, 2= addroffunc ptr &LDerived_3B_7Cfoo_7C_28_29V], [1= addroffunc ptr &LInter_3B_7Cfoo_7C_28_29V, 2= addroffunc ptr &LInter_3B_7Cfoo_7C_28_29V], [1= addroffunc ptr &LInterfaceTest_3B_7C_3Cinit_3E_7C_28_29V, 2= addroffunc ptr &LInterfaceTest_3B_7C_3Cinit_3E_7C_28_29V], [1= addroffunc ptr &LInterfaceTest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V, 2= addroffunc ptr &LInterfaceTest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V]]
var $__muid_func_def_muid_tab$$InterfaceTest_jar fstatic <[7] <$MUIDFuncDefMuidTabEntry>> = [[1= 0x178109574fbab3d6, 2= -1724730257836805130], [1= 0x368e6237953a2580, 2= -504698780890953708], [1= 0xb7b286ddee8eafe, 2= -2169785298905445890], [1= 0x63bbf9d1c3499099, 2= -1943522023966098161], [1= -1675590344887417795, 2= -2230789790025730929], [1= 0x5100e9678d558128, 2= -3593795459477186102], [1= -2829949660543074558, 2= -1685351998939611686]]
var $__muid_func_muid_idx_tab$$InterfaceTest_jar fstatic <[7] u32> = [5, 4, 2, 3, 0, 6, 1]
var $__muid_data_def_tab$$InterfaceTest_jar fstatic <[4] <$MUIDDataDefTabEntry>> = [[1= addrof ptr $__cinf_LDerived_3B], [1= addrof ptr $__cinf_LInterfaceTest_3B], [1= addrof ptr $__cinf_LBase_3B], [1= addrof ptr $__cinf_LInter_3B]]
var $__muid_data_def_muid_tab$$InterfaceTest_jar fstatic <[4] <$MUIDDataDefMuidTabEntry>> = [[1= 0x7eb6c0f619e83624, 2= -3145394803863882273], [1= -5523991683343173598, 2= -1468839900656767610], [1= -8809292195587745449, 2= -1374821749885213916], [1= 0x77baadcefdd399cb, 2= -745242518540589114]]
var $__muid_func_undef_tab$$InterfaceTest_jar fstatic <[12] <$MUIDUnifiedUndefTabEntry>> = [[1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0], [1= 0]]
var $__muid_func_undef_muid_tab$$InterfaceTest_jar fstatic <[12] <$MUIDUnifiedUndefMuidTabEntry>> = [[1= 0x3e32352aee789835, 2= -3887705395317205813], [1= -4187412136968710015, 2= -3800091941095621250], [1= 0x6742c234127e0a27, 2= -3762262047879347071], [1= 0x7230554331c55d92, 2= -3676689525926909155], [1= -715372855679083712, 2= -2647497990906227723], [1= -7464356948810446352, 2= -2259485500590180091], [1= 0x783627f2afd1cbde, 2= -2046851302095768916], [1= -2701934576591406938, 2= -1693831364093527548], [1= 0x126777a7fe39e1fb, 2= -1314856249532362766], [1= 0xbf40578f3343f7a, 2= -1198421541845410999], [1= 0x7ca2bdf69a6c7c94, 2= -801329978528900548], [1= 0x477aafa4d7dd102b, 2= -442561182569419835]]
var $__muid_data_undef_tab$$InterfaceTest_jar fstatic <[3] <$MUIDUnifiedUndefTabEntry>> = [[1= addrof ptr $__cinf_Ljava_2Flang_2FObject_3B], [1= addrof ptr $Ljava_2Flang_2FSystem_3B_7Cout], [1= addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B]]
var $__muid_data_undef_muid_tab$$InterfaceTest_jar fstatic <[3] <$MUIDUnifiedUndefMuidTabEntry>> = [[1= -567417612161374449, 2= -3298852447504547670], [1= 0x191283ac418c4bb9, 2= -1676204161023949463], [1= -5921653145571052587, 2= -171150348656858163]]
var $__muid_range_tab$$InterfaceTest_jar fstatic <[29] <$MUIDRangeTabEntry>> = [[1= -4105516598114278518, 2= -3041593165803565154], [1= -906916996929164970, 2= -2307534257755856003], [1= 2, 2= 2], [1= 3, 2= 3], [1= 4, 2= 4], [1= 5, 2= 5], [1= 6, 2= 6], [1= 7, 2= 7], [1= 8, 2= 8], [1= 9, 2= 9], [1= 0, 2= 0], [1= 11, 2= 11], [1= 12, 2= 12], [1= 13, 2= 13], [1= 14, 2= 14], [1= 15, 2= 15], [1= addrof ptr $__muid_func_def_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_func_def_tab$$InterfaceTest_jar], [1= 0, 2= 0], [1= addrof ptr $__muid_func_inf_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_func_inf_tab$$InterfaceTest_jar], [1= addrof ptr $__muid_func_undef_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_func_undef_tab$$InterfaceTest_jar], [1= addrof ptr $__muid_data_def_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_data_def_tab$$InterfaceTest_jar], [1= 0, 2= 0], [1= addrof ptr $__muid_data_undef_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_data_undef_tab$$InterfaceTest_jar], [1= addrof ptr $__muid_func_def_muid_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_func_def_muid_tab$$InterfaceTest_jar], [1= addrof ptr $__muid_func_undef_muid_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_func_undef_muid_tab$$InterfaceTest_jar], [1= addrof ptr $__muid_data_def_muid_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_data_def_muid_tab$$InterfaceTest_jar], [1= addrof ptr $__muid_data_undef_muid_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_data_undef_muid_tab$$InterfaceTest_jar], [1= addrof ptr $__muid_func_muid_idx_tab$$InterfaceTest_jar, 2= addrof ptr $__muid_func_muid_idx_tab$$InterfaceTest_jar], [1= 0, 2= 0]]
var $__reflection_strtab$$InterfaceTest_jar fstatic <[89] u8> = [0, 76, 73, 110, 116, 101, 114, 59, 0, 102, 111, 111, 0, 40, 41, 86, 0, 48, 33, 48, 0, 76, 66, 97, 115, 101, 59, 0, 60, 105, 110, 105, 116, 62, 0, 76, 73, 110, 116, 101, 114, 102, 97, 99, 101, 84, 101, 115, 116, 59, 0, 109, 97, 105, 110, 0, 40, 91, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 83, 116, 114, 105, 110, 103, 59, 41, 86, 0, 76, 68, 101, 114, 105, 118, 101, 100, 59, 0]
var $__compilerVersionNum$$InterfaceTest_jar <[0] <* void>> = [1, 0]
func &LBase_3B_7C_3Cinit_3E_7C_28_29V constructor (var %_this <* <$LBase_3B>>) void {
  funcid 48153
  var %Reg1_R43697 <* <$LBase_3B>> localrefvar
  var %Reg1_R57 <* <$Ljava_2Flang_2FObject_3B>> localrefvar
  var %__muid_symptr <* void>

  intrinsiccall MCCIncRef (dread ref %_this)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43697)
  dassign %Reg1_R43697 0 (dread ref %_this)
  #INSTIDX : 0||0000:  aload_0
  #INSTIDX : 1||0001:  invokespecial
  regassign ptr %1 (dread ref %Reg1_R57)
  dassign %Reg1_R57 0 (retype ref <* <$Ljava_2Flang_2FObject_3B>> (dread ref %Reg1_R43697))
  intrinsiccall MCCIncRef (dread ref %Reg1_R57)
  intrinsiccall MCCDecRef (regread ptr %1)
  #Call function:Ljava_2Flang_2FObject_3B_7C_3Cinit_3E_7C_28_29V
  dassign %__muid_symptr 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[12] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_func_undef_tab$$InterfaceTest_jar, constval i64 9)))
  icallassigned (dread ptr %__muid_symptr, dread ref %Reg1_R57) {}
  #INSTIDX : 4||0004:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg1_R43697, dread ref %Reg1_R57)
  return ()
}
func &LBase_3B_7Cfoo_7C_28_29V public virtual (var %_this <* <$LBase_3B>>) void {
  funcid 48154
  var %Reg2_R43697 <* <$LBase_3B>> localrefvar
  var %Reg0_R562 <* <$Ljava_2Fio_2FPrintStream_3B>> localrefvar
  var %Reg1_R43 <* <$Ljava_2Flang_2FString_3B>> localrefvar
  var %L_STR_161333 <* <$Ljava_2Flang_2FString_3B>>

  intrinsiccall MCCIncRef (dread ref %_this)
  intrinsiccall MCCDecRef (dread ref %Reg2_R43697)
  dassign %Reg2_R43697 0 (dread ref %_this)
  #INSTIDX : 0||0000:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %1 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$InterfaceTest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %1)
  #INSTIDX : 3||0003:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_477e2dc723978d7245344fc51fc13e2b) { dassign %L_STR_161333 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161333)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161333)
  #INSTIDX : 5||0005:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 8||0008:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg2_R43697, dread ref %Reg0_R562, dread ref %Reg1_R43)
  return ()
}
func &LDerived_3B_7C_3Cinit_3E_7C_28_29V constructor (var %_this <* <$LDerived_3B>>) void {
  funcid 48155
  var %Reg1_R43699 <* <$LDerived_3B>> localrefvar
  var %Reg1_R43697 <* <$LBase_3B>> localrefvar
  var %__muid_symptr <* void>

  intrinsiccall MCCIncRef (dread ref %_this)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43699)
  dassign %Reg1_R43699 0 (dread ref %_this)
  #INSTIDX : 0||0000:  aload_0
  #INSTIDX : 1||0001:  invokespecial
  regassign ptr %1 (dread ref %Reg1_R43697)
  dassign %Reg1_R43697 0 (retype ref <* <$LBase_3B>> (dread ref %Reg1_R43699))
  intrinsiccall MCCIncRef (dread ref %Reg1_R43697)
  intrinsiccall MCCDecRef (regread ptr %1)
  #Call function:LBase_3B_7C_3Cinit_3E_7C_28_29V
  dassign %__muid_symptr 0 (iread ptr <* <$MUIDFuncDefTabEntry>> 1 (array 0 ptr <* <[7] <$MUIDFuncDefTabEntry>>> (addrof ptr $__muid_func_def_tab$$InterfaceTest_jar, constval i64 0)))
  icallassigned (dread ptr %__muid_symptr, dread ref %Reg1_R43697) {}
  #INSTIDX : 4||0004:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg1_R43699, dread ref %Reg1_R43697)
  return ()
}
func &LDerived_3B_7Cfoo_7C_28_29V public virtual (var %_this <* <$LDerived_3B>>) void {
  funcid 48156
  var %Reg2_R43699 <* <$LDerived_3B>> localrefvar
  var %Reg0_R562 <* <$Ljava_2Fio_2FPrintStream_3B>> localrefvar
  var %Reg1_R43 <* <$Ljava_2Flang_2FString_3B>> localrefvar
  var %L_STR_161344 <* <$Ljava_2Flang_2FString_3B>>

  intrinsiccall MCCIncRef (dread ref %_this)
  intrinsiccall MCCDecRef (dread ref %Reg2_R43699)
  dassign %Reg2_R43699 0 (dread ref %_this)
  #INSTIDX : 0||0000:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %1 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$InterfaceTest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %1)
  #INSTIDX : 3||0003:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_d820ddedd204b763a52374e860ce318e) { dassign %L_STR_161344 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161344)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161344)
  #INSTIDX : 5||0005:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 8||0008:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg2_R43699, dread ref %Reg0_R562, dread ref %Reg1_R43)
  return ()
}
func &LInter_3B_7Cfoo_7C_28_29V public virtual (var %_this <* <$LInter_3B>>) void {
  funcid 48157
  var %Reg2_R43701 <* <$LInter_3B>> localrefvar
  var %Reg0_R562 <* <$Ljava_2Fio_2FPrintStream_3B>> localrefvar
  var %Reg1_R43 <* <$Ljava_2Flang_2FString_3B>> localrefvar
  var %L_STR_161347 <* <$Ljava_2Flang_2FString_3B>>

  intrinsiccall MCCIncRef (dread ref %_this)
  intrinsiccall MCCDecRef (dread ref %Reg2_R43701)
  dassign %Reg2_R43701 0 (dread ref %_this)
  #INSTIDX : 0||0000:  getstatic
  intrinsiccall MPL_CLINIT_CHECK (addrof ptr $__cinf_Ljava_2Flang_2FSystem_3B)
  regassign ptr %1 (dread ref %Reg0_R562)
  #Read from: Ljava_2Flang_2FSystem_3B_7Cout
  dassign %Reg0_R562 0 (iread ref <* <* <$Ljava_2Fio_2FPrintStream_3B>>> 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[3] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_data_undef_tab$$InterfaceTest_jar, constval i64 1))))
  intrinsiccall MCCIncRef (dread ref %Reg0_R562)
  intrinsiccall MCCDecRef (regread ptr %1)
  #INSTIDX : 3||0003:  ldc
  callassigned &MCC_GetOrInsertLiteral (addrof ptr $_C_STR_a3cc511f7ef4b5079c824f99850ea7ef) { dassign %L_STR_161347 0 }
  intrinsiccall MCCIncRef (dread ptr %L_STR_161347)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43)
  dassign %Reg1_R43 0 (dread ptr %L_STR_161347)
  #INSTIDX : 5||0005:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg0_R562)),
      constval u32 312)),
    dread ref %Reg0_R562,
    dread ref %Reg1_R43) {}
  #INSTIDX : 8||0008:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg2_R43701, dread ref %Reg0_R562, dread ref %Reg1_R43)
  return ()
}
func &LInterfaceTest_3B_7C_3Cinit_3E_7C_28_29V public constructor (var %_this <* <$LInterfaceTest_3B>>) void {
  funcid 48158
  var %Reg1_R43703 <* <$LInterfaceTest_3B>> localrefvar
  var %Reg1_R57 <* <$Ljava_2Flang_2FObject_3B>> localrefvar
  var %__muid_symptr <* void>

  intrinsiccall MCCIncRef (dread ref %_this)
  intrinsiccall MCCDecRef (dread ref %Reg1_R43703)
  dassign %Reg1_R43703 0 (dread ref %_this)
  #INSTIDX : 0||0000:  aload_0
  #INSTIDX : 1||0001:  invokespecial
  regassign ptr %1 (dread ref %Reg1_R57)
  dassign %Reg1_R57 0 (retype ref <* <$Ljava_2Flang_2FObject_3B>> (dread ref %Reg1_R43703))
  intrinsiccall MCCIncRef (dread ref %Reg1_R57)
  intrinsiccall MCCDecRef (regread ptr %1)
  #Call function:Ljava_2Flang_2FObject_3B_7C_3Cinit_3E_7C_28_29V
  dassign %__muid_symptr 0 (iread ptr <* <$MUIDUnifiedUndefTabEntry>> 1 (array 0 ptr <* <[12] <$MUIDUnifiedUndefTabEntry>>> (addrof ptr $__muid_func_undef_tab$$InterfaceTest_jar, constval i64 9)))
  icallassigned (dread ptr %__muid_symptr, dread ref %Reg1_R57) {}
  #INSTIDX : 4||0004:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg1_R43703, dread ref %Reg1_R57)
  return ()
}
func &LInterfaceTest_3B_7Cmain_7C_28ALjava_2Flang_2FString_3B_29V public static (var %Reg5_R743 <* <[] <* <$Ljava_2Flang_2FString_3B>>>>) void {
  funcid 48159
  var %Reg0_R43699 <* <$LDerived_3B>> localrefvar
  var %Reg2_R43699 <* <$LDerived_3B>> localrefvar
  var %Reg3_R43699 <* <$LDerived_3B>> localrefvar
  var %Reg3_R43697 <* <$LBase_3B>> localrefvar
  var %Reg4_R43699 <* <$LDerived_3B>> localrefvar
  var %Reg4_R43701 <* <$LInter_3B>> localrefvar
  var %__muid_symptr <* void>

  #INSTIDX : 0||0000:  new
  regassign ptr %1 (dread ref %Reg0_R43699)
  dassign %Reg0_R43699 0 (gcmalloc ref <$LDerived_3B>)
  intrinsiccall MCCDecRef (regread ptr %1)
  #INSTIDX : 3||0003:  dup
  #INSTIDX : 4||0004:  invokespecial
  #Call function:LDerived_3B_7C_3Cinit_3E_7C_28_29V
  dassign %__muid_symptr 0 (iread ptr <* <$MUIDFuncDefTabEntry>> 1 (array 0 ptr <* <[7] <$MUIDFuncDefTabEntry>>> (addrof ptr $__muid_func_def_tab$$InterfaceTest_jar, constval i64 2)))
  icallassigned (dread ptr %__muid_symptr, dread ref %Reg0_R43699) {}
  #INSTIDX : 7||0007:  astore_1
  intrinsiccall MCCIncRef (dread ref %Reg0_R43699)
  intrinsiccall MCCDecRef (dread ref %Reg2_R43699)
  dassign %Reg2_R43699 0 (dread ref %Reg0_R43699)
  #INSTIDX : 8||0008:  aload_1
  #INSTIDX : 9||0009:  invokevirtual
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg2_R43699)),
      constval u32 88)),
    dread ref %Reg2_R43699) {}
  #INSTIDX : 12||000c:  new
  regassign ptr %2 (dread ref %Reg0_R43699)
  dassign %Reg0_R43699 0 (gcmalloc ref <$LDerived_3B>)
  intrinsiccall MCCDecRef (regread ptr %2)
  #INSTIDX : 15||000f:  dup
  #INSTIDX : 16||0010:  invokespecial
  #Call function:LDerived_3B_7C_3Cinit_3E_7C_28_29V
  dassign %__muid_symptr 0 (iread ptr <* <$MUIDFuncDefTabEntry>> 1 (array 0 ptr <* <[7] <$MUIDFuncDefTabEntry>>> (addrof ptr $__muid_func_def_tab$$InterfaceTest_jar, constval i64 2)))
  icallassigned (dread ptr %__muid_symptr, dread ref %Reg0_R43699) {}
  #INSTIDX : 19||0013:  astore_2
  intrinsiccall MCCIncRef (dread ref %Reg0_R43699)
  intrinsiccall MCCDecRef (dread ref %Reg3_R43699)
  dassign %Reg3_R43699 0 (dread ref %Reg0_R43699)
  #INSTIDX : 20||0014:  aload_2
  #INSTIDX : 21||0015:  invokevirtual
  regassign ptr %3 (dread ref %Reg3_R43697)
  dassign %Reg3_R43697 0 (retype ref <* <$LBase_3B>> (dread ref %Reg3_R43699))
  intrinsiccall MCCIncRef (dread ref %Reg3_R43697)
  intrinsiccall MCCDecRef (regread ptr %3)
  icallassigned (
    iread u64 <* u64> 0 (add ptr (
      iread ptr <* <$__class_meta__>> 6 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg3_R43697)),
      constval u32 88)),
    dread ref %Reg3_R43697) {}
  #INSTIDX : 24||0018:  new
  regassign ptr %4 (dread ref %Reg0_R43699)
  dassign %Reg0_R43699 0 (gcmalloc ref <$LDerived_3B>)
  intrinsiccall MCCDecRef (regread ptr %4)
  #INSTIDX : 27||001b:  dup
  #INSTIDX : 28||001c:  invokespecial
  #Call function:LDerived_3B_7C_3Cinit_3E_7C_28_29V
  dassign %__muid_symptr 0 (iread ptr <* <$MUIDFuncDefTabEntry>> 1 (array 0 ptr <* <[7] <$MUIDFuncDefTabEntry>>> (addrof ptr $__muid_func_def_tab$$InterfaceTest_jar, constval i64 2)))
  icallassigned (dread ptr %__muid_symptr, dread ref %Reg0_R43699) {}
  #INSTIDX : 31||001f:  astore_3
  intrinsiccall MCCIncRef (dread ref %Reg0_R43699)
  intrinsiccall MCCDecRef (dread ref %Reg4_R43699)
  dassign %Reg4_R43699 0 (dread ref %Reg0_R43699)
  #INSTIDX : 32||0020:  aload_3
  #INSTIDX : 33||0021:  invokeinterface
  regassign ptr %5 (dread ref %Reg4_R43701)
  dassign %Reg4_R43701 0 (retype ref <* <$LInter_3B>> (dread ref %Reg4_R43699))
  intrinsiccall MCCIncRef (dread ref %Reg4_R43701)
  intrinsiccall MCCDecRef (regread ptr %5)
  regassign ptr %6 (iread ptr <* <$__class_meta__>> 5 (iread ref <* <$Ljava_2Flang_2FObject_3B>> 1 (dread ref %Reg4_R43701)))
  regassign u64 %7 (iread u64 <* u64> 0 (add ptr (regread ptr %6, constval u32 120)))
  if (eq u1 u64 (regread u64 %7, constval u64 0)) {
    callassigned &MCC_getFuncPtrFromItabSecondHash64 (regread ptr %6, constval u64 0x12c8, conststr ptr "foo|()V") { regassign u64 %7}
  }
  icallassigned (regread u64 %7, dread ref %Reg4_R43701) {}
  #INSTIDX : 38||0026:  return
  intrinsiccall MPL_CLEANUP_LOCALREFVARS (dread ref %Reg0_R43699, dread ref %Reg2_R43699, dread ref %Reg3_R43699, dread ref %Reg3_R43697, dread ref %Reg4_R43699, dread ref %Reg4_R43701)
  return ()
}

max_stars_repo_name: Bravewtz/OpenArkCompiler

max_issues_repo_name: Bravewtz/OpenArkCompiler

max_forks_repo_name: Bravewtz/OpenArkCompiler


text:
 func $foo (
  var %i i32
#var %i1 i32, var %j1 i32, var %k1 i32
  ) i32 {
   return (
     neg i32(dread i32 %i))}

 func $foo1 (
  var %i i32, var %j i32, var %k i32,
  var %i1 i32, var %j1 i32, var %k1 i32
  ) i32 {
   return (
     neg i32(dread i32 %i))}

 func $foo2 (
  var %i i32, var %j i32, var %k i32
  ) i32 {
   return (
     neg i32(constval i32 0x111111111))}

 func $foo3 (
  var %i i64, var %j i64, var %k i32
  ) i64 {
   return (
     neg i64(dread i64 %i))}

 func $foo5 (
  var %i i64, var %j i64, var %k i32
  ) i64 {
   return (
     neg i64(constval i64 0x11111))}

 func $foo6 (
  var %i f64
  ) f64 {
   return (
     neg f64(dread f64 %i))}

 func $foo7 (
  var %i f32
  ) f32 {
   return (
     neg f32(dread f32 %i))}

 func $foo8 (
  var %i f64
  ) f64 {
   return (
     neg f64(constval f64 -1.24))}

 func $foo9 (
  var %i f32
  ) f32 {
   return (
     neg f32(constval f32 -1.24f))}
# todo float neg
 # EXEC: %irbuild Main.mpl
 # EXEC: %irbuild Main.irb.mpl
 # EXEC: %cmp Main.irb.mpl Main.irb.irb.mpl


text:
TITLE
   Farmer;

STOCHASTIC

SCENARIO
   sc := 1..3;

INDEX
   crop    := (Wheat,Corn,SugarB);
   prLevel := 1..2;

PROBABILITIES
   Prob[sc] := (1/3, 1/3, 1/3);

RANDOM DATA
   Yield[crop,sc] := SPARSEFILE("Farmer.dat");

DATA
   Cost[crop] := (150,230,260);
   SellPrice[crop,prLevel]   := (170,  0,
                                 150,  0,
                                  36, 10);
   PurPrice[crop] := (238, 210, 0);
   MinReq[crop] := (200,240,  0);
   AvailLand := 500;
   MaxBeets := 6000;

STAGE1 VARIABLES
   Plant[crop] -> Pl;

STAGE2 VARIABLES
   CropPurchased[crop] WHERE (PurPrice > 0) -> Cp;
   CropSold[crop,prLevel] WHERE (SellPrice > 0) -> Cs;

MODEL
   MAX Profit =  SUM(crop,prLevel: SellPrice * CropSold)
              - SUM(crop: PurPrice * CropPurchased)
              - SUM(crop: Cost * Plant);

SUBJECT TO

   LandUse: SUM(crop: Plant) <= AvailLand;

   MeetMinReq[crop] -> MR:   Yield * Plant
                    + CropPurchased
                    - SUM(prLevel: CropSold)
                   >= MinReq;

BOUNDS
   CropSold[crop:=SugarB,prLevel:=1] <= MaxBeets;

END

max_stars_repo_name: BjarniMax/mpl-models

max_issues_repo_name: BjarniMax/mpl-models

max_forks_repo_name: BjarniMax/mpl-models


text:
# Parameter Regressor Inverse Dynamics for Robot-Base
# Einleitung
# Berechnung der inversen Dynamik der Roboter-Plattform in Regressorform
#
# Dateiname:
# robot -> Berechnung für allgemeinen Roboter
# para -> Berechnung für eine parallelen Roboter
# rotmat -> Kinematik wird mit Rotationsmatrizen berechnet
# dynamics -> Berechnung der Dynamik
# regressor -> Regressorform (parameterlinear)
# Autor
# Tim Job (Studienarbeit bei Moritz Schappler), 2018-12
# Moritz Schappler, moritz.schappler@imes.uni-hannover.de
# (C) Institut für Mechatronische Systeme, Universität Hannover
# Sources
# [GautierKhalil1990] Direct Calculation of Minimum Set of Inertial Parameters of Serial Robots
# [KhalilDombre2002] Modeling, Identification and Control of Robots
# [Ortmaier2014] Vorlesungsskript Robotik I
# [Abdel2007] Modellierung, Identifikation und robuste Regelung von Robotern mit parallelkinematischen Strukturen
# Initialization
interface(warnlevel=0): # Unterdrücke die folgende Warnung.
restart: # Gibt eine Warnung, wenn über Terminal-Maple mit read gestartet wird.
interface(warnlevel=3):
with(LinearAlgebra):
#with(ArrayTools):
with(codegen):
with(CodeGeneration):
with(StringTools):
with(VectorCalculus):
# Einstellungen für Code-Export: Optimierungsgrad (2=höchster) und Aktivierung jedes Terms.
codegen_opt := 2:
codeexport_invdyn := false:
codeexport_grav := false:
codeexport_corvec := false:
codeexport_inertia := false:
read "../helper/proc_convert_s_t":
read "../helper/proc_convert_t_s":
read "../helper/proc_MatlabExport":
read "../helper/proc_index_symmat2vector":
read "../helper/proc_symmat2vector":
read "../helper/proc_skew2vec":
read "../helper/proc_vec2skew":
read "../helper/proc_combine2":
read "../transformation/proc_rotx":
read "../transformation/proc_roty":
read "../transformation/proc_rotz":
read "../transformation/proc_trotx":
read "../transformation/proc_troty":
read "../transformation/proc_trotz":
read "../transformation/proc_transl":
read "../transformation/proc_trafo_mdh":
read "../robot_codegen_definitions/robot_env_par":
read sprintf("../codeexport/%s/tmp/tree_floatb_definitions", leg_name):
read "../robot_codegen_definitions/robot_env_par":
# Definitionen für parallelen Roboter laden
read sprintf("../codeexport/%s/tmp/para_definitions", robot_name):
r_P_sP_P := -r_P_sP:
s_P_P_sP := s_P_sP:
# Ergebnisse der Kinematik für parallen Roboter laden

kinematicsfile := sprintf("../codeexport/%s/tmp/kinematics_%s_platform_maple.m", robot_name, base_method_name):
if FileTools[Exists](kinematicsfile) then
  read kinematicsfile:
else
  printf("%s. PKM-Kinematik konnte nicht geladen werden. Abbruch der Berechnung.\n", FormatTime("%Y-%m-%d %H:%M:%S")):
  quit: # Funktioniert in GUI nicht richtig...
  robot_name := "": # ...Daher auch Löschung des Roboternamens.
end if:
P_i := P_i: # nur diese Variable wird benötigt. Alle anderen zur Übersichtlichkeit löschen. Enthält Informationen zu den Koppelpunkten.
unassign('pivotMat', 'pivotMatMas', 'Jinv', 'JB_i', 'JBD_i', 'JBinv_i', 'JBDinv_i', 'U_i', 'UD_i'):

# Lade "robotics_repo_path"-File mit Link zum "imes-robotics-matlab"-Repo
read("../robotics_repo_path"):
# Lade die Funktionen aus dem "imes-robotics-matlab"-Repo
read(sprintf("%s/transformation/maple/proc_eul%s2r", robotics_repo_path, angleConvLeg)):
read(sprintf("%s/transformation/maple/proc_eul%sjac", robotics_repo_path, angleConvLeg)):

# Additional Kinematics
# Berechnung der Rotationsmatrizen
R_0_0_E_t := parse(sprintf("eul%s2r",angleConvLeg))(xE_t(4..6)):
R_0_0_E_s := parse(sprintf("eul%s2r",angleConvLeg))(xE_s(4..6)):
RPYjac_0_t := parse(sprintf("eul%sjac",angleConvLeg))(xE_t(4..6)):
RPYjac_0_s := parse(sprintf("eul%sjac",angleConvLeg))(xE_s(4..6)):
r_0_sP_P := R_0_0_E_s.r_P_sP_P:
J_P_P := J_P_P:
J_0_P := R_0_0_E_s.J_P_P.Transpose(R_0_0_E_s):
J_0_P_raute := Matrix(6,1,[J_0_P(1,1),J_0_P(1,2),J_0_P(1,3),J_0_P(2,2),J_0_P(2,3),J_0_P(3,3)]):
J_P_P_raute := Matrix(6,1,[J_P_P(1,1),J_P_P(1,2),J_P_P(1,3),J_P_P(2,2),J_P_P(2,3),J_P_P(3,3)]):

r_0_sP_P := R_0_0_E_t.r_P_sP_P:
r_0_P_sP := -r_0_sP_P:
#rD_0_sP_P := diff~(r_0_sP_P,t):
#for i to 3 do
  # for j to 6 do
      #rD_0_sP_P(i) := subs({xED_t(j)=xED_s(j),xE_t(j)=xE_s(j)},rD_0_sP_P(i)):
   #end do:
#end do:
#rD_0_sP_P:
r_0_sP_P := R_0_0_E_s.r_P_sP_P:
r_0_P_sP := -r_0_sP_P:
r_P_P_sP := -r_P_sP_P:
#sE := Matrix(mE*r_0_P_sP):
#sE := Matrix(mE*r_P_P_sP):
sE := s_P_P_sP:

# Berechnung der H-Matrix und deren Ableitung nach [Abdel2007] S.20
RPYjac_E_t := simplify(Multiply(Transpose(R_0_0_E_t),RPYjac_0_t)):
RPYjac_E_s := simplify(Multiply(Transpose(R_0_0_E_s),RPYjac_0_s)):
w_E_0_E_s := RPYjac_E_s.xED_s(4..6,1):
w_0_0_E_s := RPYjac_0_s.xED_s(4..6,1):
w_E_0_E_t := RPYjac_E_t.xED_t(4..6,1):
dRPYjac_E_t := diff~(RPYjac_E_t,t):
dRPYjac_0_t := diff~(RPYjac_0_t,t):
dRPYjac_E_s := Copy(dRPYjac_E_t):
dRPYjac_0_s := Copy(dRPYjac_0_t):
# Substituiere die zeitabhängigen Koordinaten in der H-Matrix mit zeitunabhängigen Koordinaten
for i to 3 do
  for j to 3 do
    for k from 4 to 6 do
      dRPYjac_E_s(i,j) := subs({xEDD_t(k)=xEDD_s(k),xED_t(k)=xED_s(k),xE_t(k)=xE_s(k)},dRPYjac_E_s(i,j)):
      dRPYjac_0_s(i,j) := subs({xEDD_t(k)=xEDD_s(k),xED_t(k)=xED_s(k),xE_t(k)=xE_s(k)},dRPYjac_0_s(i,j)):
    end do:
  end do:
end do:

omegaE := <omega1;omega2;omega3>:
xED_dummy := <xE,yE,zE>:
omega0 := Transpose(R_0_0_E_s).omegaE:
<xED_dummy;omegaE>:
JR := Jacobian(convert(omega0,list),convert(<xED_dummy;omegaE>,list)):
JR_T := Transpose(JR):
vel0 := Transpose(R_0_0_E_s).xED_dummy:
JT := Jacobian(convert(vel0,list),convert(<xED_dummy;omegaE>,list)):
JT_T := Transpose(JT):

wD_E_0_E_s := dRPYjac_E_s.xED_s(4..6,1)+RPYjac_E_s.xEDD_s(4..6,1):
wD_0_0_E_s := dRPYjac_0_s.xED_s(4..6,1)+RPYjac_0_s.xEDD_s(4..6,1):
# Trigonometrische Ausdrücke zusammenfassen.
w_E_0_E_s := combine2(w_E_0_E_s):
wD_E_0_E_s := combine2(wD_E_0_E_s):

H := <IdentityMatrix(3,3),ZeroMatrix(3);
      ZeroMatrix(3),RPYjac_0_s>:

Hinv := MatrixInverse(H):
dH := <ZeroMatrix(3),ZeroMatrix(3);
      ZeroMatrix(3),dRPYjac_0_s>:

a_E := Matrix(xEDD_s(1..3,1)) - g_world:
a_E := Transpose(R_0_0_E_s).(Matrix(xEDD_s(1..3,1)) - g_world):
w_0_0_E_s_stern := Matrix(3,6,[w_0_0_E_s(1),w_0_0_E_s(2),w_0_0_E_s(3),0,0,0, \
                               0,w_0_0_E_s(1),0,w_0_0_E_s(2),w_0_0_E_s(3),0, \
                               0,0,w_0_0_E_s(1),0,w_0_0_E_s(2),w_0_0_E_s(3)]):
wD_0_0_E_s_stern := Matrix(3,6,[wD_0_0_E_s(1),wD_0_0_E_s(2),wD_0_0_E_s(3),0,0,0,\
                                0,wD_0_0_E_s(1),0,wD_0_0_E_s(2),wD_0_0_E_s(3),0,\
                                0,0,wD_0_0_E_s(1),0,wD_0_0_E_s(2),wD_0_0_E_s(3)]):
w_E_0_E_s_stern := Matrix(3,6,[w_E_0_E_s(1),w_E_0_E_s(2),w_E_0_E_s(3),0,0,0,\
                               0,w_E_0_E_s(1),0,w_E_0_E_s(2),w_E_0_E_s(3),0,\
                               0,0,w_E_0_E_s(1),0,w_E_0_E_s(2),w_E_0_E_s(3)]):
wD_E_0_E_s_stern := Matrix(3,6,[wD_E_0_E_s(1),wD_E_0_E_s(2),wD_E_0_E_s(3),0,0,0,\
                                0,wD_E_0_E_s(1),0,wD_E_0_E_s(2),wD_E_0_E_s(3),0,\
                                0,0,wD_E_0_E_s(1),0,wD_E_0_E_s(2),wD_E_0_E_s(3)]):
paramVecP_old := <J_0_P_raute;sE;mE>:
paramVecP_old := <J_P_P_raute;sE;mE>:
paramVecP := <J_0_P_raute;sE;mE>:
paramVecP := <J_P_P_raute;sE;mE>:
paramVecP_M := Copy(paramVecP):
# Hierdurch (u.a.?) werden die Massen am Ende der Beinkette mit den Dynamikparametern der Plattform zusammengefasst
tmp := Matrix(10,1):
for i to N_LEGS do
  tmpSt := M(NQJ_parallel+1,1)*Multiply(Transpose(vec2skew(P_i(1..3,i))),vec2skew(P_i(1..3,i))):
  tmpSt_raute := Matrix(6,1,[tmpSt(1,1),tmpSt(1,2),tmpSt(1,3),tmpSt(2,2),tmpSt(2,3),tmpSt(3,3)]):
  tmp := <tmpSt_raute,M(NQJ_parallel+1,1)*P_i(1..3,i),M(NQJ_parallel+1,1)>:
  paramVecP_M := paramVecP_M + tmp:
end do:
# Trigonometrische Ausdrücke zusammenfassen.
wD_E_0_E_s_stern := combine2(wD_E_0_E_s_stern):

A_E := <JT_T|JR_T>.<ZeroMatrix(3,6),vec2skew(wD_E_0_E_s)+Multiply(vec2skew(w_E_0_E_s),vec2skew(w_E_0_E_s)),a_E;
        wD_E_0_E_s_stern + Multiply(vec2skew(w_E_0_E_s),w_E_0_E_s_stern),-vec2skew(a_E),ZeroMatrix(3,1)>:
# Term-Vereinfachungen vornehmen: Im planaren Fall kommt sin²+cos² vor.
# Im räumlichen Fall ist die Vereinfachung nachteilig. Dann wird der Term so gelassen.
A_E := combine2(A_E):

# Mass Matrix
#
M_regmin := <JT_T|JR_T>.<ZeroMatrix(3,6),vec2skew(wD_E_0_E_s),Transpose(R_0_0_E_s).Matrix(xEDD_s(1..3,1));
             wD_E_0_E_s_stern,-vec2skew(Transpose(R_0_0_E_s).Matrix(xEDD_s(1..3,1))),ZeroMatrix(3,1)>:
MM_regmin := Matrix(6*6, RowDimension(paramVecP)):

i_rr := 0:
for i to 6 do # Zeilenindex der Massenmatrix
  for j to 6 do  # Spaltenindex der Massenmatrix
    i_rr := i_rr + 1: # Gehe zeilenweise durch den unteren linken Teil der Massenmatrix (inkl. Diagonale)
    for k to RowDimension(paramVecP) do # Spaltenindex der Regressormatrix
    	 if not(xEDD_s[j, 1] = 0) then
        MM_regmin[i_rr, k] := diff(M_regmin[i, k], xEDD_s[j, 1]):
      else
        MM_regmin[i_rr, k] := 0:
      end if:
    end do:
  end do:
end do:
# Term-Vereinfachungen vornehmen: Im planaren Fall kommt sin²+cos² vor:
MM_regmin := combine2(MM_regmin):

# Coriolis Vector
# Nur Fliehkraft-Komponente aus Gesamtkraft.
c_regmin := <JT_T|JR_T>.<ZeroMatrix(3,6),Multiply(vec2skew(w_E_0_E_s),vec2skew(w_E_0_E_s)),ZeroMatrix(3,1);
             Multiply(vec2skew(w_E_0_E_s),w_E_0_E_s_stern),ZeroMatrix(3,3),ZeroMatrix(3,1)>:

# Gravitional Vector
# Gravitationskomponente aus Gesamtkraft.
g_regmin := <JT_T|JR_T>.<ZeroMatrix(3,6),ZeroMatrix(3,3),-Transpose(R_0_0_E_s).g_world;
             ZeroMatrix(3,6),-vec2skew(-Transpose(R_0_0_E_s).g_world),ZeroMatrix(3,1)>:

# Code Export
# Matlab
if codeexport_invdyn then
  MatlabExport(A_E, sprintf("../codeexport/%s/tmp/invdyn_floatb_%s_platform_matlab.m", robot_name, base_method_name), codegen_opt):
  MatlabExport(M_regmin, sprintf("../codeexport/%s/tmp/invdyn_floatb_%s_Mplatform_matlab.m", robot_name, base_method_name), codegen_opt):
  MatlabExport(MM_regmin, sprintf("../codeexport/%s/tmp/invdyn_floatb_%s_MMplatform_matlab.m", robot_name, base_method_name), codegen_opt):
  MatlabExport(c_regmin, sprintf("../codeexport/%s/tmp/invdyn_floatb_%s_cplatform_matlab.m", robot_name, base_method_name), codegen_opt):
  MatlabExport(g_regmin, sprintf("../codeexport/%s/tmp/invdyn_floatb_%s_gplatform_matlab.m", robot_name, base_method_name), codegen_opt):
end if:

# Maple-Export
save paramVecP, paramVecP_M, A_E, M_regmin, c_regmin, g_regmin, H, dH, sprintf("../codeexport/%s/tmp/floatb_%s_platform_dynamic_reg_maple.m", robot_name, base_method_name):

max_stars_repo_name: SchapplM/robsynth-modelgen

max_issues_repo_name: SchapplM/robsynth-modelgen

max_forks_repo_name: SchapplM/robsynth-modelgen


text:
f(){
	[x, y] = stack(), stack(); // get input values from stack
	CreateSpore(CurrentCoords(), x, y, 1, 10);
	// x; y; // just live something on stack to return value from function
}


text:
TITLE
	SNDP_stochastic_MIP;

STOCHASTIC

SCENARIO
	SCEN := 1..3;

INDEX
	VAR_INDEX := (_A12, _B12, _A13, _B13, _A32, _A33, _C24, _C34) : 4;	! index should be created from 4 letters (avoid letter conflict)
	BIN_VAR_INDEX := (_C2, _C3) : 3;
	CONSTR_INDEX := 1..11;

PROBABILITIES
	Prob[SCEN] := (0.25, 0.5, 0.25);

DATA
	Cost[VAR_INDEX] := (2, 2, 2, 2, 1, 0, -11, -10);		!vector qT, transportation costs, selling price (signs are reverted in order to transform to MIN problem)
	Fixed_Cost[BIN_VAR_INDEX] := (2000, 2000);			!vector c, set up costs (signs are reverted in order to transform to MIN problem)
	T[CONSTR_INDEX, BIN_VAR_INDEX] := (	0,		0
						0,		0
						0,		0
						0,		0
						0,		0
						0,		0
						0,		0
						0,		0
						0,		0
						5000,		0
						0,		5000);	!matrix T (technological in 2 stage model)
	W[CONSTR_INDEX, VAR_INDEX] := (	1, 0, 0, 0, 1, 0, -2, 0,
					-1, 0, 0, 0, -1, 0, 2, 0,
					0, 0, 1, 0, 0, 1, 0, -2,
					0, 0, -1, 0, 0, -1, 0, 2,
					0, 1, 0, 0, 0, 0, -3, 0,
					0, -1, 0, 0, 0, 0, 3, 0,
					0, 0, 0, 1, 0, 0, 0, -3,
					0, 0, 0, -1, 0, 0, 0, 3,
					0, 0, 0, 0, 0, 0, -1, -1,
					0, 0, 0, 0, 0, 0, -1, 0,
					0, 0, 0, 0, 0, 0, 0, -1);	!matrix W (recourse in 2 stage model)
RANDOM DATA
	h[SCEN, CONSTR_INDEX] := (0, 0, 0, 0, 0, 0, 0, 0, -2000, 0, 0
				0, 0, 0, 0, 0, 0, 0, 0, -5000, 0, 0
				0, 0, 0, 0, 0, 0, 0, 0, -8000, 0, 0);

STAGE1 BINARY VARIABLES
	y[BIN_VAR_INDEX];

STAGE2 VARIABLES
	x[VAR_INDEX];

MIN									!MAX was transformed to MIN
	Objective = sum(BIN_VAR_INDEX: Fixed_Cost * y) + sum(VAR_INDEX: Cost * x);

SUBJECT TO
    	Constr[CONSTR_INDEX]: sum(VAR_INDEX: W * x) >= h - sum(BIN_VAR_INDEX: T * y);

END

max_stars_repo_name: pashtetGP/optconvert

max_issues_repo_name: pashtetGP/optconvert

max_forks_repo_name: pashtetGP/optconvert