Uses subroutine nnls (FORTRAN) from Linpack
nnls(A, B, tol=sqrt(.Machine$double.eps), verbose=TRUE)nnls error messages.TRUE if an error occurred.Lawson C.L.and Hanson R.J. 1995. Solving Least Squares Problems. SIAM classics in applied mathematics, Philadelphia. (reprint of book)
ldei, which includes equalitiesA <- matrix(nr=2,nc=3,data=c(3,2,2,4,2,1))
B <- c(-4,3)
nnls(A,B)Run the code above in your browser using DataLab