Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > 37ce2601040f8edc2329d4714238376a > files > 716

eso-midas-doc-13SEPpl1.2-3.mga5.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>External Functions</TITLE>
<META NAME="description" CONTENT="External Functions">
<META NAME="keywords" CONTENT="vol1">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="vol1.css">
<LINK REL="next" HREF="node135.html">
<LINK REL="previous" HREF="node133.html">
<LINK REL="up" HREF="node127.html">
<LINK REL="next" HREF="node135.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html2235"
 HREF="node135.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="icons.gif/next_motif.gif"></A> 
<A NAME="tex2html2231"
 HREF="node127.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="icons.gif/up_motif.gif"></A> 
<A NAME="tex2html2225"
 HREF="node133.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="icons.gif/previous_motif.gif"></A> 
<A NAME="tex2html2233"
 HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="icons.gif/contents_motif.gif"></A> 
<A NAME="tex2html2234"
 HREF="node216.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="icons.gif/index_motif.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html2236"
 HREF="node135.html">The Fitting Process.</A>
<B> Up:</B> <A NAME="tex2html2232"
 HREF="node127.html">Fitting of Data</A>
<B> Previous:</B> <A NAME="tex2html2226"
 HREF="node133.html">Function Specification</A>
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION001330000000000000000">&#160;</A> 
<A NAME="external-functions">&#160;</A>
<BR>
External Functions
</H1>

<P>
If the set of basic functions provided by the system as listed below is
not sufficient for your own purpose, it is possible to define
user functions.
To do this, the user has to provide the code of the
function(s) as a FORTRAN routine, in his own area, in files named
<TT>USER00.FOR</TT>,... <TT>USER09.FOR</TT>. The command <TT>CREATE/FUNCTION</TT>
will compile the
routine(s) and link them with the corresponding system programs (primitives).
A library with the local definitions of the routines
<TT>USER00</TT>,...,<TT>USER09</TT> and 
the executable code will be created in
the user area. With this scheme, it is possible to fit the external functions
<TT>USER0i</TT> as if they where basic functions. 

<P>
Here is a template to write a user defined function:
<PRE>
C+ 
C.NAME
C       USER0i
C
C.DESCRIPTION
C       ...
C
C.INPUT ARGUMENTS:
C   NIND         INTEGER           Number of independent variables
C   X (NIND)     REAL              Array of NIND elements with the
C                                  independent variable
C   NPAR         INTEGER           Number of parameters
C   PARAM (NPAR) DOUBLE PRECISION  Array of NPAR elements with the
C                                  values of the parameters
C
C.OUTPUT ARGUMENTS:
C   Y            DOUBLE PRECISION  Value of the function
C   DERIV (NPAR) DOUBLE PRECISION  Array of NPAR elements with the
C                                  partial derivatives of the
C                                  function for each parameter
C-
      SUBROUTINE USER0i(NIND,X,NPAR,PARAM,Y,DERIV)
      IMPLICIT NONE
C     ..
C     .. Scalar Arguments ..
      INTEGER NIND,NPAR
      DOUBLE PRECISION Y
C     ..
C     .. Array Arguments ..
      REAL X(NIND)
      DOUBLE PRECISION DERIV(NPAR),PARAM(NPAR)
C     ..
C     .. Local Scalars ..

C     ..
C     .. Local Arrays ..

C     ..
C     .. Executable Statements

      RETURN
      END
</PRE>
The variable <TT>Y</TT> must contain the value of the basic function at the
parameter value <TT>PARAM</TT> and the array <TT>DERIV</TT> has to receive the value
of the partial derivatives, except if the method used is <TT>CGNND</TT>
(the abbreviation of Corrected Gauss-Newton No Derivative).
In the user functions, it is recommended to scale the parameters in
such a way that their absolute values lies in a  small scale range
let us say in 
<!-- MATH: $[0.1 +10.]$ -->
[0.1 +10.].
It is advised to use this scheme to test and debug new functions
that can later on be included in the system supported set.

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html2235"
 HREF="node135.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="icons.gif/next_motif.gif"></A> 
<A NAME="tex2html2231"
 HREF="node127.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="icons.gif/up_motif.gif"></A> 
<A NAME="tex2html2225"
 HREF="node133.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="icons.gif/previous_motif.gif"></A> 
<A NAME="tex2html2233"
 HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="icons.gif/contents_motif.gif"></A> 
<A NAME="tex2html2234"
 HREF="node216.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="icons.gif/index_motif.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html2236"
 HREF="node135.html">The Fitting Process.</A>
<B> Up:</B> <A NAME="tex2html2232"
 HREF="node127.html">Fitting of Data</A>
<B> Previous:</B> <A NAME="tex2html2226"
 HREF="node133.html">Function Specification</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I>Petra Nass</I>
<BR><I>1999-06-09</I>
</ADDRESS>
</BODY>
</HTML>