The

Use the subject list in the previous page, or the quick alphabetic index here below to locate the routine of interest.

## bindex

This function is a replacement forLibrary general Fortran code Calling sequence `INTEGER FUNCTION BINDEX(all,part,i)`Arguments `CHARACTER*(*)``ALL``CHARACTER*(*)``PART``INTEGER``I``INDEX`which**returns**the*absolute*position of the n=th occurrence of string`PART`in string`ALL`, or better in substring`ALL(I:)`, where the returned value`I`is used to keep context as in the following example which looks recursively for subsequent occurrences of the same string.IS=BINDEX('pqrABCdefgABCxyz','ABC',1) returns 4 PARTEND=IS+3-1 3 is the true length of PART IS=BINDEX('pqrABCdefgABCxyz','ABC',PARTEND+1) returns 11

The coding is just a trivial use of`INDEX`keeping account of the offsets.

## bit_init_handle

This`LOGICAL`function has 4 different entry points and is used to simulate a bit array (8 bits at a time are stored in a character array, thus`NX*NY/8`bytes are used) using portable "character arithmetics" (ICHAR and CHAR functions).

The initialization call allocates memory space for a bit array of dimensionsLibrary general Fortran code Calling sequence `LOGICAL dummy=BIT_INIT_HANDLE(nx,ny)`Arguments `INTEGER``NX,NY``NX`times`NY`initialized to all zeroes.Calling sequence `LOGICAL dummy=BIT_SET(ix,iy,value)`Arguments `INTEGER``IX,IY``INTEGER``VALUE [1|0]``VALUE`the bit at position`IX,IY`.Calling sequence `IF (BIT_GET(ix,iy) THEN ...`Arguments `INTEGER``IX,IY`**returns**a`.TRUE.`value if the bit at position`IX,IY`is 1, and`.FALSE.`otherwise.Calling sequence `LOGICAL dummy=BIT_NUMBER(ne)`Arguments `INTEGER``N`**returns**the number`N`of bits in the array set to 1.

## blksyscommon

ThisLibrary general Fortran code Calling sequence `EXTERNAL BLKSYSCOMMON``BLOCK DATA`routine is called implicitly by conversion_needed to initialize the SYSCOMMON common block used to keep track of the data conversion needed between a foreign operating system and the target (local) operating system. The initialization assumes*no conversion needed*.

## collapse

This trivial routine collapsesLibrary general Fortran code Calling sequence `CALL COLLAPSE(string)`Arguments `CHARACTER*(*)``STRING`**in place**all duplicated blanks in`STRING`into a single blank. I.e. a string`'ABC`is returned as`'ABC`

## conversion_needed

This call is used to fill the SYSCOMMON common block with the flags indicating specific data conversions are necessary (for integer, real, and character data respectively) between theLibrary general Fortran code Calling sequence `CALL CONVERSION_NEEDED(local,foreign)`Arguments `CHARACTER*(3)``LOCAL``CHARACTER*(3)``FOREIGN``FOREIGN`operating system and the`LOCAL`operating system, where`LOCAL`and`FOREIGN`are the operating system codes returned by z_op_sys.

## curft

TheLibrary general Fortran code Calling sequence See Bevington's book "Data reduction and Error Analysis for the Physical Sciences", McGraw-Hill, 1969, Arguments See Bevington's book `CURFT`routine is part of the CURFIT fitting package, used for the line Gaussian fits in the gain history accumulation programs, as well as by unofficial software. It includes also the following auxiliary routines.## fchi

Chisquare computation routine in the CURFIT package.Library general Fortran code Calling sequence See Bevington's book Arguments See Bevington's book ## fder

Partial derivative computation routine in the CURFIT package.Library general Fortran code Calling sequence See Bevington's book Arguments See Bevington's book ## mtinv

Matrix inversion routine in the CURFIT package.Library general Fortran code Calling sequence See Bevington's book Arguments See Bevington's book

## dotproduct

A trivial function whichLibrary general Fortran code Calling sequence `DOUBLE PRECISION val=DOTPRODUCT(a,b,n)`Arguments `DOUBLE PRECISION``A(*),B(*)``INTEGER``N`**returns**the dot product of two arrays`A`and`B`of dimension`N`.

## extrp

A couple of trivial functions which return the linear interpolation at coordinate`X`between two points (`X1,Y1`) and (`X2,Y2`) with a protection to avoid divide checks when X1=X2.

Comes in two flavours for different precision.Library general Fortran code Calling sequence `REAL y=EXTRP(y1,y2,x1,x2,x)`Arguments `REAL``X1,Y1``REAL``X2,Y2``REAL``X`## extrpd

Library general Fortran code Calling sequence `DOUBLE PRECISION y=EXTRP(y1,y2,x1,x2,x)`Arguments `DOUBLE PRECISION``X1,Y1``DOUBLE PRECISION``X2,Y2``DOUBLE PRECISION``X`

## free_lu

A trivial routine whichLibrary general Fortran code Calling sequence `CALL FREE_LU(lu)`Arguments `INTEGER``LU`**returns**the next free (unopened) logical unit in range 1-99, or the value -1 if no free units exist.

## gnomonic

