Skip to content
Prev 14398 / 63424 Next

Method dispatch S3/S4 through optimize()

I am far from an expert on S4 method dispatch, so at the risk of 
embarrassing
myself I will just indicate how the det() function is written in 
SparseM now
in the hope that someone else will see the source of the problem:

setGeneric("det")
setMethod("det","matrix",get("det", pos=NULL, mode= "function"))
setMethod("det","matrix.csr", function(x, ...) det(chol(x))^2)
setMethod("det","matrix.csr.chol", function(x, ...) x@det)

The Cholesky function  chol in SparseM  was recently extended slightly
to compute this determinant  as an additional component, so if the
argument is already of the matrix.csr.chol class det() just extracts 
this
component, otherwise it tries to do the cholesky, or defaults to the
base function.

I hope that this might expose some fly in the soup.


url:	www.econ.uiuc.edu/~roger        	Roger Koenker
email	rkoenker@uiuc.edu			Department of Economics
vox: 	217-333-4558				University of Illinois
fax:   	217-244-6678				Champaign, IL 61820
On Nov 18, 2004, at 3:34 PM, Roger Bivand wrote: