ottob3
C OTTOB3 SOURCE CHAT 05/01/13 02:07:00 5004 C====================================================================== C C ENTREES C ------- C A(3,3) = MATRICE SYMETRIQUE C B(3,3) = MATRICE SYMETRIQUE C LADIM = 2 OU 3 SI 2 ON NE S OCCUPE QUE DE A(2,2) C SI 3 DE A(3,3) C SORTIES C ------- C C ON SORT XX(1) < XX(2) < XX(3) C C=============================================================== IMPLICIT INTEGER(I-N) IMPLICIT REAL*8 (A-H,O-Z) -INC PPARAM -INC CCOPTIO DIMENSION A(3,3),B(3,3),XX(3) * KERRE=0 * IF(LADIM.EQ.3) GOTO 700 * * CAS DIMENSION 2 * * A0 + A1*X + A2* X2 * A0=A(1,1)*A(2,2)-A(1,2)*A(1,2) A1=A(1,1)*B(2,2)+A(2,2)*B(1,1)-2.D0*A(1,2)*B(1,2) A2=B(1,1)*B(2,2)-B(1,2)*B(1,2) * IF(IIMPI.EQ.42) THEN WRITE(IOIMP,70615) A0,A1,A2 70615 FORMAT(2X,'OTTOB3 - A0 A1 A2 ',3(1X,1PE12.5)/) ENDIF * IF(A2.EQ.0.D0) THEN IF(A1.EQ.0.D0) THEN WRITE(IOIMP,76000) 76000 FORMAT(2X,'OTTOB3 - A2 ET A1 SONT NULS ' ) KERRE=70 RETURN ENDIF XX1=-A0/A1 XX2=1.D4 ELSE IF(A1.EQ.0.D0) THEN DIS=-A0/A2 IF(DIS.LT.0.D0) THEN WRITE(IOIMP,76001) DIS 76001 FORMAT(2X,'OTTOB3 - RAPPORT DIS NEGATIF = ',1PE12.5/) KERRE=70 RETURN ENDIF XX1=-SQRT(DIS) XX2= SQRT(DIS) ELSE AUX=4.D0*A2*A0/(A1*A1) IF(ABS(AUX).LT.1.D-8) THEN XX1=-A0/A1 - A0*A0*A2/(A1**3) XX2=-A1/A2 -XX1 ELSE DIS = A1*A1-4.D0*A2*A0 * IF(DIS.LT.0.D0) THEN AUX=1.D-12*A1*A1 IF(ABS(DIS).LT.AUX ) THEN DIS= MAX(DIS,0.D0) ELSE W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3)*B(2,3)) & -B(1,2)*(B(3,3)*B(1,2)-B(1,3)*B(2,3)) & +B(1,3)*(B(1,2)*B(2,3)-B(2,2)*B(1,3)) * IF(IIMPI.EQ.42) THEN WRITE(IOIMP,70616) A0,A1,A2,A3 70616 FORMAT(2X,'OTTOB3 - A0 A1 A2 A3 ',4(1X,1PE12.5)/) ENDIF ****** IF(ABS(A3).LT.1.D-6) THEN A3=0.D0 ENDIF ******** * IF(A3.EQ.0.D0) THEN * IF(A2.EQ.0.D0) THEN IF(A1.EQ.0.D0) THEN WRITE(IOIMP,76003) 76003 FORMAT(2X,'OTTOB3 - A3, A2 ET A1 SONT NULS ' ) KERRE=70 RETURN ENDIF XX(1)=-A0/A1 XX(2)=1.D4 XX(3)=1.D4 ELSE DIS = A1*A1-4.D0*A2*A0 *********** DIS = MAX ( DIS, 0.D0) *********** IF(DIS.LT.0.D0) THEN WRITE(IOIMP,76001) DIS KERRE=70 RETURN ENDIF DIS=SQRT(DIS) XX(1)=(-A1-DIS)/(2.D0*A2) XX(2)=(-A1+DIS)/(2.D0*A2) XX(3)=1.D4 ENDIF RETURN * ELSE * * MISE SOUS FORME POUR DEGRE3 * AS0=A0/A3 AS1=A1/A3 AS2=A2/A3 * * IF(IIMPI.EQ.42) THEN WRITE(IOIMP,76005) XR1,XI1,XR2,XI2,XR3,XI3 76005 FORMAT(2X,'OTTOB3 - XR1 = ',1PE12.5,2X,'XI1=',1PE12.5/ & 2X,' XR2 = ',1PE12.5,2X,'XI2=',1PE12.5/ & 2X,' XR3 = ',1PE12.5,2X,'XI3=',1PE12.5/) ENDIF * * xi1 est toujours nul * IF(XI2.NE.0.D0) THEN XX(1)=XR1 XX(2)=1.D4 XX(3)=1.D4 ELSE IF (XR1.LE.XR2.AND.XR1.LE.XR3)THEN XX(1)=XR1 XX(2)=XR2 XX(3)=XR3 IF (XR3.LE.XR2) THEN XX(2)=XR3 XX(3)=XR2 ENDIF * ELSE IF (XR2.LE.XR3.AND.XR2.LE.XR1)THEN XX(1)=XR2 XX(2)=XR3 XX(3)=XR1 IF (XR1.LE.XR3) THEN XX(2)=XR1 XX(3)=XR3 ENDIF * ELSE IF (XR3.LE.XR1.AND.XR3.LE.XR2)THEN XX(1)=XR3 XX(2)=XR1 XX(3)=XR2 IF (XR2.LE.XR1) THEN XX(2)=XR2 XX(3)=XR1 ENDIF ENDIF ENDIF ENDIF RETURN END
© Cast3M 2003 - Tous droits réservés.
Mentions légales