Optimization of a Mult-Dimensional FFT Library for Accelerating Magnetostatic Field Computations