Displaying 20 results from an estimated 227 matches for "realsxp".
2019 Jul 23
3
Any plans for ALTREP lists (VECSXP)?
...| 543.3 MB virtual)
> system.time(y <- as.list(x))
user system elapsed
1.116 2.175 5.053
> system.time(z <- as.altrep(x))
user system elapsed
36.295 4.717 41.216
> .Internal(inspect(y))
@108255000 19 VECSXP g1c7 [MARK,NAM(7)] (len=34840, tl=0)
@7f9044d9fc00 14 REALSXP g1c7 [MARK] (len=1129, tl=0) 404.093,404.096,404.099,404.102,404.105,...
@7f9044d25e00 14 REALSXP g1c7 [MARK] (len=890, tl=0) 409.924,409.927,409.931,409.934,409.937,...
@7f9044da6000 14 REALSXP g1c7 [MARK] (len=1878, tl=0) 400.3,400.303,400.306,400.309,400.312,...
@7f9031a6b000 14 REALSXP g1...
2013 Jan 24
1
Copy on assignment and .Internal(inspect())
...g silly code:
f <- function() {
x = seq(10)
print(.Internal(inspect(x)))
for(i in seq(10)) {
x[i] <- x[i] + 1
print(.Internal(inspect(x)))
}
}
The output of f() was:
@bd7acf0 13 INTSXP g0c4 [NAM(1)] (len=10, tl=0) 1,2,3,4,5,...
[1] 1 2 3 4 5 6 7 8 9 10
@bdd6f80 14 REALSXP g0c6 [NAM(1)] (len=10, tl=0) 2,2,3,4,5,...
[1] 2 2 3 4 5 6 7 8 9 10
@ba66278 14 REALSXP g0c6 [NAM(1)] (len=10, tl=0) 2,3,3,4,5,...
[1] 2 3 3 4 5 6 7 8 9 10
@ba661e0 14 REALSXP g0c6 [NAM(1)] (len=10, tl=0) 2,3,4,4,5,...
[1] 2 3 4 4 5 6 7 8 9 10
@ba65ee8 14 REALSXP g0c6...
2019 Jul 23
3
Any plans for ALTREP lists (VECSXP)?
Hi Kylie,
Is it a list with only numerics in it? (I only see REALSXPs there, but
obviously inspect isn't showing all of them). If so, you could load it up
into one big vector and then also keep partitioning information around.
Bioconductor does this (see ?IRanges::CompressedList ). The potential
benefit here being that the underlying large vector could then be a...
2007 Apr 04
1
Accessing C++ code from R
...'
main.cpp:51: error: brace-enclosed initializer used to initialize
'R_NativePrimitiveArgType*'
Line 51 refers to the standard part to register the function in R:
R_CMethodDef cMethods[] = {
{"runSimulation", (void* (*) ()) &runSimulation, 27, {INTSXP,
INTSXP, INTSXP, REALSXP, REALSXP, REALSXP, INTSXP, INTSXP, INTSXP,
INTSXP, INTSXP, INTSXP, REALSXP, REALSXP, INTSXP, INTSXP, INTSXP,
INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, REALSXP,
REALSXP, REALSXP}},
{NULL, NULL, 0}
};
I had to add the explicit cast of &runSimulation to get rid of one
compiler er...
2019 Jul 24
1
[External] Re: Any plans for ALTREP lists (VECSXP)?
...not Dataptr
> not Dataptr_or_null
>
> 'altlist' specific methods:
>
> Elt
> Set_elt
>
> Best,
>
> luke
>
> On Tue, 23 Jul 2019, Gabriel Becker wrote:
>
> > Hi Kylie,
> >
> > Is it a list with only numerics in it? (I only see REALSXPs there, but
> > obviously inspect isn't showing all of them). If so, you could load it up
> > into one big vector and then also keep partitioning information around.
> > Bioconductor does this (see ?IRanges::CompressedList ). The potential
> > benefit here being that the...
2019 Jul 23
0
Any plans for ALTREP lists (VECSXP)?
...s.list(x))
> user system elapsed
> 1.116 2.175 5.053
>
> > system.time(z <- as.altrep(x))
> user system elapsed
> 36.295 4.717 41.216
>
> > .Internal(inspect(y))
> @108255000 19 VECSXP g1c7 [MARK,NAM(7)] (len=34840, tl=0)
> @7f9044d9fc00 14 REALSXP g1c7 [MARK] (len=1129, tl=0) 404.093,404.096,404.099,404.102,404.105,...
> @7f9044d25e00 14 REALSXP g1c7 [MARK] (len=890, tl=0) 409.924,409.927,409.931,409.934,409.937,...
> @7f9044da6000 14 REALSXP g1c7 [MARK] (len=1878, tl=0) 400.3,400.303,400.306,400.309,400.312,...
> @7f9031a6b00...
2013 Apr 01
2
Timing of SET_VECTOR_ELT
Assume a C program invoked by .Call, that returns a list.
Near the top of the program we allocate space for all the list elements. (It is my habit
to use "xyz2" for the name of the R object and "xyz" for the pointer to its contents.)
PROTECT(means2 = allocVector(REALSXP, nvar));
means = REAL(means2);
PROTECT(u2 = allocVector(REALSXP, nvar));
u = REAL(u2);
PROTECT(loglik2 = allocVector(REALSXP, 2));
loglik = REAL(loglik2);
PROTECT(rlist = mknamed(VECSXP, outnames));
Can I assign the individual elements into rlist using SET_VECTOR_ELT...
2012 Dec 15
3
interfacing with .Call
...R(coerceVector(getAttrib(A,R_DimSymbol), INTSXP))
SEXP Projector5(SEXP L, SEXP G, SEXP W, SEXP xymod, SEXP modif)
{
//* digest SEXPs from R *//
int *dimL, *dimG, *dimW, *dimxy, *dimif;
double *lptr, *gptr, *wptr, *ifptr;
int *xyptr;
dimL=getDim(L);
PROTECT(L=coerceVector(L, REALSXP));
lptr=REAL(L);
dimG=getDim(G);
PROTECT(G=coerceVector(G, REALSXP));
gptr=REAL(G);
dimW=getDim(W);
PROTECT(W=coerceVector(W, REALSXP));
wptr=REAL(W);
dimxy=getDim(xymod);
PROTECT(xymod=coerceVector(xymod, INTSXP));
xyptr=INTEGER(xymod);
dimif=getDim(modi...
2004 Nov 29
1
data is getting corrupted
...nt( plot_list, "aspect" );
plot_h20_sexp = get_list_element( plot_list, "whc" );
plot_map_sexp = get_list_element( plot_list, "map" );
PROTECT( plot_plot_sexp = coerceVector( plot_plot_sexp, INTSXP ) );
PROTECT( plot_lat_sexp = coerceVector( plot_lat_sexp, REALSXP ) );
PROTECT( plot_long_sexp = coerceVector( plot_long_sexp, REALSXP ) );
PROTECT( plot_elev_sexp = coerceVector( plot_elev_sexp, REALSXP ) );
PROTECT( plot_slp_sexp = coerceVector( plot_slp_sexp, REALSXP ) );
PROTECT( plot_asp_sexp = coerceVector( plot_asp_sexp, REALSXP ) );
PROTECT...
2019 Jul 24
0
[External] Re: Any plans for ALTREP lists (VECSXP)?
...th
'altvec' methods a class should provide:
Extract_subset
not Dataptr
not Dataptr_or_null
'altlist' specific methods:
Elt
Set_elt
Best,
luke
On Tue, 23 Jul 2019, Gabriel Becker wrote:
> Hi Kylie,
>
> Is it a list with only numerics in it? (I only see REALSXPs there, but
> obviously inspect isn't showing all of them). If so, you could load it up
> into one big vector and then also keep partitioning information around.
> Bioconductor does this (see ?IRanges::CompressedList ). The potential
> benefit here being that the underlying large ve...
2013 Apr 17
1
stack imbalance in max.col for non-real matrices
...array.c
===================================================================
--- array.c (revision 61606)
+++ array.c (working copy)
@@ -1614,7 +1614,10 @@
SEXP m = CAR(args);
int method = asInteger(CADR(args));
int nr = nrows(m), nc = ncols(m), nprot = 1;
- if (TYPEOF(m) != REALSXP) PROTECT(m = coerceVector(m, REALSXP));
+ if (TYPEOF(m) != REALSXP) {
+ PROTECT(m = coerceVector(m, REALSXP));
+ nprot++;
+ }
SEXP ans = allocVector(INTSXP, nr);
PROTECT(ans);
R_max_col(REAL(m), &nr, &nc, INTEGER(ans), &method);
Thanks,
Michael
[[altern...
2011 Oct 24
2
C function is wrong under Windows 7
...Len);
for (i = 0; i < fchrLen; ++i) {
*(pmiss + i) = tmp;
}
for (i = 0; i < signLen; ++i) {
*(pmiss + sign[i]-1) = 0;
}
}
SEXP getEs(SEXP fchr, SEXP sign)
{
int i, nfchr, nsign;
double *rfchr = REAL(fchr), *res;
int *rsign = INTEGER(sign);
PROTECT(fchr = coerceVector(fchr, REALSXP));
PROTECT(sign = coerceVector(sign, REALSXP));
nfchr = length(fchr);
nsign = length(sign);
SEXP es;
PROTECT(es = allocVector(REALSXP, nfchr));
res = REAL(es);
double nr = getNr(rfchr, rsign, nsign);
SEXP phit;
PROTECT(phit = allocVector(REALSXP, nfchr));
double *rphit;
rphit = REAL(...
2018 Dec 30
0
Bug report with patch: `stats:::regularize.values()` always creates full copies of `x` and `y`
...ble code:
x <- seq(1, 100, 1)
y <- seq(1, 100, 1)
reg_xy <- stats:::regularize.values(x, y, mean)
# Regularized versions of `x` and `y` are identical to input but are stored
at
# different places
identical(x, reg_xy[["x"]])
#> [1] TRUE
.Internal(inspect(x))
#> @15719b0 14 REALSXP g0c7 [NAM(3)] (len=100, tl=0) 1,2,3,4,5,...
.Internal(inspect(reg_xy[["x"]]))
#> @2b84130 14 REALSXP g0c7 [NAM(3)] (len=100, tl=0) 1,2,3,4,5,...
identical(y, reg_xy[["y"]])
#> [1] TRUE
.Internal(inspect(y))
#> @2c91be0 14 REALSXP g0c7 [NAM(3)] (len=100, tl=0) 1,2,3,4,5...
2019 Jan 04
0
Bug report with patch: `stats:::regularize.values()` always creates full copies of `x` and `y`
...ble code:
x <- seq(1, 100, 1)
y <- seq(1, 100, 1)
reg_xy <- stats:::regularize.values(x, y, mean)
# Regularized versions of `x` and `y` are identical to input but are stored
at
# different places
identical(x, reg_xy[["x"]])
#> [1] TRUE
.Internal(inspect(x))
#> @15719b0 14 REALSXP g0c7 [NAM(3)] (len=100, tl=0) 1,2,3,4,5,...
.Internal(inspect(reg_xy[["x"]]))
#> @2b84130 14 REALSXP g0c7 [NAM(3)] (len=100, tl=0) 1,2,3,4,5,...
identical(y, reg_xy[["y"]])
#> [1] TRUE
.Internal(inspect(y))
#> @2c91be0 14 REALSXP g0c7 [NAM(3)] (len=100, tl=0) 1,2,3,4,5...
2006 Nov 01
1
Subsetting a vector in C
I have a pretty simple question. I have an array of REALSXP allocated as:
rsp = allocVector(REALSXP,n)
and I simply want to pass subsets of rsp of size q (q<<n), for example, to an
R function in C. Is there a way to subset rsp without creating a new REALSXP
vector and copying the values for subsetting into it and then passing it to
the function?...
2010 Sep 10
2
[xts, quantmod] segfault probelm when I work with memcpy function
...ray (from C
code) from x[0] to x[nrow(x)-1] where x is the pointer do AAPL.
I have to test functions - one based on memcpy and second based on for loop:
#include <R.h>
#include <Rinternals.h>
SEXP open(SEXP x) {
int nr=nrows(x);
SEXP r;
PROTECT(r=allocVector(REALSXP,nr));
memcpy(&REAL(r)[0],&REAL(x)[0],nr*sizeof(double));
UNPROTECT(1);
return(r);
}
SEXP open2(SEXP x) {
int P=0;
if (TYPEOF(x) != REALSXP) { PROTECT(x = coerceVector(x,REALSXP)); P++; }
double *d_x = REAL(x);
int nr = nrows(x);...
2011 Jan 17
1
isoreg memory leak?
...to make a copy of iKnots.
SEXP R_isoreg(SEXP y)
{
int n = LENGTH(y), i, ip, known, n_ip;
double tmp, slope;
SEXP yc, yf, iKnots, ans;
const char *anms[] = {"y", "yc", "yf", "iKnots", ""};
/* unneeded: y = coerceVector(y, REALSXP); */
PROTECT(ans = mkNamed(VECSXP, anms));
SET_VECTOR_ELT(ans, 0, y = y);
SET_VECTOR_ELT(ans, 1, yc = allocVector(REALSXP, n+1));
SET_VECTOR_ELT(ans, 2, yf = allocVector(REALSXP, n));
SET_VECTOR_ELT(ans, 3, iKnots= allocVector(INTSXP, n));
... calculation ...
SETLE...
2020 Sep 08
4
Operations with long altrep vectors cause segfaults on Windows
...> Fehler: kann Vektor der Gr??e 14.9 GB nicht allozieren
>> Sys.setenv(LANGUAGE="en")
>> y <- c(0L, -2e9:2e9)
> Error: cannot allocate vector of size 14.9 Gb
>> y <- -1e9:4e9
>> .Internal(inspect(y))
> @0x00000000195a6808 14 REALSXP g0c0 [REF(65535)] -1000000000 : -294967296 (compact)
>> .Machine$integer.max / 1e9
> [1] 2.147484
>> y <- -1e6:2.2e9
>> .Internal(inspect(y))
> @0x000000000a11a5d8 14 REALSXP g0c0 [REF(65535)] -1000000 : -2094967296 (compact)
>> y <- -1e...
2004 Nov 12
1
dyn.load problem
...ncorreto. (Incorrect Parameter)
My C code is (extracted form Writing R Extension):
#include <R.h>
#include <Rinternals.h>
SEXP convolve2(SEXP a, SEXP b)
{
R_len_t i, j, na, nb, nab;
double *xa, *xb, *xab;
SEXP ab;
PROTECT(a = coerceVector(a, REALSXP));
PROTECT(b = coerceVector(b, REALSXP));
na = length(a); nb = length(b); nab = na + nb - 1;
PROTECT(ab = allocVector(REALSXP, nab));
xa = REAL(a); xb = REAL(b);
xab = REAL(ab);
for(i = 0; i < nab; i++) xab[i] = 0.0;
for(i = 0; i < na; i++)...
2019 Jul 12
3
strange increase in the reference number
Hi,
I just found a strange increase in the reference number and I'm wondering
if there is any reason for it, here is the code.
> a=c(1,2,3)
> .Internal(inspect(a))
@0x000000001bf0b9b0 14 REALSXP g0c3 [NAM(1)] (len=3, tl=0) 1,2,3
> is.vector(a)
[1] TRUE
> .Internal(inspect(a))
@0x000000001bf0b9b0 14 REALSXP g0c3 [NAM(7)] (len=3, tl=0) 1,2,3
The variable *a* initially has one reference number, after calling
*is.vector* function, the reference number goes to 7, which I believe is
the h...