Published on *OpenMx* (http://openmx.psyc.virginia.edu)

By *mspiegel*

Created *08/05/2009 - 18:07*

Wed, 08/05/2009 - 18:07 — mspiegel [1]

Posted on behalf of Paras:

Hi,

I am hoping that the c gurus can help me understand how OpenMx matrices

are stored, updated and passed around.

Here is the situation:

We are trying design data-structures for the block-sparse BLAS routines

and are struggling with the issue of ownership of "double" matrices. Our

key data-structure is called the "blockSparseMatrix". For example, there

may be a huge "factor-loading" matrix where each dense sub-block would

map on to one or more OpenMx parameter matrices. In the ordinary

factor-model, each dense sub-block would point to the single

factor-loading matrix. Alternatively in the growth-curve case with

definition variables, each dense-block would point to person specific

factor-loading matrix.

The struct blockSparseMatrix has a field **dns or a "pointer to an array

of doubles representing the dense matrix". From a memory and efficiency

perspective, it makes sense for OpenMx to create, update and destroy the

memory for dense-matrices. Pointer to the dense matrix would be passed

to the backend at the beginning and would be retained throughout the

estimation process as a member of the blockSparseMatrix structure.

>From an OO perspective, having the main application write directly to a

struct-member seems to be problematic. However, I see no alternative to

doing so -- without copying huge amounts of data at each iteration.

>From OpenMx's design perspective and how you envision development of

other plug-ins, what approach would you recommend?

How does OpenMx deal with R? If I understand correctly, R insists that

all data be "copied" between R and external-packages, unless the access

is read-only. Is this what happens at each iteration?

**Links:**

[1] http://openmx.psyc.virginia.edu/users/mspiegel

[2] http://openmx.psyc.virginia.edu/thread/103

[3] http://openmx.psyc.virginia.edu/thread/45-schedule-categorical-outcome-estimation

[4] http://openmx.psyc.virginia.edu/forums/openmx-developer-forums/optimizers