% poisson(m,endpt,N) - (m,endpt and N are described below)
%
% Written by M. Harper Langston - 5/10/00
% harper@cims.nyu.edu
%
% Fast poisson solver implementation in a SQUARE with CONTINUOUS DIRICHLET BNDRY CONDS.
% This file requires quite a few additional files:
%
% These first two are the only ones that need to be changed, depending on the situation:
% Form_Boundary.m - Stores the Dirichlet boundary condition
% ffunc.m - Stores f(x,y)
%
% The rest of these files are necessary, but MUST NOT BE changed (except by
% expert hands :) so that everything works ok)
% Form_Right.m - returns the right-hand side of the problem, given the boundary conditions
% and the vector, f. The result, b, incorporates boundary correction
% Modified_Right.m - Called in Form_Right.m, for the modified-nine-point scheme.
% This returns the matrix, B, which multiplies f(x,y)
% Form_Gamma.m - Forms the block matrix, Gamma, the block (tridiagonal) matrix of e-values.
% It does this by forming Q and then diagonalizing each block in A.
% It's important to note that Q is orthogonal such that inv(Q) = Q;
% This makes computation faster when we need it.
% Band_Solve.m - Finds the band of a Matrix and solves Ax = b
% according to A's sparsity and then does sparse LU decomposition
% Back_Solve.m - Called by Band_Solve.m to do the actual solving. It is a separate
% function since Band_Solve calls it twice.
% Transform.m - Last, but not least, Transform.m contains the call to the
% discrete fourier transform, and implements a fast sine transform
% by looking only at the imaginary part, up to a scaling factor.
% This is used to quickly compute y = Q*b and u = Q*y where the
% eigenvector-columns of Q are already known.
function poisson(m,endpt,N)
% m = refinement of mesh (best to keep below 100 on a 300 MhZ Home PC if you ever want it
% to finish; you can test this on your system).
% Note that x and y are discretized in the same manner.
% endpt = the endpoint of x and y, i.e., 0