| 02-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,placement): Converts R object to MPCR object.
dataR matrix/vector.
nrowNumber of rows of the new MPCR matrix, default = zero which means a vector will be created.
ncolNumber of cols of the new MPCR matrix, default = zero which means a vector will be created.
precisionString indicates the precision of the new MPCR object (half, single, or double).
placementString indicates whether the data should be allocated on CPU (default) or GPU ("CPU", "GPU")
Convert an MPCR object to R object.
MPCR.ToNumericVector(x): Converts an MPCR object to a numeric R vector.
xMPCR object.
MPCR.ToNumericMatrix(x): Converts an MPCR object to a numeric R matrix.
xMPCR 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", placement="CPU")
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.