PageRenderTime 17ms CodeModel.GetById 10ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/src/R/examples/optim.R

http://github.com/beechung/Latent-Factor-Models
R | 26 lines | 14 code | 4 blank | 8 comment | 0 complexity | b68c8d3bf8ed5f50303c5e44203e2b8f MD5 | raw file
 1### Copyright (c) 2011, Yahoo! Inc.  All rights reserved.
 2### Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
 3### 
 4### Author: Bee-Chung Chen
 5
 6###
 7### Compile C code:
 8### R CMD SHLIB src/R/examples/optim.c -o lib/my_optim.so
 9###
10
11dyn.load("lib/my_optim.so");
12
13x = c( 0, 0, 0, 0);
14w = c(-1, 2, 3, 4);
15lower = c(1,1,1,1);
16upper = c(3,3,3,3);
17
18.C("min_sum_of_squares",
19	as.double(x),
20	as.double(w),
21	as.double(lower),
22	as.double(upper),
23	length(w),
24	as.integer(1),
25	as.integer(1)
26);