similar to: a question about optim.R and optim.c in R

Displaying 20 results from an estimated 6000 matches similar to: "a question about optim.R and optim.c in R"

2020 Oct 28
2
R optim() function
Hi R-Help, I am using R to do functional outlier detection (using PCA to reduce to 2 dimensions - the functional boxplot methodology used in the Rainbow package), and using Hscv.diag function to calculate the bandwidth matrix where this line of code is run: result <- optim(diag(Hstart), scv.mat.temp, method = "Nelder-Mead", control = list(trace = as.numeric(verbose))) Within the
2015 Sep 17
1
names treatment in optim()
Dear both, I have found that names are not treated in the same way in optim() depending on the optimization method (argument method). The example below shows the difference between the Brent method and the L-BFGS-B method. f <- function(x){ y <- x^2;names(y) <-"f(x)";y} optim(10, f, method="Brent", lower=-1, upper=10)$value optim(10, f, method="L-BFGS-B",
2003 Oct 31
1
Optimization of objective function with generic number of arguments (R-Extension with C code)
Hi All! I'm a new subscriber to this mailing list. I'm writing an R extension with C linked code having a minimization function letting me pass it an objective function with a GENERIC number of arguments and letting me to optimize over a specific one among them if there are many. ################################################# ############### IPOTETICAL MAIN ###############
2008 Nov 19
1
How to look within .Internal ?
In the optim() function there is a syntax : res <- .Internal(optim(par, fn1, gr1, method, con, lower, Here how can I see the inside-codes of ".Internal" function ? Regards, -- View this message in context: http://www.nabble.com/How-to-look-within-.Internal---tp20581897p20581897.html Sent from the R help mailing list archive at Nabble.com.
2003 Jan 17
1
Arguments of R- and C-side of internal functions
Dear R experts, I looked at the body of, say, `optim' function and found the call to the `.Internal', C optim function. It looks like this: .Internal(optim(par, fn1, gr1, method, con, lower, upper)) On the other hand, the C prototype of optim is: SEXP do_optim(SEXP call, SEXP op, SEXP args, SEXP rho); So, I guess that all the list of parameters passing in R are assigned to
2010 Oct 13
2
How to fix error in the package 'rgenoud'
Dear R user fellows, I would like to ask you about the package 'rgenoud' which is a genetic optimization tool. I ran the function 'genoud' with two variables to be minimized by the following command. result<-genoud(fn,nvars=2,starting.values=c(0.5,0), pop.size=1000, max.generations=10, wait.generations=3) Then, I had the following error message. Error in
2004 Jun 22
0
[LLVMdev] Linearscan allocator bug?
On Tue, 22 Jun 2004, Vladimir Prus wrote: > First, I attach two files -- LLVM asm and the asm for my target. The problem > with assembler is: on line 171 it uses register gr2, which is copied from gr6 > above, on line 161. The only predecessor of this basic block is jump on line > 90. The problem is that gr6 is not initialized in the interval from the > function entry till the
2011 May 19
3
problem with optim()
Dear R-users, I would like to maximize the function g above which depends on 4 parameters (2 vectors, 1 real number, and 1 matrix) using optim() and BFGS method. Here is my code: # fonction to maximize g=function(x) { x1 = x[1:ncol(X)] x2 = x[(ncol(X)+1)] x3 = matrix(x[(ncol(X)+2):(ncol(X)+1+ncol(X)*ncol(Y))],nrow=ncol(X),ncol=ncol(Y)) x4 = x[(ncol(X)+1+ncol(X)*ncol(Y)+1):length(x)]
2004 Jun 22
3
[LLVMdev] Linearscan allocator bug?
Folks, I'm running into something which looks like a bug in linearscan allocator. Of course I can't be 100% sure it's not some unobvious mistake on my part, so I'd like to hear your opinion. First, I attach two files -- LLVM asm and the asm for my target. The problem with assembler is: on line 171 it uses register gr2, which is copied from gr6 above, on line 161. The only
2004 Jun 23
3
[LLVMdev] Linearscan allocator bug?
Chris Lattner wrote: > On Tue, 22 Jun 2004, Vladimir Prus wrote: > > First, I attach two files -- LLVM asm and the asm for my target. The > > problem with assembler is: on line 171 it uses register gr2, which is > > copied from gr6 above, on line 161. The only predecessor of this basic > > block is jump on line 90. The problem is that gr6 is not initialized in > >
2013 Jan 01
1
Behavior or as.environment in function arguments/call (and force() behaviors...)
Happy 2013! Can someone with more knowledge of edge case scoping/eval rules explain what is happening below? Happens in all the versions of R I have on hand. Behavior itself is confusing, but ?as.environment also provides no clue. The term used in that doc is 'search list', which is ambiguous, but the see also section mentions search(), so I would *think* that is what is intended.
2008 Sep 02
2
two lattice graphs in one object
When I create a lattice/Trellis type graph, I typically write a function that returns the graph, as in do.graph <- function(x, y, ...) { require(lattice) return(xyplot(y~x, ...)) } My question today is this: If I want two graphs on one page, one way of achieving it is to print the objects into defined areas, as in gr1 <- xyplot(rnorm(111) ~ runif(111)) gr2 <-
2008 Aug 25
0
[LLVMdev] Proposal : Function Notes
On Aug 22, 2008, at 4:40 PM, Devang Patel wrote: > The LLVM passes are responsible to take appropriate actions based on > Function > Notes associated with function definition. For example, > > define void @fn1() notes("opt-size=1") { ... } > > The function fn1() is being optimized for size without losing > significant > performance. The inliner will
2011 Apr 07
1
An extention of outer() ?
Dear all, as per my understanding, outer() function is to facilitate 2-dimensional function evaluation, like to evaluate f(x,y) for different values of x and y. However I have slightly modified version of that, where x is a matrix with, say, 5 rows and 2 columns and y is a vector. Let take following example: fn1 <- function(x1, x2, y) return (x1+x2+y) x <- matrix(1:10, nc = 2) y
2013 Sep 21
1
[LLVMdev] LLD input graph handling proposal
Hi Joerg, I would love to have this behavior(solaris/hp-ux linkers used to do this). cat > main.c << \! int main() { fn(); fn1(); } ! cat > fn.c << \! int fn() { return 0; } ! cat > fn1.c << \! int fn1() { return 0; } ! gcc -c -fPIC main.c fn.c fn1.c ld -shared fn1.o -o libfn1.so ld -shared fn.o -o libfn.so -L. -lfn1 ld main.o libfn.so ld: warning:
2004 Nov 16
2
[LLVMdev] Target.td:Register changes
Hi, looking at the fresh CVS state I see: class Register<string n> : RegisterBase<n> { list<RegisterBase> Aliases = []; } while previously the Register class did not require any parameters. The change log is just: * Target.td: Revamp the Register class, and allow the use of the RegisterGroup class to specify aliases directly in register definitions. and I
2006 Jun 22
2
weights in lm, glm (PR#9023)
Full_Name: James Signorovitch Version: 2.2.1 OS: WinXP Submission from: (NULL) (134.174.182.203) In the code below, fn1() and fn2() fail with the messages given in the comments. Strangely, fn2() fails for all data sets I've tried except for those with 100 rows. The same errors occur if glm() is used in place of lm(), or if R 2.1.1 is used on a unix system. Thanks for looking into this.
2010 Jul 05
3
data.frame: adding a column that is based on ranges of values in another column
Dear List, I've been looking tirelessly for a solution to this dilemma but without success. Perhaps someone has an idea that will guide me in the right direction. Suppose I have the following data.frame: DF = data.frame(X = c(114.5508, 114.6468, 114.6596, 114.6957, 114.6828, 114.8903, 114.9519, 114.8842, 114.8579, 114.8489), Y = c(47.14094, 46.98874, 46.91235, 46.88265, 46.80584, 46.67022,
2008 Apr 11
2
system.time gives error when "=" is used for assignment (R-2.6.0)
Hello list, I found that system.time works correctly when I used "<-" to assign a value to a variable but when I happened to use "=" instead of "<-", R gave an error message: "Error in system.time(your argument here...)". It happened with a few functions I tried. Is this a bug or is there any circumstances that "=" cannot be used for
2011 May 09
2
Vectorizing a function: what does it mean?
Dear all, I would really appreciate if somebody can help me to understand what does the phrase "Vectorize your function" mean? And what is the job of Vectorize() function in doing that? I have read many threads where experts suggest to Vectorize the function, which will speed up entire calculation (and more elegant ofcourse.) I used to think that vectorizing function means, to create a