44 <<
"DEBUG: ~ossimWLSBundleSolution(): returning..." << std::endl;
59 <<
"\nossimWLSBundleSolution::run DEBUG:" << std::endl;
67 int numImages = solAttributes->
numImages();
71 std::vector<int> NdIndex(numImages);
73 for (
int n=1;
n<numImages; ++
n)
89 <<
"\n numObs = "<<numObs
90 <<
"\n numImages = "<<numImages
91 <<
"\n Nd_rank = "<<Nd_rank
92 <<
"\n Nrank = "<<Nrank;
93 for (
int n=0;
n<numImages; ++
n)
95 <<
"\n NdIndex = "<<
n<<
" "<<NdIndex[
n];
101 NEWMAT::UpperTriangularMatrix N(Nrank);
102 NEWMAT::ColumnVector C(Nrank);
103 NEWMAT::ColumnVector D(Nrank);
107 NEWMAT::Matrix Bdt_w;
108 NEWMAT::UpperTriangularMatrix Nd;
112 NEWMAT::ColumnVector eps(2);
113 NEWMAT::Matrix w(2,2);
116 NEWMAT::Matrix Bdd(2,3);
117 NEWMAT::Matrix Bddt_w(2,3);
118 NEWMAT::UpperTriangularMatrix Ndd(3);
119 NEWMAT::ColumnVector Cdd(3);
120 NEWMAT::Matrix Wdd(3,3);
127 for (
int img=0; img<numImages; img++)
130 int rcBeg = NdIndex[img];
131 int rcEnd = rcBeg+
size-1;
137 Wd = solAttributes->
theAdjParCov.SubMatrix(rcBeg,rcEnd,rcBeg,rcEnd).i();
139 NEWMAT::ColumnVector Ed(
size);
142 N.SymSubMatrix(rcBeg,rcEnd) << Wd;
143 C.Rows(rcBeg,rcEnd) = Wd * Ed;
153 for (
int obs=0; obs<numObs; obs++)
158 int NddIdx = Nd_rank + idx;
159 N.SymSubMatrix(NddIdx, NddIdx+2) << Wdd;
161 NEWMAT::ColumnVector Edd(3);
163 C.Rows(NddIdx, NddIdx+2) = Wdd * Edd;
169 int nMeasOnObs = (int) solAttributes->
theObjImgXref.count(obs);
177 <<
"\n=========obs, nMeasOnObs ========="<<obs<<
" "<<nMeasOnObs;
180 for (
int meas=0; meas<nMeasOnObs; meas++)
193 Bd = solAttributes->
theParPartials.Rows(cImgIdx,cImgIdx+cNumPar-1).t();
202 int NdIdx = NdIndex[currImg->second];
216 int start = (cMeas-1)*2 + 1;
223 Bddt_w << Bdd.t() * w;
231 N.SymSubMatrix(NdIdx,NdIdx+cNumPar-1) += Nd;
234 N.SymSubMatrix(NddIdx,NddIdx+2) += Ndd;
237 N.SubMatrix(NdIdx,NdIdx+cNumPar-1,NddIdx,NddIdx+2) = Nb;
240 C.Rows(NdIdx,NdIdx+cNumPar-1) += Cd;
243 C.Rows(NddIdx,NddIdx+2) += Cdd;
264 NEWMAT::LowerTriangularMatrix Nl = N.t();
268 if (!
solveSystem(Nl.Store()-1, C.Store()-1, D.Store()-1, Nrank))
308 int i,j,k,jj,jk,ik,nsize,jcol,kcol,ksize,nbr,ncol;
311 nsize = rank*(rank+1)/2;
313 for (jcol=rank; jcol>=2; --jcol)
320 tmp[jcol] = r*c[jcol];
325 for (i=1;i<=kcol;++i)
332 c[i] -= d[k]*tmp[jcol];
338 for (jk=nbr; jk>=1; --jk)
343 jj = ncol*(ncol-1)/2 - ksize;
344 for (ik=jk;ik>=1;--ik)
373 int jcol,iq,jcol1,nsize,i,j;
375 std::vector<double> tmp(rank+1);
384 for (jcol=2; jcol<=rank; jcol++)
386 nsize = jcol*(jcol+1)/2;
389 trimv(d,d,1,iq,jcol1,tmp);
391 for (i=iq,j=1; i<=iq+jcol1-1; i++,j++)
412 for (
int k=1; k<=mr; k++)
415 for (
int j=1; j<=mr; j++)
417 if (h[j+hIndex-1]!=0.0)
421 double hj = h[j+hIndex-1];
422 for (
int i=1; i<=mr; i++)
424 sum[i] += pc[k+pcIndex-1]*hj;
444 (std::vector<double>& from,
double* to,
int indexFrom,
int indexTo,
int nElements)
446 for (
int i=indexFrom,j=indexTo; i<=indexFrom+nElements-1; i++,j++)
462 std::vector<int> nz(rank+1);
464 std::vector<double> tmp(rank+1);
475 delta[1] = c[1]/d[1];
477 for (j=2; j<=rank; j++)
482 for (i=1; i<=jcol1; i++)
485 sum += d[k]*delta[i];
487 delta[j] = tmp[j]-sum;
NEWMAT::Matrix theImagePtCov
NEWMAT::UpperTriangularMatrix theFullCovMatrix
NEWMAT::Matrix theAdjParCov
ImgNumparMap_t theImgNumparXref
bool recurFwd(double *d, double *c, std::vector< double > &rc, std::vector< int > &nz, int jb)
NEWMAT::ColumnVector theLastCorrections
~ossimWLSBundleSolution()
Destructor.
NEWMAT::Matrix theObjectPtCov
void trimv(double *pc, double *h, int pcIndex, int hIndex, int mr, std::vector< double > &sum)
bool recurBack(double *d, int jb)
void moveAndNegate(std::vector< double > &from, double *to, int indexFrom, int indexTo, int nElements)
os2<< "> n<< " > nendobj n
NEWMAT::Matrix theObjPartials
bool solveSystem(double *d, double *c, double *delta, int jb)
ossimWLSBundleSolution()
Constructor.
std::pair< ObjImgMapIter_t, ObjImgMapIter_t > ObjImgMapIterPair_t
ObjImgMap_t theObjImgXref
bool run(ossimAdjSolutionAttributes *solAttributes)
Run solution.
ObjImgMap_t::iterator ObjImgMapIter_t
NEWMAT::ColumnVector theTotalCorrections
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
NEWMAT::Matrix theParPartials
NEWMAT::Matrix theMeasResiduals