1coefnorm=function(coeflist,q=1){
2  ###coeflist comes from mrelnet or multnet
3  nmat=coeflist[[1]]*0
4  nclass=length(coeflist)
5  for(i in seq(nclass)){
6    nmat=nmat+abs(coeflist[[i]])^q
7  }
8  nmat^(1/q)
9}
10