nimbleRcall implementation of base::eigen

59 views
Skip to first unread message

Tom LaBone

unread,
Nov 29, 2020, 9:43:39 AM11/29/20
to nimble-users
I want to call the base::eigen function from nimble code using nimbleRcall. I am not sure how to do this, but I know that this will not work:

es <- nimbleRcall(list(x=double(2)),Rfun="eigen",returnType=list(values=double(1),vectors=double(2)))

Any suggestions on how to achieve success here?
 


Perry de Valpine

unread,
Nov 29, 2020, 1:04:46 PM11/29/20
to Tom LaBone, nimble-users
Hi Tom,

eigen() is a supported function in nimble programming, so you might be able to avoid use of nimbleRcall for this need.  Please see  Table 11.3 in the User Manual.

In general if you do need a nimbleRcall like this, there are a couple of considerations. It is common to need to write a wrapper function, i.e. a function you access via nimbleRcall that calls your actual function of interest with arguments and then return value rearranged as needed. For example, if you just need the eigenvectors, a wrapper function could pick those out and return them.  The bigger issue is the returnType declaration: nimble type declarations do not include an R list of type declarations as a nimble type.  I think you could use a nimbleList data structure for this purpose.  You would have to create a nimbleList type and then use that as the declared returnType.  But you would still need to write a wrapper, so that you could convert the list returned from base::eigen into a nimbleList object to return from your wrapper.  I hope that makes sense.

But again, here's hoping that nimble's native support for eigen gives you what you need.

-Perry


  



--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/f305ebda-aabf-4601-aed5-ce6a421754d3n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages