ADcomplex {RTMB}R Documentation

AD complex numbers

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'
Arg(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'
log(x, base)

## 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)

## S3 method for class 'adcomplex'
rep(x, ...)

## S3 method for class 'adcomplex'
as.vector(x, mode = "any")

## S3 method for class 'adcomplex'
is.matrix(x)

## S3 method for class 'adcomplex'
as.matrix(x, ...)

## S4 method for signature 'adcomplex,ANY'
x %*% y

## S4 method for signature 'adcomplex,ANY'
solve(a, b)

## S4 method for signature 'adcomplex'
colSums(x)

## S4 method for signature 'adcomplex'
rowSums(x)

## S4 method for signature 'adcomplex,ANY,ANY'
diag(x)

## S4 method for signature 'advector,adcomplex'
Ops(e1, e2)

## S4 method for signature 'adcomplex,advector'
Ops(e1, e2)

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'

base

Not implemented

inverse

As fft

mode

As as.vector

a

matrix

b

matrix, vector or missing

e1

Left operand

e2

Right operand

Value

Object of class "adcomplex".

Functions

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()

[Package RTMB version 1.6 Index]