Description Usage Arguments Details Value Author(s) See Also Examples
This function creates a gmatrix
object from an input value.
1 2 |
data |
The input data. Must be a |
nrow |
the desired number of rows |
ncol |
the desired number of rows. |
byrow |
logical. If FALSE (the default) the matrix is filled by columns, otherwise the matrix is filled by rows. |
dimnames |
A dimnames attribute for the matrix: NULL or a list of length 2 giving the row and column names respectively. An empty list is treated as NULL. |
type |
The type (i.e. |
dup |
|
This is implemented in a very similar fashion to the matrix
function in R base.
returns a gmatrix
object.
Nathan Morrris
1 2 3 4 5 6 7 8 | x=gmatrix(grnorm(100),10,10, type='d') #this makes an unneeded duplication
x=gmatrix(grnorm(100),10,10, dup=FALSE) #this avoids the duplication
#problematic code
x=grnorm(100)
y=as.gmatrix(x,10,10, dup=FALSE) #don't do this
y[1,1]=100 #this changes both y and x because both point to the same spot in GPU memory
x
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.