Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

LeastSquaresObserver.cpp

Go to the documentation of this file.
00001 // LeastSquaresObserver.cpp: implementation of the LeastSquaresObserver class.
00002 //
00004 
00005 #include "LeastSquaresObserver.h"
00006 
00008 // Construction/Destruction
00010 
00011 CLeastSquaresObserver::CLeastSquaresObserver()
00012 {
00013 
00014 }
00015 
00016 CLeastSquaresObserver::~CLeastSquaresObserver()
00017 {
00018 
00019 }
00020 
00021 // default behavior is to print plain text matrix seperated by single spaces
00022 
00023 void CLeastSquaresObserver::Update(Subject *theChangedSubject)
00024 {
00025         int i;
00026         int j;
00027         int NParameters;
00028         int m_iNResiduals;
00029         // static cast may be dangerous
00030         CLeastSquaresMinimizer *LSM = (CLeastSquaresMinimizer *)theChangedSubject;
00031 
00032         // write the experimental data to the temporary file
00033         fstream *forcefile = new fstream("LSForceMatrix.dat",ios::out);
00034 
00035         const double **m_pdForceMatrix = LSM->GetForceMatrix();
00036         NParameters = LSM->GetNParameters();
00037         m_iNResiduals = LSM->GetNResiduals();
00038         for (i=0; i < NParameters; i++) {
00039                 for (j=0; j < m_iNResiduals; j++) {
00040                         *forcefile << m_pdForceMatrix[i][j] << " ";
00041                         //cout << LSM->GetForceMatrix()[i][j] << " ";
00042             }
00043             *forcefile << endl;
00044                 //cout << endl;
00045         }
00046 
00047         delete forcefile;
00048 
00049         return;
00050 
00051 }

Generated on Mon Nov 3 09:37:56 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002