03-Converters | R Documentation |
Converters from R to MPCR objects and vice-versa.
An MPCR or R numeric vector/matrix.
Convert R object to MPCR object.
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).
Convert an MPCR object to R object.
MPCR.ToNumericVector(x)
: Converts an MPCR object to a numeric R vector.
x
MPCR object.
MPCR.ToNumericMatrix(x)
: Converts an MPCR object to a numeric R matrix.
x
MPCR object.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.