Brackets: Extract or replace elements from an MPCR object.

06-Extract-ReplaceR Documentation

Extract or replace elements from an MPCR object.

Description

Extract or replace elements from an MPCR object using the '[', '[[', '[<-', and '[[<-' operators. When extracting values, they will be converted to double precision. However, if you update a single object, the double value will be cast down to match the precision. If the MPCR object is a matrix and you access it using the 'i' index, the operation is assumed to be performed in column-major order, or using 'i' and 'j' index.

Usage

  ## S4 method for signature 'Rcpp_MPCR'
x[i, j, drop = TRUE]
  ## S4 replacement method for signature 'Rcpp_MPCR'
x[i, j, ...] <- value
  ## S4 method for signature 'Rcpp_MPCR'
x[[i, drop = TRUE]]
  ## S4 replacement method for signature 'Rcpp_MPCR'
x[[i, ...]] <- value

Arguments

x

An MPCR object.

i

Row index or indices.

j

Column index or indices.

...

ignored.

drop

ignored.

value

A value to replace the selected elements with.

Examples

  library(MPCR)
    x <-as.MPCR(1:50,precision="single")
    ext <- x[5]
    x[5] <- 0
    x$ToMatrix(5,10)
    x[2,5]
    x[3,5] <- 100


MPCR documentation built on April 13, 2025, 5:08 p.m.

Related to Brackets in MPCR...