The overflow of matrix value in Powell


Micafil
10-29-2003, 05:38 AM
I met trouble use powell stuff of NR C++ for my code. I define my matrix and vector class myself.

myclass::powell(Vec_IO_DP &p, Mat_IO_DP &xxi, const DP ftol, int &iter, DP &fret, int costfuncType) {
....
if (fptt < fp) {
t=2.0*(fp-2.0*fret+fptt)*SQR(fp-fret-del)-del*SQR(fp-fptt);
if (t < 0.0) {
linmin(p,xit,fret);

for (j=0;j<n;j++) {
xxi(j,ibig-1) = xxi(j,n-1);
xxi(j,n-1)=xit[j]; //Overflow happen here
}
.....
}
Firstly linmin() return the values for vector xit are:
xit[0]= 0.0474873
xit[1]= -0.000541714
xit[2]= 6.71654e-005
xit[3]= 0.000375254
xit[4]= 5.60033e-005
xit[5]= 2.50927e-009
For this loop, ibig-1 =0;
the values for matrix xxi after for loop
xxi(0,0)=0
xxi(0,5)= -7.84591e+298
xxi(1,0)=0
xxi(1,5)= 0.0474873
xxi(2,0)=0
xxi(2,5)= -0.000541714
xxi(3,0)=0
xxi(3,5)= 6.71654e-005
xxi(4,0)=0
xxi(4,5)= 0.000375254
xxi(5,0)=1
xxi(5,5)= 5.60033e-005

The result is very strange:
xxi(0,5) overflow, and xxi(1,5) = xit(0), xxi(2,5)=xit(1) and so on.

Can anybody help me why happen like these!

Thanks in advance!

Micafil