intern2extern <-
function(parameter,distribution,m){
  
  if(distribution=="poisson"){
    return(unlist(parameter))  
  }
  
  if(distribution=="normal"){
    startP = list(mu=numeric(m),sigma=numeric(m))
    for(i in 1:m){
      startP$mu[i] = (parameter[[i]])[1]
      startP$sigma[i] = (parameter[[i]])[2]    
      }
    return(startP)  
  }
  
  if(distribution=="mv_normal"){
    D = length(parameter[[1]]$mu)
    startP = list()
    mu = NA*matrix(0,ncol=m,nrow=D)
    sigma = NA*array(0,dim=c(D,D,m))
    for(i in 1:m){
      mu[,i] = parameter[[i]]$mu
      sigma[,,i] = parameter[[i]]$sigma
    }
    return(list(mu=mu,sigma=sigma))
  }
  
}
