Displaying 20 results from an estimated 10000 matches similar to: "C code called from R: reallocate arrays passed as arguments?"
2013 Mar 25
2
Faster way of summing values up based on expand.grid
Hello!
# I have 3 vectors of values:
values1<-rnorm(10)
values2<-rnorm(10)
values3<-rnorm(10)
# In real life, all 3 vectors have a length of 25
# I create all possible combinations of 4 based on 10 elements:
mycombos<-expand.grid(1:10,1:10,1:10,1:10)
dim(mycombos)
# Removing rows that contain pairs of identical values in any 2 of
these columns:
mycombos<-mycombos[!(mycombos$Var1
2024 Aug 16
1
allequal diff
? Fri, 16 Aug 2024 10:35:35 +0200
<sibylle.stoeckli at gmx.ch> ?????:
> what do you mean by use is.na() in getValues(). So I need to call
> getValues a second time?
Not necessarily, but it's one of the options. I was thinking along the
lines of:
values1 <- getValues(r1)
mask1 <- is.na(values1)
# Do the same for r2
# Combine the masks
all.equal(values1[!combined_mask],
2010 Dec 18
3
dotchart for matrix data
Readers,
I am trying to use the function dotchart. The data is:
> testdot
category values1 values2 values3 values4
1 a 10 27 56 709
2 b 4 46 47 208
3 c 5 17 18 109
4 d 6 50 49 308
The following error occurs
> dotchart(testdot,groups=testdot[,2])
Error in dotchart(testdot, labels =
2010 Aug 08
0
[LLVMdev] Usage of pointers to elements of a std::vector that might be reallocated
Right, later in the same file we have:
// Reserve entries in the vector for each of the SUnits we are creating. This
// ensure that reallocation of the vector won't happen, so SUnit*'s won't get
// invalidated.
// FIXME: Multiply by 2 because we may clone nodes during scheduling.
// This is a temporary workaround.
SUnits.reserve(NumNodes * 2);
So for some reason *2 is
2006 Nov 21
1
1.2beta1 speex_bits_pack realloc issue?
In bits.c\speex_bits_pack there is logic to reallocate the bits buffer.
In that section there is a call to speex_memset_bytes which appears to
wipe out all the old bytes. I found when I encoded a multi-frame message
that needed less than the default 2000 bytes for bits->chars, everything
worked fine. However, when I encoded a longer message that triggered the
realloc code in speex_bits_pack,
2005 Mar 10
2
Question regarding mosaicplot
I tried this :
> mosaicplot(stoc ~ q9r + segca,data=tmp2,color=T) : works fine.
And now, this :
> mosaicplot(stoc ~ q9r + segca, data=tmp2, color=T, main="Big title")
Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :
invalid variable type
I'm probably stupid and missed something simple in the manual (and wouldn't like to be
2006 Mar 06
1
Sort problem in merge()
Hello!
I am merging two datasets and I have encountered a problem with sort.
Can someone please point me to my error. Here is the example.
## I have dataframes, first one with factor and second one with factor
## and integer
> tmp1 <- data.frame(col1 = factor(c("A", "A", "C", "C", "0", "0")))
> tmp2 <- data.frame(col1 =
2017 Oct 30
1
An iterative function
Dear all,
The function f() below is a function of m1 and m2, both of which are
matrices with 3 rows. The function works sequentially one row after
another.
So altogether there are three stages. I am trying to update the coding to
write a generic function that will work for arbitrary k stages.
I am hoping to get some suggestion and help. Thanks so much!
Hanna
##x, y are two
2007 Jan 17
1
tapply, data.frame problem
Hi R-users,
I'm quite new to R and trying to learn the basics. I have a following
problem concerning the convertion of array object into data frame. I have
made following data sets
tmp1 <- rnorm(100)
tmp2 <- gl(10,2,length=100)
tmp3 <- as.data.frame(cbind(tmp1,tmp2))
tmp3.sum <- tapply(tmp3$tmp1,tmp3$tmp2,sum)
tmp3.sum <- as.data.frame(tapply(tmp1,tmp2,sum))
and I want the
2003 Mar 04
3
question on latticeParseFormula (PR#2602)
This feels like inconsistent behavior. latticeParseFormula works the
way I anticipated for factor, but not for ordered. I want the
behavior I see with tmp2, but not with tmp. My next step is to use
the right.name to isolate the tmp2[,c("a","b")] columns.
tmp <- data.frame(y=(1:12)+.1,
a=factor(rep(1:3,4)),
b=ordered(rep(1:4,
2015 Jun 30
3
[LLVMdev] readonly and infinite loops
----- Original Message -----
> From: "Nuno Lopes" <nunoplopes at sapo.pt>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>, "Sanjoy Das" <sanjoy at playingwithpointers.com>, "Jeremy
> Lakeman" <Jeremy.Lakeman at gmail.com>, nlewycky at google.com
>
2009 Oct 23
1
Confusion regarding allocating Matrices.
Hi
I'm having slight confusion.
I plan to grow/realloc a matrix depending on the data available in a C
program.
Here is what I'm tried to do:
Data=allocMatrix(REALSXP,3,4);
SEXP Data;
REAL(Data)[8]=0.001123;
REAL(Data)[200000]=0.001125;
printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[200000]);
Here is my confusion:
Do I always require to allocate the exact number of data
2010 Sep 20
5
Sorting and subsetting
Suppose I have a data frame, such as the one below:
tmp <- data.frame(index = gl(2,20), foo = rnorm(40))
And further assume it is sorted by index and then by the variable foo.
tmp <- tmp[order(tmp$index, tmp$foo) , ]
Now, I want to grab the first N rows of tmp for each index. In the end, what I want is the data frame 'result'
tmp1 <- subset(tmp, index == 1)
tmp2 <-
2008 Jan 04
0
[LLVMdev] Extraction of Arguments Passed to a Function
Hi,
I am trying to extract the name of the variables passed as an Argument to a
Function. I am using a runOnFunction Pass.
For example in the following IR respresentation,
define void @foo(i32 %limit) {
entry:
--
--
}
I should be able to walk the IR and get '%limit' as the external variable
passed to the function.
Another question, Is it possible to create a basic symbol table (
2010 Sep 10
1
[LLVMdev] Missing Optimization Opportunities
Hi,
I'm using LLVM 2.7 right now, and I found "opt -std-compile-opts" has
missed some opportunities for optimization:
define void @spa.main() readonly {
entry:
%tmp = load i32* @dst-ip ; <i32> [#uses=3]
%tmp1 = and i32 %tmp, -16777216 ; <i32> [#uses=1]
%tmp2 = icmp eq i32 %tmp1, 167772160 ; <i1> [#uses=2]
2019 Sep 13
1
[PATCH nbdkit] common/bitmap: Don't fail on realloc (ptr, 0)
The following commands:
nbdkit -fv --filter=cow memory size=512 --run 'qemu-img info $nbd'
nbdkit -fv --filter=cache memory size=512 --run 'qemu-img info $nbd'
both fail with:
nbdkit: memory[1]: error: realloc: Success
Initial git bisect pointed to commit 3166d2bcbfd2 (but I don't believe
that commit is the real cause, it merely exposes the bug).
The reason this
2013 May 30
3
[LLVMdev] Expected behavior of calling bitcasted functions?
Hi,
I'm not sure what the expected behavior of calling a bitcasted function is. Suppose you have a case like this (which you get on the source level from attribute alias):
@alias_f32 = alias bitcast (i32 (i32)* @func_i32 to float (float)*)
define internal i32 @func_i32(i32 %v) noinline nounwind {
entry:
ret i32 %v
}
define void @bitcast_alias_scalar(float* noalias %source, float* noalias
2007 Nov 23
1
[LLVMdev] Will any pass change simple return branch into select/return pair?
Hi,
Can any llvm pass change simple return branch into select/return pair?
For example:
define i10 @mod_N(i10 zeroext %a) zeroext {
entry:
%tmp2 = icmp ugt i10 %a, -400 ; <i1> [#uses=1]
br i1 %tmp2, label %cond_true, label %return
cond_true: ; preds = %entry
%tmp5 = add i10 %a, 400 ; <i10> [#uses=1]
ret i10 %tmp5
return: ; preds = %entry
ret
2009 Nov 09
1
zoo: bug with unique for yearmon
I'm using R 2.10.0, with zoo 1.5-8. The release notes for zoo 1.5-8
claim a bug with unique for yearmon objects has been fixed, but I'm
still having problems.
Browse[1]> tmp2
[1] "Dec 1996" "Dec 1996"
Browse[1]> unique(tmp2)
[1] "Dec 1996" "Dec 1996"
Browse[1]> unique(unique(tmp2))
[1] "Dec 1996"
Browse[1]> as.numeric(tmp2) -
2005 Jul 08
2
Sweave resource leak: leftover temp files (PR#7999)
This is great. Thank you for your help, but let me make sure I fully
understand. Here is the looping file I use to subset the data frame,
create a tex file, and Sweave it. This results in N number of tex files
where N is equal to the number of rows in the data frame.
list <- unique(wide$stuid)
master = "master.tex"
for (i in list){
tmp1 <- subset(wide, stuid==i)
tmp2