R/fHI.R

Defines functions fHI

fHI <- function(w) {

  ### input
  # w         : weight vector
  #
  ### output
  # objective : Herfindahl index
  # gradient  : the gradient of the objective with respect to w

  # objective value
  obj <- sum(w^2)

  # gradient
  gr <- 2 * w

  list(objective = obj, gradient = gr)
}
cdries/mvskPortfolios documentation built on Feb. 10, 2021, 7:31 p.m.