Spherical trigonometry routine which returns the gnomonic angular coordinatesLibrary general Fortran code Calling sequence `CALL GNOMONIC(TRA,TDEC,ZRA,ZDEC,CSI,ETA)`Arguments `DOUBLE PRECISION``TRA,TDEC``DOUBLE PRECISION``ZRA,ZDEC``DOUBLE PRECISION``CSI,ETA``CSI,ETA`of a target`TRA,TDEC`with respect to a pointing`ZRA,ZDEC`according to the prescriptions of C A Murray, Vectorial Astrometry, pag. 191 ff.

All angular quantities shall be in radians.

## hexi4

A trivial routine which converts a (zero-padded on the left) hexadecimal digitLibrary general Fortran code Calling sequence `CALL HEXI4(hex,i4)`Arguments `CHARACTER*(1-8)``HEX``INTEGER``I4``HEX`(as a string of 1 to 8 characters) into a 32-bit integer value`I4`

## interpolate

This interpolation routine takes x=Library general Fortran code Calling sequence `CALL INTERPOLATE(DATUM,X,Y,N)`Arguments `REAL``DATUM``REAL``X(*),Y(*)``INTEGER``N``DATUM`, locates the two X values X(i),X(i+1) in the`X`array which comprise it, and**returns in the same**`DATUM`the y coordinate linearly interpolated between X(i),Y(i) and X(i+1),Y(i+1) using values in the`Y`array, and the extrp routine.

Both arrays are of dimension`N`.

If x=`DATUM`lies outside`X`, an extrapolation from the first or last two points is made.

## lowcase

Trivial routine to convert in place aLibrary general Fortran code Calling sequence `CALL LOWCASE(string)`Arguments `CHARACTER*(*)``STRING``STRING`to lower case.

## matproduct

A trivial routine whichLibrary general Fortran code Calling sequence `CALL MATPRODUCT(A,B,C,N)`Arguments `DOUBLE PRECISION``A(n,n),B(n,n)``DOUBLE PRECISION``C(n,n)``INTEGER``N`**returns**the matricial product`C`of two square arrays`A`and`B`of dimension`N*N`.

## radecroll

Spherical trigonometry routine whichLibrary general Fortran code Calling sequence `CALL RADECROLL(EULER,RA,DEC,ROLL)`Arguments `DOUBLE PRECISION``EULER(3,3)``DOUBLE PRECISION``RA,DEC,ROLL`**returns**a pointing`RA,DEC`and`ROLL`angle (in radians) given an input`EULER`matrix.

## ran1

Random number generator of values uniformly distributed in the range 0.0-1.0. Must be initialized calling it with a negative seed and then called repeatedly to extract random values, as in the exampleLibrary general Fortran code Calling sequence `REAL value=RAN1(ISEED)`Arguments `INTEGER``ISEED`ISEED=-123456789 dummy=RAN1(ISEED) ... DO i=1,n VAL(i)=RAN1(ISEED) ENDDO

## swapi2

A family of in-place byte swapping routines for 16-bit, 32-bit and 64-bit quantities. They operate on an array`DATA`of dimension`N`exploiting an equivalence with a local array of characters.

The above version is specific of 16-bit integers.Library general Fortran code Calling sequence `CALL SWAPI2(DATA,N)`Arguments `INTEGER*2``DATA(*)``INTEGER``N`## swapi4

The 32-bit version can be user with both INTEGER and REAL arguments.Library general Fortran code Calling sequence `CALL SWAPI4(DATA,N)`Arguments `any*4``DATA(*)``INTEGER``N`## swapr8

The above version is specific of 64-bit real data (DOUBLE PRECISION).Library general Fortran code Calling sequence `CALL SWAPR8(DATA,N)`Arguments `REAL*8``DATA(*)``INTEGER``N`

## time_1970

A family of routines to handle conversion of times. An*Unix time*`I70`is defined as the 32-bit number of seconds since 1 Jan 1970. A*time array*`ITIME(7)`is an array containing year,month,day,hour,minute,seconds and hundredth of seconds (the latter usually zero). An*ASCII time string*`TIME`is in the form`YYYY-MON-DD HH:MM:SS.FF`with three-letter codes for months.

The above converts from time array to Unix time.Library general Fortran code Calling sequence `CALL TIME_1970(ITIME,I70)`Arguments `INTEGER``ITIME(7)``INTEGER``I70`## time_array

The above converts from Unix time to time arrayLibrary general Fortran code Calling sequence `CALL TIME_ARRAY(I70,ITIME)`Arguments `INTEGER``I70``INTEGER``ITIME(7)`## time_ascii

The above converts from Unix time to an ASCII time string (at least 23 characters are necessary.Library general Fortran code Calling sequence `CALL TIME_ASCII(I70,TIME)`Arguments `INTEGER``I70``CHARACTER*(23)``TIME`

## true_length

A trivial routine which returns the "true" length ofLibrary general Fortran code Calling sequence `INTEGER l=TRUE_LENGTH(string)`Arguments `CHARACTER*(*)``STRING``STRING`, i.e. excluding any trailing blanks.

## udouble

This routine takes a 32-bit integerLibrary general C code Calling sequence `DOUBLE PRECISION var=UDOUBLE(i)`Arguments `INTEGER``I``I`which might contain an*unsigned*value (unsupported in Fortran) and uses C to cast it into a DOUBLE PRECISION value.In practice this is used for the support of spacecraft times.

## upcase

Trivial routine to convert in place aLibrary general Fortran code Calling sequence `CALL UPCASE(string)`Arguments `CHARACTER*(*)``STRING``STRING`to upper case.