RMatrix

This struct is used to work with a matrix that has been allocated in R. A pointer to the data is held, along with the dimensions. An RMatrix struct is reference counted to take care of protecting it from the R garbage collector while in use, and unprotecting when it is no longer used, as necessary.

You can refer to elements using standard matrix notation, i.e., x[1,4]. No matrix operations are provided, as this struct exists only to facilitate the passing of data, and each user will have her own preferred way to do things like matrix multiplication.

Constructors

this
this(int r, int c)

Allocate a new matrix in R and create a new RMatrix to wrap it, with protection from the R garbage collector.

this
this(T m)

Allocate a new matrix in R and copy in the values of a GretlMatrix or DoubleMatrix if using the dmdgretl library for matrix algebra.

this
this(Robj rm, bool u = false)

Work with an Robj struct directly. This should only be used if you fully understand the internals of this library.

this
this(string name)

If embedding an R interpreter inside a D program, this function makes it more convenient to pull a matrix from R into D.

this
this(RVector v)

Create a reference to an RVector and access it as a matrix. In R, matrix and vector types are different.

Alias This

mat

Members

Functions

mat
GretlMatrix mat()

If using the dmdgretl library for matrix algebra, allocate a new matrix in R and copy the elements of the matrix into it.

opAssign
void opAssign(RMatrix m)
void opAssign(T m)

Copy the values of m into a new matrix.

opAssign
void opAssign(double val)

Set all values of a matrix equal to val.

opIndex
double opIndex(int r, int c)
opIndexAssign
void opIndexAssign(double v, int r, int c)

Standard matrix indexing is possible.

robj
Robj robj()

Get the underlying Robj that will be returned to R.

Meta