diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /math/slalib/invf.f | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'math/slalib/invf.f')
-rw-r--r-- | math/slalib/invf.f | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/math/slalib/invf.f b/math/slalib/invf.f new file mode 100644 index 00000000..90eb83b9 --- /dev/null +++ b/math/slalib/invf.f @@ -0,0 +1,106 @@ + SUBROUTINE slINVF (FWDS,BKWDS,J) +*+ +* - - - - - +* I N V F +* - - - - - +* +* Invert a linear model of the type produced by the slFTXY routine. +* +* Given: +* FWDS d(6) model coefficients +* +* Returned: +* BKWDS d(6) inverse model +* J i status: 0 = OK, -1 = no inverse +* +* The models relate two sets of [X,Y] coordinates as follows. +* Naming the elements of FWDS: +* +* FWDS(1) = A +* FWDS(2) = B +* FWDS(3) = C +* FWDS(4) = D +* FWDS(5) = E +* FWDS(6) = F +* +* where two sets of coordinates [X1,Y1] and [X2,Y1] are related +* thus: +* +* X2 = A + B*X1 + C*Y1 +* Y2 = D + E*X1 + F*Y1 +* +* the present routine generates a new set of coefficients: +* +* BKWDS(1) = P +* BKWDS(2) = Q +* BKWDS(3) = R +* BKWDS(4) = S +* BKWDS(5) = T +* BKWDS(6) = U +* +* such that: +* +* X1 = P + Q*X2 + R*Y2 +* Y1 = S + T*X2 + U*Y2 +* +* Two successive calls to slINVF will thus deliver a set +* of coefficients equal to the starting values. +* +* To comply with the ANSI Fortran standard, FWDS and BKWDS must +* not be the same array, even though the routine is coded to +* work on many platforms even if this rule is violated. +* +* See also slFTXY, slPXY, slXYXY, slDCMF +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION FWDS(6),BKWDS(6) + INTEGER J + + DOUBLE PRECISION A,B,C,D,E,F,DET + + + + A=FWDS(1) + B=FWDS(2) + C=FWDS(3) + D=FWDS(4) + E=FWDS(5) + F=FWDS(6) + DET=B*F-C*E + IF (DET.NE.0D0) THEN + BKWDS(1)=(C*D-A*F)/DET + BKWDS(2)=F/DET + BKWDS(3)=-C/DET + BKWDS(4)=(A*E-B*D)/DET + BKWDS(5)=-E/DET + BKWDS(6)=B/DET + J=0 + ELSE + J=-1 + END IF + + END |