- if (is.null(x0$b) || all(x0$b == x0$β))
- x0$b = rep(0, K)
- else if (any(is.na(x0$b)))
- stop("x0$b cannot have missing values")
-
- op_res = constrOptim( linArgs(x0), .self$f, .self$grad_f,
- ui=cbind(
- rbind( rep(-1,K-1), diag(K-1) ),
- matrix(0, nrow=K, ncol=(d+1)*K) ),
- ci=c(-1,rep(0,K-1)) )
-
- # We get a first non-trivial estimation of W: getOmega(theta)^{-1}
- # TODO: loop, this redefine f, so that we can call constrOptim again...
- # Stopping condition? N iterations? Delta <= ε ?
+ if (is.null(θ0$b) || all(θ0$b == θ0$β))
+ θ0$b = rep(0, K)
+ else if (any(is.na(θ0$b)))
+ stop("θ0$b cannot have missing values")
+
+ # TODO: stopping condition? N iterations? Delta <= epsilon ?
+ for (loop in 1:10)
+ {
+ op_res = constrOptim( linArgs(θ0), .self$f, .self$grad_f,
+ ui=cbind(
+ rbind( rep(-1,K-1), diag(K-1) ),
+ matrix(0, nrow=K, ncol=(d+1)*K) ),
+ ci=c(-1,rep(0,K-1)) )
+
+ computeW(expArgs(op_res$par))
+ # debug:
+ #print(W)
+ print(op_res$value)
+ print(expArgs(op_res$par))
+ }