Extract: Extract or Replace Parts of a multipol

Extract.multipolR Documentation

Extract or Replace Parts of a multipol

Description

Extract or replace subsets of multipols

Usage

          ## S3 method for class 'multipol'
x[...]
          ## S3 replacement method for class '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).

Author(s)

Original code taken from the Oarray package by Jonty Rougier

References

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

Examples

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

multipol documentation built on Aug. 21, 2023, 9:10 a.m.