//****************************************************************************** //** SCATMECH: Polarized Light Scattering C++ Class Library //** //** File: tmatrix.cpp //** //** Thomas A. Germer //** Sensor Science Division, National Institute of Standards and Technology //** 100 Bureau Dr. Stop 8443; Gaithersburg, MD 20899-8443 //** Phone: (301) 975-2876 //** Email: thomas.germer@nist.gov //** //****************************************************************************** #include "axipart.h" #include #include using namespace std; namespace SCATMECH { using namespace BobVlieg_Supp; static void solve(vector >& a,vector >& b,int n) { //c ............................................................... //c . -1 . //c . calculate [T]' = [A]' * [B]' using Gauss-Jordan reduction . //c ............................................................... vector ls(n); //c ............................ //c . start reduction of [a] . //c ............................ for (int i=0; iabs(aijmax)) { aijmax = a[i][j]; jmax = j; } } //c .................................................... //c . normalize the ith row of [a] and [b] by aijmax . //c .................................................... for (int jj=0; jj0.0) { a[k][j] += arat*a[i][j]; } } a[k][jmax] = 0.0; for (int jj=0; jj0.0) { b[k][jj] += arat*b[i][jj]; } } } //c ........................................................ //c . store row counter (i) in array ls(*), such that . //c . ls(*) contains the location of the pivot (unity) . //c . element of each column (after reduction) . //c ........................................................ ls[jmax] = i; } } //c .................................................... //c . the reduction of [a] is complete - perform . //c . row interchanges as indicated in array ls(*) . //c .................................................... for (int ii=0; ii0) { for (int j=0; j pnmllg; vector hankel; vector bslcmp; int isize=2*(nrank+1); vector > a(isize,vector(isize)); vector > b(isize,vector(isize)); //c ........................... //c . set program constants . //c ........................... double pi2 = pi/2.0; int nranki = nrank+1; int nr2 = 2*nrank; //c ......................................... //c . set the complex index of refraction . //c . for an exp(-iwt) time variation . //c ......................................... COMPLEX cm = index; COMPLEX dcn = sqr(cm); //c ................................................................. //c . convergence over m (ic = 2) requires nrank azimuthal modes, . //c . a nonsymmetric orientation, and a file for the matrices . //c ................................................................. int nm = (mmax