Hi, I am writing C code for R, but in middle of the routine I want to call solve(A,b) function. What is the right way to solve linear set inside C code? Is it ok to just invoke La_solve()?
On May 8, 2013, at 2:24 PM, Matwey V. Kornilov wrote:> Hi, > > I am writing C code for R, but in middle of the routine I want to call solve(A,b) function. What is the right way to solve linear set inside C code? Is it ok to just invoke La_solve()? >There is no such thing as La_solve(). You can use dgesv from LAPACK, though. However, the subject poses a different question -- you can call R function from C code by using eval(). Cheers, Simon
> From: "Matwey V. Kornilov" <matwey.kornilov at gmail.com> > > the following seems to work just great for me: > > PROTECT(sx = eval(lang3(install("solve"),sA,sb),R_BaseEnv))You need to PROTECT the result of lang3 before calling eval. And on the other hand, you don't necessarily have to protect the result of eval (only if you will be doing further allocations while still using sx). Radford Neal
Seemingly Similar Threads
- Re: terminating on signal 15 from pid 2146 (/usr/sbin/libvirtd)
- Re: terminating on signal 15 from pid 2146 (/usr/sbin/libvirtd)
- Re: terminating on signal 15 from pid 2146 (/usr/sbin/libvirtd)
- terminating on signal 15 from pid 2146 (/usr/sbin/libvirtd)
- How do I access class slots from C?