function L=mic3_3d(A,n); % Makes a modified incomplete Cholesky factorization of A, % A is the 3D discrete Laplacian matrix on a cube, % three extra subdiagonal filled-in in L nnn=n*n*n;;nn=n*n;nnnmn=nnn-n+1;nnnmnn=nnn-nn+1; si=5; bb=zeros(nnn,1);cc=zeros(nnn,1);aa=zeros(nnn,1);dd=zeros(nnn,1); ee=zeros(nnn,1);ff=zeros(nnn,1);gg=zeros(nnn,1); for i=1:nnn, as=A(i,i)*(1+si/nn); if i>1, as=as-bb(i-1)*(bb(i-1)+ee(i-1)+ff(i-1)+gg(i-1)); end if i>n, as=as-cc(i-n)*(cc(i-n)+ff(i-n)+gg(i-n)); end if i>nn as=as-dd(i-nn)*(dd(i-nn)+ee(i-nn));end if i>n-1 as =as-ee(i-n+1)*(ee(i-n+1)+bb(i-n+1)+ff(i-n+1)+dd(i-n+1));end if i>nn-n as=as-ff(i-nn+n)*(ff(i-nn+n)+cc(i-nn+n)+ee(i-nn+n)+bb(i-nn+n));end if i>nn-1 as=as-gg(i-nn+1)*(gg(i-nn+1)+cc(i-nn+1)+bb(i-nn+1));end aa(i)=sqrt(as); if in-1 bs=bs-ee(i-n+1)*cc(i-n+1);end if i>nn-1 bs=bs-gg(i-nn+1)*dd(i-nn+1);end bb(i)=bs/aa(i); end if i1 es=es-bb(i-1)*cc(i-1);end if i>nn-n es=es-ff(i-nn+n)*gg(i-nn+n);end ee(i)=es/aa(i);end if inn-n cs=cs-dd(i-nn+n)*ff(i-nn+n);end cc(i)=cs/aa(i); end if in-1 fs=fs-ee(i-n+1)*gg(i-n+1);end if i>n fs=fs-dd(i-n)*cc(i-n);end ff(i)=fs/aa(i);end if i1 gs=gs-bb(i-1)*dd(i-1);end gg(i)=gs/aa(i);end if i