Dear r-devel,
I am mutating rpart to do calculations on trees.
I am trying to extract information from the tree.
However, I got a seg. fault.
This is the offending line in "rpmatrix.c":
deltaI[0][0] = spl->improve;
(Commenting it out cures the seg fault)
I would like some advice on how to debug this. I have allocated memory
with calloc and deltaI[0][0] should be OK, but apparently not.
thanks for your help,
For those that don't have structure of rpart drilled into their brain:
deltaI is declared in "rpmatrix.c":
void rpmatrix(struct node *me, Sint *nodecount, Sint *splitcount,
Sint *catcount, Sint *numcat, double **dsplit,
Sint **isplit, Sint **csplit, double **dnode,
Sint **inode, double **deltaI, int id)
rpmatrix is called by "s_to_rp.c" where
ddeltaI is a pointer from an ALLOC call:
void s_to_rp2(Sint *n, Sint *nsplit, Sint *nnode, Sint *ncat,
Sint *numcat, Sint *maxcat, Sint *xvals, Sint *which,
double *cptable, double *dsplit, Sint *isplit, Sint *csplit,
double *dnode, double *deltaI, Sint *inode)
double **ddeltaI; /* declaration of ddeltaI */
ddeltaI = (double **) ALLOC(rp.num_y * rp.num_resp, sizeof(double ));
rpmatrix(tree, nnode, nsplit, ncat, numcat,
ddsplit, iisplit, ccsplit, ddnode, iinode,ddeltaI ,1);
s_to_rp2 is called rpart.s
rp <- .C("s_to_rp2",
as.integer(nobs),
as.integer(nsplit),
as.integer(nodes),
as.integer(ncat),
as.integer(cats *!isord),
as.integer(max(cats)),
as.integer(xval),
which = integer(nobs),
cptable = matrix(double(numcp*cpcol), nrow=cpcol),
dsplit = matrix(double(1), nsplit,3),
isplit = matrix(integer(1), nsplit,3),
csplit = catmat,
dnode = matrix(double(1), nodes, 3+numresp),
deltaI = matrix(double(1), nodes, nsplit),
inode = matrix(integer(1), nodes, 6))
--
Clayton Springer, Ph. D.
Sandia National Laboratories csprin@ca.sandia.gov
Biosystems Research Department (925) 294-2143
P.O. Box 969, MS 9951 fax: (925) 294-3020
Livermore, CA, 94551-0969
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._