D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD02NSF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

D02NSF is a setup routine which must be called prior to an integrator in sub-chapter D02M–N, if full matrix linear algebra is required.

## 2  Specification

 SUBROUTINE D02NSF ( NEQ, NEQMAX, JCEVAL, NWKJAC, RWORK, IFAIL)
 INTEGER NEQ, NEQMAX, NWKJAC, IFAIL REAL (KIND=nag_wp) RWORK(50+4*NEQMAX) CHARACTER(1) JCEVAL

## 3  Description

D02NSF defines the linear algebra to be used as full matrix linear algebra, permits you to specify the method for calculating the Jacobian and checks the validity of certain input values.

## 4  References

See the D02M–N sub-chapter Introduction.

## 5  Parameters

1:     NEQ – INTEGERInput
On entry: the number of differential equations.
Constraint: $1\le {\mathbf{NEQ}}\le {\mathbf{NEQMAX}}$.
2:     NEQMAX – INTEGERInput
On entry: a bound on the maximum number of differential equations to be solved during the integration.
Constraint: ${\mathbf{NEQMAX}}\ge {\mathbf{NEQ}}$.
3:     JCEVAL – CHARACTER(1)Input
On entry: specifies the technique to be used to compute the Jacobian.
${\mathbf{JCEVAL}}=\text{'N'}$
The Jacobian is to be evaluated numerically by the integrator. If this option is used, then the actual argument corresponding to JAC in the call to D02NBF or D02NGF must be either D02NBZ or D02NGZ respectively.
${\mathbf{JCEVAL}}=\text{'A'}$
You must supply a (sub)program to evaluate the Jacobian on a call to the integrator.
${\mathbf{JCEVAL}}=\text{'D'}$
The default choice is to be made. In this case 'D' is interpreted as 'N'.
Only the first character of the actual parameter JCEVAL is passed to D02NSF; hence it is permissible for the actual argument to be more descriptive ‘Numerical’, ‘Analytical’ or ‘Default’ on a call to D02NSF.
Constraint: ${\mathbf{JCEVAL}}=\text{'N'}$, $\text{'A'}$ or $\text{'D'}$.
4:     NWKJAC – INTEGERInput
On entry: the size of the workspace array WKJAC, which you are supplying to the integrator, as declared in the (sub)program from which D02NSF is called.
Constraint: ${\mathbf{NWKJAC}}\ge {\mathbf{NEQMAX}}×\left({\mathbf{NEQMAX}}+1\right)$.
5:     RWORK($50+4×{\mathbf{NEQMAX}}$) – REAL (KIND=nag_wp) arrayCommunication Array
This must be the same workspace array as the array RWORK supplied to the integrator. It is used to pass information from the setup routine to the integrator and therefore the contents of this array must not be changed before calling the integrator.
6:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{NEQ}}<1$, or ${\mathbf{NEQ}}>{\mathbf{NEQMAX}}$, or ${\mathbf{NWKJAC}}<{\mathbf{NEQMAX}}×\left({\mathbf{NEQMAX}}+1\right)$, or ${\mathbf{JCEVAL}}\ne \text{'N'}$, $\text{'A'}$ or $\text{'D'}$.

Not applicable.