Fast solver for Poisson's equation on rectangular grid
u = poicalc(f,h1,h2,n1,n2) u = poicalc(f,h1,h2) u = poicalc(f)
u = poicalc(f,h1,h2,n1,n2) calculates the solution of Poisson's equation for the interior points of an evenly spaced rectangular grid. The columns of u contain the solutions corresponding to the columns of the right-hand side f. h1 and h2 are the spacings in the first and second direction, and n1 and n2 are the number of points.
The number of rows in f must be n1*n2. If n1 and n2 are not given, the square root of the number of rows of f is assumed. If h1 and h2 are not given, they are assumed to be equal.
The ordering of the rows in u and f is the canonical ordering of interior points, as returned by poiindex.
The solution is obtained by sine transforms in the first direction and tridiagonal matrix solution in the second direction. n1 should be 1 less than a power of 2 for best performance.