### Description

A limited set of complex number operations can be used when constructing AD tapes. The available methods are listed in this help page.

### Usage

``````adcomplex(real, imag = rep(advector(0), length(real)))

## S3 method for class 'adcomplex'
Re(z)

## S3 method for class 'adcomplex'
Im(z)

## S4 method for signature 'adcomplex'
show(object)

## S3 method for class 'adcomplex'
dim(x)

## S3 replacement method for class 'adcomplex'
dim(x) <- value

## S3 method for class 'adcomplex'
x[...]

## S3 replacement method for class 'adcomplex'
x[...] <- value

## S3 method for class 'adcomplex'
t(x)

## S3 method for class 'adcomplex'
length(x)

## S3 method for class 'adcomplex'
Conj(z)

## S3 method for class 'adcomplex'
Mod(z)

## S3 method for class 'adcomplex'
x + y

## S3 method for class 'adcomplex'
x - y

## S3 method for class 'adcomplex'
x * y

## S3 method for class 'adcomplex'
x / y

## S3 method for class 'adcomplex'
exp(x)

## S3 method for class 'adcomplex'
sqrt(x)

## S4 method for signature 'adcomplex'
fft(z, inverse = FALSE)

## S4 method for signature 'advector'
fft(z, inverse = FALSE)
``````

### Arguments

 `real` Real part `imag` Imaginary part `z` An object of class `'adcomplex'` `object` An object of class `'adcomplex'` `x` An object of class `'adcomplex'` `value` Replacement value `...` As [ `y` An object of class `'adcomplex'` `inverse` As fft

### Value

Object of class `"adcomplex"`.

### Functions

• `adcomplex()`: Construct `adcomplex` vector

• `Re(adcomplex)`: As complex

• `Im(adcomplex)`: As complex

• `show(adcomplex)`: Print method

• `dim(adcomplex)`: As dim

• `dim(adcomplex) <- value`: As dim

• `[`: As [

• ``[`(adcomplex) <- value`: As [<-

• `t(adcomplex)`: As t

• `length(adcomplex)`: As length

• `Conj(adcomplex)`: As complex

• `Mod(adcomplex)`: As complex

• ` + `: As complex

• ` - `: As complex

• ` * `: As complex

• ` / `: As complex

• `exp(adcomplex)`: As complex

• `sqrt(adcomplex)`: As complex

• `fft(adcomplex)`: Fast Fourier Transform equivalent to fft. Notably this is the multivariate transform when `x` is an array.

• `fft(advector)`: If real input is supplied it is first converted to complex.

### Examples

``````## Tape using complex operations
F <- MakeTape(function(x) {
x <- as.complex(x)
y <- exp( x * ( 1 + 2i ) )
c(Re(y), Im(y))
}, numeric(1))
F
F(1)
## Complex FFT on the tape
G <- MakeTape(function(x) sum(Re(fft(x))), numeric(3))
G\$simplify()
G\$print()
``````

RTMB documentation built on May 29, 2024, 8:45 a.m.