DeepCopy: copy

08-CopyR Documentation

copy

Description

Functions for copying MPCR objects.

Value

An MPCR copy from the input object.

MPCR deep copy

Create a copy of an MPCR object. Typically, using 'equal' creates a new pointer for the object, resulting in any modifications made to object one affecting object two as well.

copy


MPCR.copy(x): Create a new copy of an MPCR object.

x

MPCR object.

MPCRTile deep copy

Create a duplicate of an MPCRTile object. Usually, using 'equal' creates a new pointer for the object, causing any modifications made to object one to affect object two as well.

copy


MPCRTile.copy(x): Create a new copy of an MPCRTile matrix.

x

MPCRTile matrix.

Examples


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

   # Normal equal '=' will create a new pointer of the object, so any change in object A
   # will affect object B
   temp_MPCR_matrix = MPCR_matrix
   temp_MPCR_matrix[2,2] <- 500
   MPCR_matrix[2,2]           #500


   MPCR_matrix_copy <- MPCR.copy(MPCR_matrix)
   MPCR_matrix[2,2] <-100
   MPCR_matrix_copy[2,2] <- 200

   MPCR_matrix[2,2]           #100
   MPCR_matrix_copy[2,2]      #200

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

Related to DeepCopy in MPCR...