multipol (version 1.0-7)

Extract.multipol: Extract or Replace Parts of a multipol

Description

Extract or replace subsets of multipols

Usage

# S3 method for multipol
[(x, …)
          # S3 method for multipol
[(x, …) <- value

Arguments

x

A multipol

...

Indices to replace. Offset zero! See details section

value

replacement value

Details

Extraction and replacement operate with offset zero (using functions taken from the Oarray package); see the examples section. This is so that the index matches the power required (there is an off-by-one issue. The first element corresponds to the zeroth power. One wants index i to extract/replace the \(i\)-th power and in particular one wants index 0 to extract/replace the zeroth power).

Replacement operators return a multipol. Extraction returns an array. This is because it is often not clear exactly what multipol is desired from an extraction operation (it is also consistent with Oarray's behaviour).

References

Jonathan Rougier (2007). Oarray: Arrays with arbitrary offsets. R package version 1.4-2.

Examples

# NOT RUN {
a <- as.multipol(matrix(1,4,6))
a[2,2] <- 100
a                  # coefficient of x1^2.x2^2 is 100

a[1:2,1:2]         # a matrix.  Note this corresponds to first and second powers
                   # not zeroth and first (what multipol would you want here?)

a[2,2]             # 100 to match the "a[2,2] <- 100" assignment above
# }