Question: a grid problem

Question:a grid problem

alpac 28 Maple
<p>hi,</p>
<p>I am working on a problem in which i require computation of huge sparse matrices.I tried the following section of my maple code:</p>
<p>A:=proc(i, j,cc,numb)<br />
    global mat1r,mat1i:<br />
    mat1r[i,j]  := mat1r[i,j]  + coef*ec(i,j) - coef*((1/delz2) + (1/dely2) + (1/delx2)):        <br />
    if j+8<(numbr*numbr*numbr*8) then<br />
    mat1r[i,j+8] := mat1r[i,j+8] + 2*numb*coef/delz2 <br />
    fi:<br />
    if (j+(numbr*8))<(numbr*numbr*numbr*8) then<br />
    mat1r[i,j+(numbr*8)] := mat1r[i,j+(numbr*8)] + 2*numb*coef/dely2<br />
    fi:<br />
    if (j+(numbr*numbr*8))<(numbr*numbr*numbr*8) then<br />
    mat1r[i,j+(numbr*numbr*8)] := mat1r[i,j+(numbr*numbr*8)] + 2*numb*coef/delx2<br />
    fi:<br />
    if (j+16)<(numbr*numbr*numbr*8)  then<br />
    mat1r[i,j+16] := mat1r[i,j+16] - numb*coef/delz2<br />
    fi:<br />
    if (j+(numbr*16))<(numbr*numbr*numbr*8)  then<br />
    mat1r[i,j+(16*numbr)] := mat1r[i,j+(16*numbr)] - numb*coef/dely2<br />
    fi:<br />
    if (j+(numbr*16*numbr))<(numbr*numbr*numbr*8)  then<br />
    mat1r[i,j+(16*numbr*numbr)] := mat1r[i,j+(16*numbr*numbr)] - numb*coef/delx2<br />
    fi:<br />
end:<br />
mat1r:=Matrix(8000000,8000000,storage=sparse,datatype=float[8],order=C_order):<br />
mat1i:=Matrix(8000000,8000000,storage=sparse,datatype=float[8],order=C_order):<br />
delx:=0.0015:dely:=0.0015:delz:=0.0015:<br />
    numbr1:=100:chg:=0.3029:coef:=1e-6:<br />
    numbr := numbr1:<br />
    ncol:=numbr*numbr*numbr*8:<br />
    delx2 := delx*delx:<br />
    dely2 := dely*dely:<br />
    delz2 := delz*delz:<br />
    n3:=numbr*numbr*numbr:<br />
    seq(A(0+(8*i),1+(8*i),0,1),i=1..n3):</p>
<p>I am working on quadcore processor with 2gb ram.Its taking about 300 sec and 1.3gb of memory which is too much.I know that the</p>
<p>size of matrices is huge..but I could use some suggestsions on reducing memory  usage</p>
Please Wait...