R/Replace_Rand.R

Defines functions Replace_Rand

Documented in Replace_Rand

#' Select the new F matrix element with lowest error in the steepest
#' descent algorithm. 
#' 
#' @keywords internal
#'
#' @param Fmat   xx
#' @param i xx
#' @param S   xx
#' @param cm   xx
#' @param min.scaler   xx
#' @param max.scaler  xx
#'
#' @return
#'
#' @examples
Replace_Rand <- function(Fmat, i, S, cm, min.scaler, max.scaler){
  # randomise first element of matrix  
  F.new <- as.matrix(replace(Fmat[[1]], i, Randomise_elements(Fmat[[1]][i], min.scaler, max.scaler))) 
  F.new <- NNLS_MF(F.new, S, cm)
  # Which elements decrease the error? Store the location of the elements that decrease it   
  v <- which(F.new[[2]] < Fmat[[2]])
  res <- c(F.new,v) 
  return(res)
}

Try the phytoclass package in your browser

Any scripts or data that you put into this service are public.

phytoclass documentation built on April 4, 2025, 4:02 a.m.