The problem was solved after I used this file:
https://github.com/Expander/FlexibleSUSY/blob/master/meta/Format.m
and put it to here:
C:\Users\tang\AppData\Roaming\Mathematica\Applications\format
Thanks
Update:
there is another problem:
v = Det[{{1, 1, 1, 1}, {x1, x2, x3, x4}, {y1, y2, y3, y4}, {z1, z2,
z3, z4}}]/6;
b1 = -Det[{{1, 1, 1}, {y2, y3, y4}, {z2, z3, z4}}];
c1 = Det[{{1, 1, 1}, {x2, x3, x4}, {z2, z3, z4}}];
d1 = -Det[{{1, 1, 1}, {x2, x3, x4}, {y2, y3, y4}}];
b2 = Det[{{1, 1, 1}, {y1, y3, y4}, {z1, z3, z4}}];
c2 = -Det[{{1, 1, 1}, {x1, x3, x4}, {z1, z3, z4}}];
d2 = Det[{{1, 1, 1}, {x1, x3, x4}, {y1, y3, y4}}];
b3 = -Det[{{1, 1, 1}, {y1, y2, y4}, {z1, z2, z4}}];
c3 = Det[{{1, 1, 1}, {x1, x2, x4}, {z1, z2, z4}}];
d3 = -Det[{{1, 1, 1}, {x1, x2, x4}, {y1, y2, y4}}];
b4 = Det[{{1, 1, 1}, {y1, y2, y3}, {z1, z2, z3}}];
c4 = -Det[{{1, 1, 1}, {x1, x2, x3}, {z1, z2, z3}}];
d4 = Det[{{1, 1, 1}, {x1, x2, x3}, {y1, y2, y3}}];
bcdv = {b1, c1, d1, b2, c2, d2, b3, c3, d3, b4, c4, d4, v};
FortranAssign[bcdv, bcdv, OptimizationSymbol -> tmp]
It will give the following express:
tmp90=-z3
tmp93=-z1
tmp100=-z4
tmp87=-z2
bcdv(1)=y3*z2-y4*z2-y2*z3+y4*z3+y2*z4-y3*z4
bcdv(2)=-(x3*z2)+x4*z2+x2*z3-x4*z3-x2*z4+x3*z4
bcdv(3)=x3*y2-x4*y2-x2*y3+x4*y3+x2*y4-x3*y4
bcdv(4)=-(y3*z1)+y4*z1+y1*z3-y4*z3-y1*z4+y3*z4
bcdv(5)=x3*z1-x4*z1-x1*z3+x4*z3+x1*z4-x3*z4
bcdv(6)=-(x3*y1)+x4*y1+x1*y3-x4*y3-x1*y4+x3*y4
bcdv(7)=y2*z1-y4*z1-y1*z2+y4*z2+y1*z4-y2*z4
bcdv(8)=-(x2*z1)+x4*z1+x1*z2-x4*z2-x1*z4+x2*z4
bcdv(9)=x2*y1-x4*y1-x1*y2+x4*y2+x1*y4-x2*y4
bcdv(10)=-(y2*z1)+y3*z1+y1*z2-y3*z2-y1*z3+y2*z3
bcdv(11)=x2*z1-x3*z1-x1*z2+x3*z2+x1*z3-x2*z3
bcdv(12)=-(x2*y1)+x3*y1+x1*y2-x3*y2-x1*y3+x2*y3
bcdv(13)=x4*(y3*(tmp87+z1)+y1*(tmp90+z2)+y2*(tmp93+z3))+x3*(y2*(
& tmp100+z1)+y4*(tmp93+z2)+y1*(tmp87+z4))+x1*(y3*(tmp100+z2)+y4*(t
& mp87+z3)+y2*(tmp90+z4))+x2*(y4*(tmp90+z1)+y1*(tmp100+z3)+y3*(tmp
& 93+z4))
However, that's not most efficient, the most efficient code is like the following:
x1=x(2)-x(1)
y1=y(2)-y(1)
z1=z(2)-z(1)
x2=x(3)-x(2)
y2=y(3)-y(2)
z2=z(3)-z(2)
x3=x(4)-x(3)
y3=y(4)-y(3)
z3=z(4)-z(3)
x4=x(1)-x(4)
y4=y(1)-y(4)
z4=z(1)-z(4)
B1=Y3*Z2-Y2*Z3
B2=Y3*Z4-Y4*Z3
B3=Y1*Z4-Y4*Z1
B4=Y1*Z2-Y2*Z1
C1=X2*Z3-X3*Z2
C2=X4*Z3-X3*Z4
C3=X4*Z1-X1*Z4
C4=X2*Z1-X1*Z2
D1=X3*Y2-X2*Y3
D2=X3*Y4-X4*Y3
D3=X1*Y4-X4*Y1
D4=X1*Y2-X2*Y1
V=(x(1)*b1+x(2)*b2+x(3)*b3+x(4)*b4)/6.0d0
So my question is: how to let mathematica generate most efficient Fortran code?
Thanks,
Tang Laoya
$Path
, and load it asFormat.m
, not justFormat`
. Alternatively, just load the file using the front end and click the "Run Package" button. $\endgroup$FilterOptions
. >> Needs::nocont: Context UtilitiesFilterOptions
was not created when Needs was evaluated. >> $\endgroup$