Displaying 12 results from an estimated 12 matches for "get_slot".
Did you mean:
set_slot
2005 Aug 17
4
accesing slots of S4 class in C code
...quot;numeric"))
x <- new("pd", data=1:5)
test <- function(pd.obj) {
res <- .C("TestFun", pd.obj)
res}
test(x)
(Of couse I load the DLL as well.)
The corresponding C file has:
SEXP TestFun(SEXP pd_obj)
{
SEXP t=R_NilValue;
PROTECT(t = GET_SLOT(pd_obj, install("data")));
UNPROTECT(1);
return(t);
}
What I hope to get as a result is the (1:5) vector.
In the long term, the vector will be a multi-dimensional array and I
will want to do calculations using its contents in the C program.
Thanks for any help,
Aniko...
2004 Apr 26
1
Segfault: .Call and classes with logical slots
...ogical slot
segfaults under R-1.9.0 when `gctorture(on = TRUE)' is used:
Code code (dummy.c):
#include <Rdefines.h>
SEXP foo() {
SEXP ans;
PROTECT(ans = NEW_OBJECT(MAKE_CLASS("test")));
SET_SLOT(ans, install("lgl"), allocVector(LGLSXP, 1));
LOGICAL(GET_SLOT(ans, install("lgl")))[0] = TRUE;
UNPROTECT(1);
return(ans);
}
R code (dummy.R):
dyn.load("dummy.so")
setClass("test", representation = representation(lgl = "logical"))
a = .Call("foo")
a # OK
gctorture(on = TRUE)
a = .Call("foo&quo...
2005 Sep 13
3
NUMERIC_POINTER question
Dear R-developers,
Using .Call I pass a S4 class with e.g. the following class definition:
setClass("mmatrix",representation(
data="matrix")
)
On the "C side" i do
mat = GET_SLOT(vs,install("data"));
and then:
printf("%f\n",NUMERIC_POINTER(mat)[1]);
The above print statement produces the correct output if
xx<- new("mmatrix")
xx at data<-matrix(1:12+0.1,3,4). (data is double)
However it prints
0.0000
if xx at data are integers ( xx a...
2008 Mar 15
1
Experimental R_has_slot() utility
...Experimental R_has_slot() utility supplementing R_do_slot()")
appears to be missing from a fresh checkout of the development branch.
$ svn up
At revision 44759.
$ grep -i has_slot `find include -name '*.h'`
$ grep -i _slot `find include -name '*.h'`
include/Rdefines.h:#define GET_SLOT(x, what) R_do_slot(x, what)
include/Rdefines.h:#define SET_SLOT(x, what, value)
R_do_slot_assign(x, what, value)
include/Rinternals.h:SEXP R_do_slot(SEXP obj, SEXP name);
include/Rinternals.h:SEXP R_do_slot_assign(SEXP obj, SEXP name, SEXP value);
..or did I miss it ?
Thanks,
L.
2006 Jan 13
0
AJAX and select form help
...here. I''ve got a select box on the _form.rhtml
(for ''new'') like so:
<%= select(:schedule, :start_date, @dates) %>
When that date changes, I need it to pass the selected value to the get_dates
controller function (of the Schedule class), that looks like so:
def get_slots(date)
@slots = Schedule.get_available_slots(date)
end
Then I need another select box updated on the same (_form.rhtml) page:
<div id="slots">
<%= select(:schedule, :slot_number, @slots) %>
</div>
This can be in a partial if necessary.
How do I do this with w...
2004 Mar 06
2
.Call: is new attribute of protected object auto-protected
Hi,
I have an SEXP obj in a C function called via .Call(). The obj is
protected (in fact it is an argument to .Call and therefore
automatically protected). If I set an attribute of obj does the
attribute become protected too? Here is an example
SEXP foo(SEXP obj) {
SET_NAMES(obj, NEW_CHARACTER(3)); /* are names protected or not? */
...
}
Thanks,
Vadim
[[alternative HTML version
2009 Sep 29
3
How do I access class slots from C?
Hi
I'm trying to implement something similar to the following R snippet using
C. I seem to have hit the wall on accessing class slots using C.
library(fPortfolio)
lppData <- 100 * LPP2005.RET[, 1:6]
ewSpec <- portfolioSpec()
nAssets <- ncol(lppData)
setWeights(ewSpec) <- rep(1/nAssets, times = nAssets)
ewPortfolio <- feasiblePortfolio(
data = lppData,
spec = ewSpec,
2010 Feb 18
3
R CMD check: OK in LINUX. Crashes in Windows!
Hi,
I have followed the recommended steps for creating a package (rctest). As of
now, my goal is simply to understand how various pieces fit together. The
package includes:
(1) C code with source in sub-directories, compiled to create a static
library.
(a) There is a single C-struct (dns) a simple 'matrix': {int m; int n;
double *d;}
(b) C code to create random matrix of a certain size.
2017 May 07
6
[RFC v2 0/6] PMU engine counters
...ting dynamic reclocking. As a side
effect it shows us a coarse load of several engines, allthough the counters can
only report "idle" or "non-idle".
Karol Herbst (6):
pmu/fuc: add macros for pdaemon pwr counters
pmu/fuc: read out counters and store them
pmu/fuc: implement GET_SLOTS
pmu/fuc: implement SET_SLOT
nouveau/debugfs: add interface for current load
pmu: setup counters
drm/nouveau/include/nvif/device.h | 1 +
drm/nouveau/include/nvkm/subdev/pmu.h | 10 +
drm/nouveau/nouveau_debugfs.c | 23 +
drm/nouveau/nvkm/subdev/pmu/base...
2017 Jun 05
7
[PATCH v3 0/7] PMU engine counters
...ynamic reclocking on GT215 and
newer. On pre GT215 GPUs there is also PCOUNTERS, but this is ugly so that I
only focus on dynamic reclocking starting with GT215 for now.
Karol Herbst (7):
pmu/fuc: add macros for pmu engine counters
pmu/fuc: read out counters and store them
pmu/fuc: implement GET_SLOTS
pmu/fuc: implement SET_SLOT
pmu: add counter_slots field
pmu: setup counters
nouveau/debugfs: add interface for current load
drm/nouveau/include/nvif/device.h | 1 +
drm/nouveau/include/nvkm/subdev/pmu.h | 17 +
drm/nouveau/nouveau_debugfs.c | 27 +
d...
2011 Aug 12
11
[net-next RFC PATCH 0/7] multiqueue support for tun/tap
As multi-queue nics were commonly used for high-end servers,
current single queue based tap can not satisfy the
requirement of scaling guest network performance as the
numbers of vcpus increase. So the following series
implements multiple queue support in tun/tap.
In order to take advantages of this, a multi-queue capable
driver and qemu were also needed. I just rebase the latest
version of
2011 Aug 12
11
[net-next RFC PATCH 0/7] multiqueue support for tun/tap
As multi-queue nics were commonly used for high-end servers,
current single queue based tap can not satisfy the
requirement of scaling guest network performance as the
numbers of vcpus increase. So the following series
implements multiple queue support in tun/tap.
In order to take advantages of this, a multi-queue capable
driver and qemu were also needed. I just rebase the latest
version of