[R] Non-negative least squares for sparse matrix
Erik Wright
eswright at wisc.edu
Fri Jul 15 01:41:35 CEST 2011
Hello,
I am attempting to solve the least squares problem Ax = b in R, where A and b are known and x is unknown. It is simple to solve for x using one of a variety of methods outlined here:
http://cran.r-project.org/web/packages/Matrix/vignettes/Comparisons.pdf
As far as I can tell, none of these methods will solve for x when A, x, and b are constrained to be non-negative (x > 0). Other packages, such as nnls, can solve the non-negative least squares problem, but do not work with very large sparse matrices.
The matrix A that I am using is 750,000 by 46,000 elements with 99% zeros, and matrix b is a dense 750,000 by 1 matrix. Does an R function exist for solving the non-negative least squares problem with a sparse matrix?
Thanks!,
Erik
> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] nnls_1.3 Matrix_0.999375-50 MASS_7.3-12
[4] lattice_0.19-23
loaded via a namespace (and not attached):
[1] grid_2.13.0 tools_2.13.0
More information about the R-help
mailing list