Calls an algorithm from the NAG Library.
|Controls printed output (
||Name of the algorithm to call; default
||Value to be given to zero divided by zero in Genstat expressions defined in the
||If the scalar is non missing, this defines the smallest non-zero number for use in Genstat expressions defined in the
||Seed to use for any random number generation in Genstat expressions defined in the
||If a Genstat expression defined in the
||Arguments for the call|
||Stores the result for algorithms that take the form of a function rather than a subroutine|
NAG provides access to some specific algorithms in the Numerical Algorithms Group’s subroutine libraries. You can set option
PRINT=algorithms to list those that are currently available. The other setting
monitoring gives additional monitoring from algorithms like
D02KDF that can give additional monitoring information from a
MONIT subroutine. (
NAG includes a custom version of
MONIT for each routine, that provides all the relevant information.)
The name of the algorithm is specified using the
NAME option. It is best to give the name in full, as the NAG names may not be distinct in their first four characters and so the standard abbreviation rules (e.g. that four characters are sufficient) cannot be guaranteed in all future releases. The arguments for the call are supplied, in a pointer, using the
ARGUMENTS parameter. These must be in the order required by the algorithm, and input arguments must be of the correct type (number or string) and shape (vector, matrix and so on); for details see the relevant NAG documentation. Output arguments are defined automatically from the results. The
RESULT parameter saves the result if the NAG algorithm is a function rather than a subroutine.
Some NAG algorithms may have an argument that is an external function or subroutine that performs a calculation. This can be specified for the
NAG directive by supplying a pointer whose first element defines the calculation using a Genstat expression, or a pointer to several Genstat expressions. With an external function, the next element of the pointer should be the Genstat data structure that receives the result of the calculation in the expression(s). The remaining elements should be the Genstat data structures that correspond to the arguments of the external function or subroutine, in the order in which they occur in the definition of the function or subroutine in the NAG documentation. The expression or expressions are evaluated within the
NAG directive by making a call to the
CALCULATE directive. The
INDEX options of the
NAG directive can be used to set the corresponding options of
CALCULATE for the call.
Commands for: Calculations and manipulation.
" Example 1:4.13a " VARIATE [VALUES=1,1,2,2,3,4,4,5,5,8,8,8,8,11,11,12,12,15,17,22,23,\ 6,6,6,6,7,9,10,10,11,13,16,17,19,20,22,23,25,32,32,34,35] Time & [VALUES=24(0),1,0,1,0,1,1,0,0,1,1,1,0,0,1,1,1,1,1] Censor FACTOR [LABELS=!t(control,'6-mercaptopurine'); VALUES=21(1,2)] Treat TEXT [VALUE='N'] OFFSET VARIATE T,IC; VALUE=Time,Censor CALCULATE N = NVALUES(T) SCALAR M,NS; VALUE=1,0 MATRIX [ROWS=N; COLUMNS=M] Z CALCULATE Z$[*;1] = Treat .EQ. 2 CALCULATE LDZ = NVALUES(Z) VARIATE [VALUES=1] ISZ CALCULATE IP = SUM(ISZ) VARIATE [VALUES=1] OMEGA,ISI VARIATE [NVALUES=IP] SE,SC VARIATE [VALUES=0] B SYMMETRIC [ROWS=IP] COV VARIATE [NVALUES=N] RES SCALAR TOL,MAXIT,IPRINT; VALUE=1.E-6,50,0 VARIATE WK VARIATE IWK POINTER [VALUES=OFFSET,N,M,NS,Z,LDZ,ISZ,IP,T,\ IC,OMEGA,ISI,DEV,B,SE,SC,COV,RES,ND,\ TP,SUR,NDMAX,TOL,MAXIT,IPRINT,WK,IWK,IFAIL] Args NAG [NAME=G12BAF] Args PRINT DEV,ND,IFAIL PRINT B,SE