FUNCTION eigval3_arr,m
;
;  calculate coefficients of characteristic equation x^3+a*x^2+b^x+c=0
;  from the determinant of a 3x3 matrix
;  $Id: eigval3_arr.pro,v 1.2 2016/12/02 00:26:48 brandenb Exp $
;
a=-m(*,0,0)-m(*,1,1)-m(*,2,2)
b=m(*,0,0)*m(*,1,1)+m(*,1,1)*m(*,2,2)+m(*,2,2)*m(*,0,0)-$
  m(*,1,0)*m(*,0,1)-m(*,2,1)*m(*,1,2)-m(*,0,2)*m(*,2,0)
c=m(*,1,0)*m(*,0,1)*m(*,2,2)+m(*,2,1)*m(*,1,2)*m(*,0,0)+m(*,0,2)*m(*,2,0)*m(*,1,1)-$
  m(*,0,0)*m(*,1,1)*m(*,2,2)-m(*,0,1)*m(*,1,2)*m(*,2,0)-m(*,0,2)*m(*,1,0)*m(*,2,1)
;
cubic_arr,a,b,c,disc,lam1,lam2,lam3
n=n_elements(a)
res=[lam1,lam2,lam3]
return,reform(res,n,3)
END