Converters: Converters

03-ConvertersR Documentation

Converters

Description

Converters from R to MPCR objects and vice-versa.

Value

An MPCR or R numeric vector/matrix.

MPCR Converter

Convert R object to MPCR object.

MPCR converters


as.MPCR(data,nrow = 0,ncol = 0,precision): Converts R object to MPCR object.

data

R matrix/vector.

nrow

Number of rows of the new MPCR matrix, default = zero which means a vector will be created.

ncol

Number of cols of the new MPCR matrix, default = zero which means a vector will be created.

precision

String indicates the precision of the new MPCR object (half, single, or double).

R Converter

Convert an MPCR object to R object.

R vector converter


MPCR.ToNumericVector(x): Converts an MPCR object to a numeric R vector.

x

MPCR object.

R matrix converter


MPCR.ToNumericMatrix(x): Converts an MPCR object to a numeric R matrix.

x

MPCR object.

Examples

   # Example usage of the class and its methods
   library(MPCR)
   a <- matrix(1:36, 6, 6)
   MPCR_matrix <- as.MPCR(a,nrow=6,ncol=6,precision="single")
   r_vector <- MPCR.ToNumericVector(MPCR_matrix)
   r_vector
   r_matrix <- MPCR.ToNumericMatrix(MPCR_matrix)
   r_matrix

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

Related to Converters in MPCR...