bba_type <- function (mat_conf,alpha,model){
  
  source("./DST.r")
  source("./DST_fmt_functions.r")
nbclasses <- nrow(mat_conf)
mat_conf_norm=matrix(0,nbclasses,nbclasses)
for (i in 1:nbclasses)
  mat_conf_norm[,i] <- mat_conf[,i]/sum(mat_conf[,i])

R <- 1/ max(max(mat_conf_norm))
mat_masse=c()

if (model==1){
  for (k in 1:nbclasses){
    vect <- c()
    m <- matrix(0,nbclasses,3)
    mat_massek <- matrix(0,nbclasses,2^nbclasses)
    # class theta_i      
    m[1:nbclasses,1]=alpha*R* mat_conf_norm[,k]/(1+R*mat_conf_norm[,k])  
    # class not theta_i        
    m[1:nbclasses,2]= alpha/(1+R*mat_conf_norm[,k])
    # ignorance Theta
    m[1:nbclasses,3]= 1-alpha  
    vect=cbind(vect, m)
    indice <- 0
    for (i in nbclasses:-1:1){
      indice=indice+2^(i-1)
      #Theta
      mat_massek[i,2^nbclasses]=vect[i,3]
      #not theta_i
      mat_massek[i,indice]=vect[i,2]
      #theta_i
      mat_massek[i,2^(i-1)+1]=vect[i,1]
    }
    mat_masse=cbind(mat_masse, DST(t(mat_massek),2))
  }
  
}
else if (model==2){
  for (k in 1:nbclasses){
    vect <- c()
    m <- matrix(0,nbclasses,3)
    mat_massek <- matrix(0,nbclasses,2^nbclasses)
    # class not theta_i      
    m[1:nbclasses,1]=alpha*(1-R*mat_conf_norm[,k])
    # ignorance Theta        
    m[1:nbclasses,2]= 1-alpha*(1-R*mat_conf_norm[,k])  
    vect=cbind(vect, m)
    indice <- 0
    for (i in nbclasses:-1:1){
      indice=indice+2^(i-1)
      #Theta
      mat_massek[i,2^nbclasses]=vect[i,2]
      #not theta_i
      mat_massek[i,indice]=vect[i,1]
    }
    mat_masse=cbind(mat_masse, DST(t(mat_massek),2))
  }
}
else {
  print('ACCIDENT: in bbaType on the choice of model')
}

return (mat_masse)
}
