I'm testing some modifications in arima.c. I've noticed that a big internal array of double (rbar) is usually sparse and I'd like to add an option to store it as key-value mapping. Is there a library function or some other approach already used inside the R core for key-value mappings? Thanks, Matteo Bertini
On Dec 30, 2010, at 7:50 AM, Matteo Bertini wrote:> I'm testing some modifications in arima.c. > I've noticed that a big internal array of double (rbar) is usually sparse and I'd like to add an option to store it as key-value mapping. > > Is there a library function or some other approach already used inside the R core for key-value mappings? >environment created with hash=TRUE, e.g.: e = new.env(TRUE, emptyenv()) e[["foo"]] = "bar" You can even set "size" with the expected size if you know it in advance. Cheers, Simon
Why not use a sparse Matrix package? Hadley On Thu, Dec 30, 2010 at 6:50 AM, Matteo Bertini <matteo at naufraghi.net> wrote:> I'm testing some modifications in arima.c. > I've noticed that a big internal array of double (rbar) is usually sparse > and I'd like to add an option to store it as key-value mapping. > > Is there a library function or some other approach already used inside the R > core for key-value mappings? > > Thanks, > Matteo Bertini > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/