"rqc" <- function(X,y,R,r,tau=.5){ n <- nrow(X) p <- nrow(X) m <- nrow(R) u <- rep(1,n) a1 <- (1-tau)*u a2 <- rep(1,m) b <- t(X)%*%a1 f <- lpfnc(t(X),-y,t(R),-r,b,u,a1,a2) list(coef = -f$coef, it = f$it) } "lpfnc" <- function(A1,c1,A2,c2,b,u,x1,x2){ #This is a pure R implementation of the inequality constrained interior #point LP solver: This was constructed purely to prototype the development #of fortran versions and should not be taken very seriously for problems of any size. # NB. The if(any(is.infinite(q1))) is tacky and should be fixed in some better way. beta <- .9995 small <- 1e-8 maxit <- 50 s <- u-x1 n1 <- ncol(A1) n2 <- ncol(A2) y <- coef(lm(c1 ~ t(A1)-1)) r1 <- c1-t(A1)%*%y r2 <- c2-t(A2)%*%y z1 <- r1*(r1>0) + small w <- z1-r1 + small z2 <- rep(1,n2) gap <- t(z1)%*%x1 + t(z2)%*%x2 + t(w)%*%s it <- 0 while(gap>small & it