Prev | Next |

@(@\newcommand{\B}[1]{{\bf #1}} \newcommand{\R}[1]{{\rm #1}}@)@

Syntax

Purpose

a_x

a_y

f

m

n

level

Example

*f* = adfun(*a_x*, *a_y*)

The function object

*f*

will store the
`type( `*a_x*[0] )

operation sequence that mapped the independent variable vector
*a_x*

to the dependent variable vector
*a_y*

.
The argument

*a_x*

is the `numpy.array`

returned by the previous call to independent
.
Neither the size of
*a_x*

, or the value it its elements,
may change between calling

*a_x* = independent(*x*)

and

*f* = adfun(*a_x*, *a_y*)

The length of the vector
*a_x*

determines the domain size
@(@
n
@)@ for the function @(@
y = F(x)
@)@ below.
The argument

*a_y*

specifies the dependent variables.
It must be a `numpy.array`

with one dimension
(i.e., a vector) and with the same type of elements as
*a_x*

.
The object
*f*

stores the
`type( `*a_x*[0] )

operations
that mapped the vector
*a_x*

to the vector
*a_y*

.
The length of the vector
*a_y*

determines the range size
@(@
m
@)@ for the function @(@
y = F(x)
@)@ below.
The return value

*f*

can be used to evaluate the function
@[@
F : \B{R}^n \rightarrow \B{R}^m
@]@
and its derivatives, where @(@
y = F(x)
@)@ corresponds to the
operation sequence mentioned above.
m

The range size @(@ m @)@ is equal to the length of the vector

*a_y*

.
n

The domain size @(@ n @)@ is equal to the length of the vector

*a_x*

.
level

The ad level for the object

*f*

is one less than
the AD level for the arguments
*a_x*

and
*a_y*

;
i.e., if
`type( `*a_x*[0] )

is `a_float`

(`a2float`

)
the corresponding AD level for
*f*

is zero (one).
The file adfun.py contains an example and test of this function.

Input File: pycppad/adfun.py