Displaying 20 results from an estimated 400 matches similar to: "alas, no vecnorm"
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")
2010 Jun 15
1
Error when callin g C-Code
Hi
when I call the function below in R, i get the error: Object 'pairlist'
can't be converted to 'double'.
#include <R.h>
#include <Rdefines.h>
#include <Rmath.h>
SEXP CSimPoisson(SEXP lambda, SEXP tgrid, SEXP T2M, SEXP Ni, SEXP NT)
{
double sign, EVar;
double *xlambda, *xtgrid, *xT2M, *xNi, *xNT, *xtau;
SEXP tau;
int ltgrid =0;
int i = 0;
int j = 0;
2004 Jun 30
1
AS_NUMERIC and as.numeric - Could someone explain?
Dear List,
I stepped into a strange effect which I can't explain to myself
(probably due to lack of knowledge on R internals).
I have four vectors a,b,c and z of size 10000 each. With these vectors I
call
.Call("hyp2f1forrey", a, b, b, z, PACKAGE = "hyp2f1")
to access
SEXP hyp2f1forrey(SEXP a, SEXP b, SEXP c, SEXP x)
{
int i,n;
double *xa, *xb, *xc, *xx,
2004 Feb 11
1
.Call setAttrib(ans,R_DimSymbol,dim); Crashes.
Hi!
I want to return a matrix.
The code does the R interfacing.
This version does it fine.
SEXP ans,dim;
PROTECT(ans = NEW_NUMERIC(count*2));
memcpy(NUMERIC_POINTER(ans),result,count*sizeof(double));
memcpy(&(NUMERIC_POINTER(ans)[count]),occur,count*sizeof(double));
/** PROTECT(dim=NEW_INTEGER(2));
INTEGER_POINTER(dim)[0]=2;
INTEGER_POINTER(dim)[1]=count;
1998 Oct 16
1
Compiling on a Red Hat 5.1 system
I'm feeling kinda stupid right now, but I'm actually having problems
compiling R-0.62.3 on a Red Hat 5.1 Linux system.
I'd be happy if someone could point out for me where to look to fix the
problem. I've included the output from the compiling below. Thanks for
any help.
Fredrik
make -f Makefile.2nd all
make[1]: Entering directory `/home/fredrigl/R-0.62.3'
Building R
cd
2013 Apr 01
2
Is DUD available in nls()?
SAS has DUD (Does not Use Derivatives)/Secant Method for nonlinear
regression, does R offer this option for nonlinear regression?
I have read the helpfile for nls() and could not find such option, any
suggestion?
Thanks,
Derek
[[alternative HTML version deleted]]
2010 Jun 18
3
C interface
Greetings,
I am trying to call simple C-code from R.
I am on Windows XP with RTools installed.
The C-function is
#include <R.h>
#include <Rinternals.h>
#include <Rmath.h>
#include <Rdefines.h>
// prevent name mangling
extern "C" {
SEXP __cdecl test(SEXP s){
SEXP result;
PROTECT(result = NEW_NUMERIC(1));
double* ptr=NUMERIC_POINTER(result);
double t =
2010 Jun 18
4
C Interface
Greetings,
I am trying to call simple C-code from R.
I am on Windows XP with RTools installed.
The C-function is
#include <R.h>
#include <Rinternals.h>
#include <Rmath.h>
#include <Rdefines.h>
// prevent name mangling
extern "C" {
SEXP __cdecl test(SEXP s){
SEXP result;
PROTECT(result = NEW_NUMERIC(1));
double* ptr=NUMERIC_POINTER(result);
double t =
2012 Dec 10
1
Changing arguments inside .Call. Wise to encourage "const" on all arguments?
I'm continuing my work on finding speedups in generalized inverse
calculations in some simulations. It leads me back to .C and .Call,
and some questions I've never been able to answer for myself. It may
be I can push some calculations to LAPACK in or C BLAS, that's why I
realized again I don't understand the call by reference or value
semantics of .Call
Why aren't users of
2007 Jun 06
3
C function with unknown output length
Hi all,
Could anyone point me to one or more examples in the R sources of a C
function that is called without knowing in advance what will be the
length (say) of the output vector?
To make myself clearer, we have a C function that computes
probabilities until their sum gets "close enough" to 1. Hence, the
number of probabilities is not known in advance.
I would like to have an
2000 Jul 12
1
Compiling R on RS6000 AIX 4.3
Hi,
I've been searching through the R help archives and came across only one AIX
compilation question in March, which received no public responses. I'm
currently having the same problems with the "Illegal instruction" and core
dump of running R 1.0.1 on AIX 4.3.
Firstly, the R distribution was missing some FORTRAN routines, which I found
on the net and added, by modifying
2000 Jul 12
1
Compiling R on RS6000 AIX 4.3
Hi,
I've been searching through the R help archives and came across only one AIX
compilation question in March, which received no public responses. I'm
currently having the same problems with the "Illegal instruction" and core
dump of running R 1.0.1 on AIX 4.3.
Firstly, the R distribution was missing some FORTRAN routines, which I found
on the net and added, by modifying
2014 Sep 07
1
lbfgsb from C/C++
Hi,
I would like to call R's lbfgsb function from my C/C++ code by including
R_ext/Applic.h and linking against libR.
Currently, I am allocating memory for x (and the other input arrays for
lbfgsb) in my C/C++ code via malloc/new. However, this gives a segmentation
fault when executing the program.
I tried to allocate x via PROTECT(x = NEW_NUMERIC(n)); x_p =
NUMERIC_POINTER(x);.
This compiles
2008 Jun 03
1
IBM-AIX 5.2 (GCC 4.2.4 installed) - Error while executing 'make'
Hi,
The following error occurs while executing 'make' after the successful
configuration (./configure) on IBM-AIX 5.2 (GCC 4.2.4 installed):
gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2
-I../../src/extra/pcre -I. -I../../src/include -I../../src/include
-I/usr/local/include -DHAVE_CONFIG_H -mno-fp-in-toc -g -O2 -c vfonts.c -o
vfonts.o
gfortran -g
2009 Jul 20
3
S_alloc or Calloc for return value
I am trying to write a C function to create a vector of integers that can be
used by the R calling function. I do not know the size of the vector in the
R calling function. (Well, actually, I have an upper limit on the size, but
that is so large that R cannot allocate it. What I'm doing in the function
is to do a sieving procedure, and the result will be small enough to fit
into my
Importing a SAS file to R: Alas, STILL more problems--has anyone gotten this message before, and why
2004 Feb 09
1
Importing a SAS file to R: Alas, STILL more problems--has anyone gotten this message before, and why
Sorry to write twice in one day--I am a relative newbie to some of these
parts of R, and I am pulling my hair out! B/c I am preparing a file to
use WINBUGS I am cross-posting to the BUGS group as well, in case anyone
there has some ideas on this.
I've got a large SAS dataset that I want to put in R form to more easily
use the file with the hierarchical modeling software WINBUGS. It has
2000 Apr 28
3
Matrix inverse
I haven't found a function that directly calculates the matrix inverse, does it exist? Otherwise what would be the fastest way to do it?
Patrik Waldmann
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the
2005 Aug 15
4
return unique values from date/time class object
Background:
OS: Linux Mandrake 10.1
release: R 2.0.0
editor: GNU Emacs 21.3.2
front-end: ESS 5.2.3
---------------------------------
Colleagues
I have a wind speed time series with a normal frequency distribution and a
spike in the 5 metres/second bin. The most likely explanation is that the
instrument was returning duplicate values at this speed. To check this, I
want to extract all the unique
2004 Jan 09
1
Call and memory
I use a large real matrix, X, in C code that is passed from R and
transposed in place in the C code. I would like to conserve memory and,
if possible, allocate space for only one copy of X -- hence I would like
to pass a pointer to the data in the X object to the C code.
The Writing R Extensions manual says that neither .Call nor .External
copy their arguments. They also say that these
2000 May 15
1
pythag missing in src/appl/ROUTINES (PR#544)
Full_Name: Roger Bivand
Version: 1.0.1
OS: Linux RH 6.1
Submission from: (NULL) (158.37.102.52)
I am trying to use pythag() from src/appl in a .Call() function.
pythag seems to be missing from the ROUTINES list in appl - putting
it in solved the problem:
> x <- 1
> y <- 1
> sqrt(x^2 + y^2)
[1] 1.414214
> dyn.load("pythagtry.so")
Error in dyn.load(x,