File r38/log/gentran.rlg artifact 870e05c690 part of check-in 12412d85b9


Tue Apr 15 00:34:15 2008 run on win32
MATRIX M(3,3)$


M(1,1) := 18*COS(Q3)*COS(Q2)*M30*P**2 - 9*SIN(Q3)**2*P**2*M30
	  - SIN(Q3)**2*J30Y + SIN(Q3)**2*J30Z + P**2*M10
	  + 18*P**2*M30 + J10Y + J30Y;


                                  2          2               2
m(1,1) := 18*cos(q2)*cos(q3)*m30*p  - sin(q3) *j30y + sin(q3) *j30z

                      2      2                      2           2
           - 9*sin(q3) *m30*p  + j10y + j30y + m10*p  + 18*m30*p

M(2,1) :=
M(1,2) := 9*COS(Q3)*COS(Q2)*M30*P**2 - SIN(Q3)**2*J30Y +
	  SIN(Q3)**2*J30Z - 9*SIN(Q3)**2*M30*P**2 + J30Y +
	  9*M30*P**2;


                                           2          2               2
m(2,1) := m(1,2) := 9*cos(q2)*cos(q3)*m30*p  - sin(q3) *j30y + sin(q3) *j30z

            2      2                 2
 - 9*sin(q3) *m30*p  + j30y + 9*m30*p

M(3,1) :=
M(1,3) := -9*SIN(Q3)*SIN(Q2)*M30*P**2;


                                              2
m(3,1) := m(1,3) :=  - 9*sin(q2)*sin(q3)*m30*p

M(2,2) := -SIN(Q3)**2*J30Y + SIN(Q3)**2*J30Z - 9*SIN(Q3)**2
	   *M30*P**2 + J30Y + 9*M30*P**2;


                    2               2                 2      2                 2
m(2,2) :=  - sin(q3) *j30y + sin(q3) *j30z - 9*sin(q3) *m30*p  + j30y + 9*m30*p

M(3,2) :=
M(2,3) := 0;


m(3,2) := m(2,3) := 0

M(3,3) := 9*M30*P**2 + J30X;


                        2
m(3,3) := j30x + 9*m30*p


GENTRANLANG!* := 'FORTRAN$


FORTLINELEN!* := 72$



GENTRAN LITERAL "C", CR!*,
		"C", TAB!*, "*** COMPUTE VALUES FOR MATRIX M ***", CR!*,
		"C", CR!*$

c
c     *** compute values for matrix m ***
c


FOR j:=1:3 DO
    FOR k:=j:3 DO
	 GENTRAN M(j,k) ::=: M(j,k)$

      m(1,1)=18.0*cos(real(q2))*cos(real(q3))*m30*p**2-(sin(real(q3))**2
     . *j30y)+sin(real(q3))**2*j30z-(9.0*sin(real(q3))**2*m30*p**2)+j10y
     . +j30y+m10*p**2+18.0*m30*p**2
      m(1,2)=9.0*cos(real(q2))*cos(real(q3))*m30*p**2-(sin(real(q3))**2*
     . j30y)+sin(real(q3))**2*j30z-(9.0*sin(real(q3))**2*m30*p**2)+j30y+
     . 9.0*m30*p**2
      m(1,3)=-(9.0*sin(real(q2))*sin(real(q3))*m30*p**2)
      m(2,2)=-(sin(real(q3))**2*j30y)+sin(real(q3))**2*j30z-(9.0*sin(
     . real(q3))**2*m30*p**2)+j30y+9.0*m30*p**2
      m(2,3)=0.0
      m(3,3)=j30x+9.0*m30*p**2


GENTRAN LITERAL "C", CR!*,
		"C", TAB!*, "*** COMPUTE VALUES FOR INVERSE MATRIX ***",
		     CR!*,
		"C", CR!*$

c
c     *** compute values for inverse matrix ***
c


SHARE var$


FOR j:=1:3 DO
    FOR k:=j:3 DO
	IF M(j,k) NEQ 0 THEN
	<<
	    var := TEMPVAR NIL;
	    MARKVAR var;
	    M(j,k) := var;
	    M(k,j) := var;
	    GENTRAN
		EVAL(var) := M(EVAL(j),EVAL(k))
        >>$

      t0=m(1,1)
      t1=m(1,2)
      t2=m(1,3)
      t3=m(2,2)
      t4=m(3,3)


COMMENT -- Contents of Matrix M: --$

M := M;


     [t0  t1  t2]
     [          ]
m := [t1  t3  0 ]
     [          ]
     [t2  0   t4]



MATRIX MXINV(3,3)$


MXINV := M**(-1)$



FOR j:=1:3 DO
    FOR k:=j:3 DO
	GENTRAN MXINV(j,k) ::=: MXINV(j,k)$

      mxinv(1,1)=(t3*t4)/(t0*t3*t4-(t1**2*t4)-(t2**2*t3))
      mxinv(1,2)=-(t1*t4)/(t0*t3*t4-(t1**2*t4)-(t2**2*t3))
      mxinv(1,3)=-(t2*t3)/(t0*t3*t4-(t1**2*t4)-(t2**2*t3))
      mxinv(2,2)=(t0*t4-t2**2)/(t0*t3*t4-(t1**2*t4)-(t2**2*t3))
      mxinv(2,3)=(t1*t2)/(t0*t3*t4-(t1**2*t4)-(t2**2*t3))
      mxinv(3,3)=(t0*t3-t1**2)/(t0*t3*t4-(t1**2*t4)-(t2**2*t3))


GENTRAN
   for j:=1:3 do
       for k:=j+1:3 do
       <<
	   m(k,j) := m(j,k);
	   mxinv(k,j) := mxinv(j,k)
        >>$

      do 25001 j=1,3
          do 25002 k=j+1,3
              m(k,j)=m(j,k)
              mxinv(k,j)=mxinv(j,k)
25002     continue
25001 continue


END$


Time for test: 9 ms, plus GC time: 4 ms


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]