R/calc_omega_i.R

Defines functions calc_omega_i

Documented in calc_omega_i

#' Calculation of omega i (internal)
#' @param idx index
#' @param Ai matrix
#' @param dSprod matrix with products of delta S
calc_omega_i <- function(idx, Ai, dSprod){

  Ai.idx <- match(names(idx), rownames(Ai)) #order the matrix as idx
  Ai_perm <- Ai[Ai.idx, Ai.idx]

  omega_vect_i <- dSprod[1:length(idx), 1:length(idx)] * Ai_perm
  omega_vect_i <- sum(omega_vect_i)

  return(omega_vect_i)

}
emosca-cnr/dmfind002 documentation built on May 16, 2024, 10:44 p.m.