A = [ 1.5, 2,0;-2, 1.5,0;0,0,1.2]; # permittivity tensor in the reference coordinate (x,y,z) ### Setting of diagonal material epsilon_D ### Evl=eig(A,1); # calculate eigenvalues DeR=[sqrt(Evl(1));sqrt(Evl(2));sqrt(Evl(3))];# diagonal elements of refractive indexes mymaterial = addmaterial("(n,k) Material"); setmaterial(mymaterial,"name","MOKE"); setmaterial("MOKE", "Anisotropy",1); # enable diagonal anisotropy setmaterial("MOKE","Refractive Index",real(DeR)); # set real part of diagonal elements of refractive indexes setmaterial("MOKE","Imaginary Refractive Index",imag(DeR)); # set imaginary part of diagonal elements of refractive indexes ### Setting of transformation matrix U ### Evc=eig(A,2); # calculate eigenvalues addgridattribute("matrix transform"); # add matrix transform grid attribute set("U",ctranspose(Evc)); # set the complex conjugate transpose of Evc to grid attribute property U set("name","kerr attribute"); # set Evc to grid attribute property U