00001
00009
00010 #include <iostream>
00011 #include <fstream>
00012 #include <string>
00013 #include <vector>
00014
00015 #include <cstdio>
00016 #include <cstdlib>
00017 #include <cmath>
00018 #include <cassert>
00019
00020 #include "./SubGraph.hh"
00021 #include "./SearchTree.hh"
00022 #include "./divergence.h"
00023
00024
00025 #define MIN(x, y) (((x) > (y)) ? (y) : (x))
00026 #define semiInf 1e+2
00027
00028 class MatchCost
00029 {
00030
00031
00032
00033
00034
00035 public:
00036
00038 float factor_weightMTinTLDiff;
00040 float factor_TL1TL2Div;
00042 float factor_flowDiff;
00044 float factor_divDiff;
00046 float factor_MIDiff;
00048 float factor_divMTaMTbCost;
00050 float factor_timeDiff;
00054 float meanCalculation;
00055
00056
00057 private:
00058
00060 SubGraph *subGraph1;
00062 SubGraph *subGraph2;
00063
00067 bool meanCalcul;
00069 Divergence *divObject;
00071 float **C_A;
00073 float *M_A;
00075 float **C_B;
00077 float *M_B;
00078
00079
00080
00081 public:
00083 MatchCost(SubGraph *Graph1,SubGraph *Graph2){
00084
00085 subGraph1=Graph1;
00086 subGraph2=Graph2;
00087 divObject=new Divergence[1](subGraph1->nbDim);
00088 C_A=new float *[subGraph1->nbDim];C_B=new float *[subGraph1->nbDim];
00089 M_A=new float[subGraph1->nbDim];M_B=new float[subGraph1->nbDim];
00090 for (int i=0;i<subGraph1->nbDim;i++){
00091 C_A[i]=new float [subGraph1->nbDim];C_B[i]=new float [subGraph1->nbDim];
00092 }
00093
00094 }
00096 virtual~MatchCost(){
00097
00098 delete [] divObject;
00099 for (int i=0;i<subGraph1->nbDim;i++){delete [] C_A[i];delete [] C_B[i];}
00100 delete [] C_A;delete [] M_A;delete [] C_B;delete [] M_B;
00101
00102 }
00113 void FixCostFuncWeigths(float weightMTinTLDiff,float TL1TL2Div,float flowDiff,float divDiff,float MIDiff, float divMTaMTbCost, float timeDiff,bool meanCalcul){
00114
00115 factor_weightMTinTLDiff=weightMTinTLDiff;
00116 factor_TL1TL2Div=TL1TL2Div;
00117 factor_flowDiff=flowDiff;
00118 factor_divDiff=divDiff;
00119 factor_MIDiff=MIDiff;
00120 factor_timeDiff=timeDiff;
00121 factor_divMTaMTbCost=divMTaMTbCost;
00122 meanCalculation=meanCalcul;
00123
00124 }
00126 void UpdateGraph2(SubGraph *Graph2){
00127
00128 subGraph2=Graph2;
00129 }
00151 float InexactMatchCost(int nbMiniBranches, SearchTree* searchTree, float *costs){
00152
00153 float cost, partialCost;
00154 float interactTimeCost=-1;
00155 float auxCost_weight,tmpCost_weight;
00156
00157 float tmpCost_TL1TL2Div;
00158 float *resolution=new float[subGraph1->nbDim];
00159 float *min_bound=new float[subGraph1->nbDim];float *max_bound=new float[subGraph1->nbDim];
00160
00161 float tmpCost_flow=0;
00162 float tmpCost_div=0;int calculateDiv;
00163 float tmpCost_MI=0;
00164 float tmpCost_time=0;
00165 int indexaux;
00166 float auxabs;
00167 int* nbNodes1=new int[subGraph1->nbTimeSamp];
00168 for (int time=0;time<subGraph1->nbTimeSamp;time++){
00169 nbNodes1[time]=0;
00170 for (int nodek1=0;(unsigned int)nodek1<subGraph1->meanTL[time].size();nodek1++){
00171 nbNodes1[time]+=subGraph1->weightMTinTL[time][nodek1].size();
00172 }
00173 }
00174
00175 searchTree[0].Init(subGraph1->nbTimeSamp,subGraph1->nbMTClusters,nbNodes1);
00176
00177 int currentLevel=0;
00178 bool root;
00179 int *contMTkforMI=new int[subGraph1->nbMTClusters];
00180 int nbTrunc;
00181 for (int time=0;time<subGraph1->nbTimeSamp;time++){
00182
00183 interactTimeCost=0;
00184 if (subGraph1->nbMTClusters==2){
00185 LoadMT1aMT1bMeanCov(time,0,1);
00186 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00187 if (meanCalculation){ interactTimeCost+=divObject[0].MeanDifference();}
00188 else{
00189 divObject[0].InvertCovMatrix();
00190 calculateDiv=divObject[0].BoundResolution_Calculation(min_bound,max_bound,resolution,10.);
00191 if(calculateDiv<1){interactTimeCost+=MIN(divObject[0].Divergence2GaussModel(min_bound,max_bound,resolution,1),divObject[0].MeanDifference());}
00192 else{interactTimeCost+=divObject[0].MeanDifference();}
00193 }
00194
00195 LoadMT2aMT2bMeanCov(time,0,1);
00196 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00197 if (meanCalculation){ interactTimeCost-=divObject[0].MeanDifference();}
00198 else{
00199 divObject[0].InvertCovMatrix();
00200 calculateDiv=divObject[0].BoundResolution_Calculation(min_bound,max_bound,resolution,10.);
00201 if(calculateDiv<1){interactTimeCost-=MIN(divObject[0].Divergence2GaussModel(min_bound,max_bound,resolution,1),divObject[0].MeanDifference());}
00202 else{interactTimeCost-=divObject[0].MeanDifference();}
00203 }
00204 interactTimeCost=factor_divMTaMTbCost*sqrt(interactTimeCost*interactTimeCost);
00205 }
00206 tmpCost_time=0;
00207 if(time>0){auxabs=subGraph1->tDelay[time-1]-subGraph2->tDelay[time-1];tmpCost_time=sqrt(auxabs*auxabs)*factor_timeDiff;}
00208 tmpCost_MI=0;
00209 for (int MTkforMI=0;MTkforMI<subGraph1->nbMTClusters;MTkforMI++){contMTkforMI[MTkforMI]=0;}
00210 for (int nodek1=0; (unsigned int)nodek1<subGraph1->meanTL[time].size();nodek1++){
00211
00212 for (int MTk1=0;(unsigned int)MTk1<subGraph1->weightMTinTL[time][nodek1].size();MTk1++){
00213
00214 auxCost_weight =(float)subGraph1->weightMTinTL[time][nodek1][MTk1];
00215 auxCost_weight /= (float)subGraph1->weightMT[subGraph1->indexMTinTL[time][nodek1][MTk1]];
00216
00217
00218 root=(currentLevel==0);
00219 if (root){nbTrunc=1;}else{nbTrunc=searchTree[0].tree[currentLevel-1].size();}
00220 for (int preIndex=0;preIndex<nbTrunc;preIndex++){
00221 for (int nodek2=0;(unsigned int)nodek2<subGraph2->meanTL[time].size();nodek2++){
00222 for (int MTk2=0;(unsigned int)MTk2<subGraph2->weightMTinTL[time][nodek2].size();MTk2++){
00223 if (searchTree[0].CheckUnusedNode(time,currentLevel,preIndex,nodek2,subGraph2->indexMTinTL[time][nodek2][MTk2])){
00224 if (searchTree[0].CheckMTCoherentNode(time,currentLevel,preIndex,subGraph1->indexMTinTL[time][nodek1][MTk1],subGraph2->indexMTinTL[time][nodek2][MTk2])){
00225
00226 tmpCost_weight=auxCost_weight;
00227 tmpCost_weight-=(float)subGraph2->weightMTinTL[time][nodek2][MTk2]/(float)subGraph2->weightMT[subGraph2->indexMTinTL[time][nodek2][MTk2]];
00228 tmpCost_weight=sqrt(tmpCost_weight*tmpCost_weight);
00229 tmpCost_weight*=factor_weightMTinTLDiff;
00230 partialCost=tmpCost_weight;
00231
00232
00233 if (factor_TL1TL2Div!=0){
00234 LoadTL1TL2MeanCov(time,nodek1,nodek2);
00235 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00236 if (meanCalculation){
00237 tmpCost_TL1TL2Div=divObject[0].MeanDifference();
00238 tmpCost_TL1TL2Div=sqrt(tmpCost_TL1TL2Div*tmpCost_TL1TL2Div);
00239 }
00240 else{
00241 calculateDiv=divObject[0].BoundResolution_Calculation(min_bound,max_bound,resolution,10.);
00242 if (calculateDiv<1){
00243 divObject[0].InvertCovMatrix();
00244 tmpCost_TL1TL2Div=MIN(divObject[0].Divergence2GaussModel(min_bound,max_bound,resolution,1),divObject[0].MeanDifference());
00245 }
00246 else{tmpCost_TL1TL2Div=divObject[0].MeanDifference();}
00247 }
00248
00249 }
00250 else{tmpCost_TL1TL2Div=0;}
00251 tmpCost_TL1TL2Div*=factor_TL1TL2Div;
00252 partialCost+=tmpCost_TL1TL2Div;
00253
00254
00255 if (time>0){
00256 tmpCost_flow=0;
00257 tmpCost_div=0;
00258 for (int k=0;(unsigned int)k<subGraph1->meanTL[time-1].size();k++){
00259 if (CheckMTCoherentEdge1(time,MTk1,k,nodek1)){
00260 indexaux=searchTree[0].getPreTimeCorresNodeIndex(time,currentLevel,preIndex,k,subGraph1->indexMTinTL[time][nodek1][MTk1]);
00261
00262 if (indexaux != -1){
00263 if (CheckMTCoherentEdge2(time,MTk2,indexaux,nodek2)){ auxabs=(float)subGraph1->flowMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1]/(float)subGraph1->weightMT[subGraph1->indexMTinTL[time][nodek1][MTk1]]-(float)subGraph2->flowMatrix[time][subGraph2->indexMTinTL[time][nodek2][MTk2]][indexaux][nodek2]/(float)subGraph2->weightMT[subGraph2->indexMTinTL[time][nodek2][MTk2]];
00264 auxabs=sqrt(auxabs*auxabs);
00265 tmpCost_flow+=auxabs*factor_flowDiff;
00266
00267 auxabs=0;
00268 if (!meanCalculation){
00269 auxabs=subGraph1->divMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1]-subGraph2->divMatrix[time][subGraph2->indexMTinTL[time][nodek2][MTk2]][indexaux][nodek2];
00270
00271 }
00272 if (meanCalculation||sqrt(auxabs*auxabs)>semiInf){
00273 LoadTL1preTL1MeanCov(time,nodek1,k);
00274 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00275 auxabs=divObject[0].MeanDifference();
00276 LoadTL2preTL2MeanCov(time,nodek2,indexaux);
00277 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00278 auxabs-=divObject[0].MeanDifference(); }
00279 auxabs=sqrt(auxabs*auxabs);
00280 tmpCost_div+=auxabs*factor_divDiff;
00281
00282 if(contMTkforMI[subGraph1->indexMTinTL[time][nodek1][MTk1]]==0){
00283 auxabs=(float)subGraph1->MIMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1]-(float)subGraph2->MIMatrix[time][subGraph2->indexMTinTL[time][nodek2][MTk2]][indexaux][nodek2];
00284 auxabs=sqrt(auxabs*auxabs);
00285 tmpCost_MI+=auxabs*factor_MIDiff;
00286 contMTkforMI[subGraph1->indexMTinTL[time][nodek1][MTk1]]=1;
00287 }
00288 }
00289
00290 }
00291
00292 else{
00293
00294 auxabs=(float)subGraph1->flowMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1]/(float)subGraph1->weightMT[subGraph1->indexMTinTL[time][nodek1][MTk1]];
00295 tmpCost_flow+=auxabs*factor_flowDiff;
00296
00297 indexaux=searchTree[0].getPreTimeCorresMTIndex(time,currentLevel,preIndex,k,subGraph1->indexMTinTL[time][nodek1][MTk1]);
00298 auxabs=0;
00299 if (!meanCalculation){
00300 auxabs+=subGraph1->divMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1];
00301 }
00302 if (meanCalculation||auxabs>semiInf){
00303 auxabs=0;
00304 LoadTL1preTL1MeanCov(time,nodek1,k);
00305 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00306 auxabs+=divObject[0].MeanDifference(); }
00307
00308 LoadTL2preMT2MeanCov(time,nodek2,indexaux);
00309 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00310 if (meanCalculation){auxabs-=divObject[0].MeanDifference();}
00311 else{
00312 calculateDiv=divObject[0].BoundResolution_Calculation(min_bound,max_bound,resolution,10.);
00313 if (calculateDiv<1){
00314 divObject[0].InvertCovMatrix();
00315 auxabs-=MIN(divObject[0].Divergence2GaussModel(min_bound,max_bound,resolution,1),divObject[0].MeanDifference());
00316 }
00317 else{auxabs-=divObject[0].MeanDifference();}
00318 }
00319 tmpCost_div+=sqrt(auxabs*auxabs)*factor_divDiff;
00320 }
00321
00322 }
00323 }
00324 partialCost+=tmpCost_flow;
00325 partialCost+=tmpCost_div;
00326 }
00327
00328
00329
00330 partialCost+=tmpCost_MI;
00331 partialCost+=tmpCost_time;
00332 partialCost+=interactTimeCost;
00333 cost=partialCost;
00334 searchTree[0].AddNode(time,currentLevel,preIndex,nodek1,subGraph1->indexMTinTL[time][nodek1][MTk1],nodek2,subGraph2->indexMTinTL[time][nodek2][MTk2],cost,tmpCost_weight,tmpCost_TL1TL2Div,tmpCost_flow,tmpCost_div,tmpCost_MI,interactTimeCost,tmpCost_time);
00335
00336 }
00337 }
00338 }
00339 }
00340
00341
00342
00343
00344 for (int MTk2=0;MTk2<subGraph2->nbMTClusters;MTk2++){
00345 if (searchTree[0].CheckMTCoherentNode(time,currentLevel,preIndex,subGraph1->indexMTinTL[time][nodek1][MTk1],MTk2)){
00346
00347 tmpCost_weight*=factor_weightMTinTLDiff;
00348 partialCost=tmpCost_weight;
00349
00350 if (factor_TL1TL2Div!=0){
00351 LoadTL1MT2MeanCov(time,nodek1,MTk2);
00352 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00353 if (meanCalculation){
00354 tmpCost_TL1TL2Div=divObject[0].MeanDifference();
00355 tmpCost_TL1TL2Div=sqrt(tmpCost_TL1TL2Div*tmpCost_TL1TL2Div);
00356 }
00357 else{
00358 calculateDiv=divObject[0].BoundResolution_Calculation(min_bound,max_bound,resolution,10.);
00359 if (calculateDiv<1){
00360 divObject[0].InvertCovMatrix();
00361 tmpCost_TL1TL2Div=MIN(divObject[0].Divergence2GaussModel(min_bound,max_bound,resolution,1),divObject[0].MeanDifference());
00362 }
00363 else{tmpCost_TL1TL2Div=divObject[0].MeanDifference();}
00364 }
00365
00366
00367 }
00368 else{tmpCost_TL1TL2Div=0;}
00369 tmpCost_TL1TL2Div*=factor_TL1TL2Div;
00370 partialCost+=tmpCost_TL1TL2Div;
00371
00372
00373 if (time>0){
00374 tmpCost_flow=0;
00375 tmpCost_div=0;
00376 for (int k=0;(unsigned int)k<subGraph1->meanTL[time-1].size();k++){
00377 if (CheckMTCoherentEdge1(time,MTk1,k,nodek1)){
00378 tmpCost_flow+=(float)subGraph1->flowMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1]/(float)subGraph1->weightMT[subGraph1->indexMTinTL[time][nodek1][MTk1]]*factor_flowDiff;
00379
00380 indexaux=searchTree[0].getPreTimeCorresNodeIndex(time,currentLevel,preIndex,k,subGraph1->indexMTinTL[time][nodek1][MTk1]);
00381 if (indexaux != -1){
00382
00383 auxabs=0;
00384 if (!meanCalculation){
00385 auxabs+=subGraph1->divMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1];
00386 }
00387 if (meanCalculation||auxabs>semiInf){
00388 auxabs=0;
00389 LoadTL1preTL1MeanCov(time,nodek1,k);
00390 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00391 auxabs+=divObject[0].MeanDifference();
00392 }
00393 LoadpreTL2MT2MeanCov(time,indexaux,MTk2);
00394 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00395 if (meanCalculation){auxabs-=divObject[0].MeanDifference();}
00396 else{
00397 divObject[0].InvertCovMatrix();
00398 calculateDiv=divObject[0].BoundResolution_Calculation(min_bound,max_bound,resolution,10.);
00399 if (calculateDiv<1){auxabs-=MIN(divObject[0].Divergence2GaussModel(min_bound,max_bound,resolution,1),divObject[0].MeanDifference());}
00400 else{auxabs-=divObject[0].MeanDifference();}
00401 }
00402 auxabs=sqrt(auxabs*auxabs);
00403 tmpCost_div+=auxabs*factor_divDiff;
00404 }
00405 else{
00406
00407 auxabs=0;
00408 if (!meanCalculation){
00409 auxabs+=subGraph1->divMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1];
00410 }
00411 if (meanCalculation||auxabs>semiInf){
00412 auxabs=0;
00413 LoadTL1preTL1MeanCov(time,nodek1,k);
00414 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00415 auxabs+=divObject[0].MeanDifference();
00416 }
00417 indexaux=searchTree[0].getPreTimeCorresMTIndex(time,currentLevel,preIndex,k,subGraph1->indexMTinTL[time][nodek1][MTk1]);
00418 LoadpreMT2MT2MeanCov(time,indexaux,MTk2);
00419 divObject[0].Initialise (C_A,C_B,M_A,M_B);
00420 if (meanCalculation){auxabs-=divObject[0].MeanDifference();}
00421 else{
00422 divObject[0].InvertCovMatrix();
00423 calculateDiv=divObject[0].BoundResolution_Calculation(min_bound,max_bound,resolution,10.);
00424 if (calculateDiv<1){auxabs-=MIN(divObject[0].Divergence2GaussModel(min_bound,max_bound,resolution,1),divObject[0].MeanDifference());}
00425 else{auxabs-=divObject[0].MeanDifference();}
00426 }
00427 auxabs=sqrt(auxabs*auxabs);
00428 tmpCost_div+=auxabs*factor_divDiff;
00429 }
00430 }
00431 }
00432 partialCost+=tmpCost_flow;
00433 partialCost+=tmpCost_div;
00434 }
00435
00436 partialCost+=tmpCost_MI;
00437 partialCost+=tmpCost_time;
00438 partialCost+=interactTimeCost;
00439 cost=partialCost;
00440 searchTree[0].AddNode(time,currentLevel,preIndex,nodek1,subGraph1->indexMTinTL[time][nodek1][MTk1],-1,MTk2,cost,tmpCost_weight,tmpCost_TL1TL2Div,tmpCost_flow,tmpCost_div,tmpCost_MI,interactTimeCost,tmpCost_time);
00441
00442 }
00443 }
00444 }
00445 searchTree[0].PruneTree(nbMiniBranches,currentLevel);
00446 currentLevel++;
00447 interactTimeCost=0;
00448 tmpCost_time=0;
00449 tmpCost_MI=0;
00450 }
00451 }
00452 }
00453
00454 float miniCostmatch=searchTree[0].LowestCosts(costs);
00455
00456 delete [] contMTkforMI;
00457 return miniCostmatch;
00458
00459 }
00460
00461
00462
00463 private:
00465 void LoadTL1TL2MeanCov(int time,int nodek1,int nodek2){
00466
00467 for (int i=0;i<subGraph1->nbDim;i++){
00468 M_A[i]=subGraph1->meanTL[time][nodek1][i];M_B[i]=subGraph2->meanTL[time][nodek2][i];
00469 for (int j=0;j<subGraph1->nbDim;j++){
00470 C_A[i][j]=subGraph1->covTL[time][nodek1][i][j];C_B[i][j]=subGraph2->covTL[time][nodek2][i][j];
00471 }
00472 }
00473 }
00476 void LoadTL1MT2MeanCov(int time,int nodek1, int MTk2){
00477
00478 for (int i=0;i<subGraph1->nbDim;i++){
00479 M_A[i]=subGraph1->meanTL[time][nodek1][i];M_B[i]=subGraph2->meanMT[time][MTk2][i];
00480 for (int j=0;j<subGraph1->nbDim;j++){
00481 C_A[i][j]=subGraph1->covTL[time][nodek1][i][j];C_B[i][j]=subGraph2->covMT[time][MTk2][i][j];
00482 }
00483 }
00484 }
00487 void LoadTL2preMT2MeanCov(int time,int nodek1, int MTk2)
00488 {
00489 for (int i=0;i<subGraph2->nbDim;i++){
00490 M_A[i]=subGraph2->meanTL[time][nodek1][i];M_B[i]=subGraph2->meanMT[time-1][MTk2][i];
00491 for (int j=0;j<subGraph2->nbDim;j++){
00492 C_A[i][j]=subGraph2->covTL[time][nodek1][i][j];C_B[i][j]=subGraph2->covMT[time-1][MTk2][i][j];
00493 }
00494 }
00495 }
00498 void LoadpreTL2MT2MeanCov(int time,int nodek1, int MTk2)
00499 {
00500 for (int i=0;i<subGraph2->nbDim;i++){
00501 M_A[i]=subGraph2->meanTL[time-1][nodek1][i];M_B[i]=subGraph2->meanMT[time][MTk2][i];
00502 for (int j=0;j<subGraph2->nbDim;j++){
00503 C_A[i][j]=subGraph2->covTL[time-1][nodek1][i][j];C_B[i][j]=subGraph2->covMT[time][MTk2][i][j];
00504 }
00505 }
00506 }
00509 void LoadpreMT2MT2MeanCov(int time,int preMTk2, int MTk2)
00510 {
00511 for (int i=0;i<subGraph2->nbDim;i++){
00512 M_A[i]=subGraph2->meanMT[time-1][preMTk2][i];M_B[i]=subGraph2->meanMT[time][MTk2][i];
00513 for (int j=0;j<subGraph2->nbDim;j++){
00514 C_A[i][j]=subGraph2->covMT[time-1][preMTk2][i][j];C_B[i][j]=subGraph2->covMT[time][MTk2][i][j];
00515 }
00516 }
00517 }
00520 void LoadMT1aMT1bMeanCov(int time,int MTk1, int MTk2)
00521 {
00522 for (int i=0;i<subGraph1->nbDim;i++){
00523 M_A[i]=subGraph1->meanMT[time][MTk1][i];M_B[i]=subGraph1->meanMT[time][MTk2][i];
00524 for (int j=0;j<subGraph1->nbDim;j++){
00525 C_A[i][j]=subGraph1->covMT[time][MTk1][i][j];C_B[i][j]=subGraph1->covMT[time][MTk2][i][j];
00526 }
00527 }
00528 }
00530 void LoadMT2aMT2bMeanCov(int time,int MTk1, int MTk2)
00531 {
00532 for (int i=0;i<subGraph2->nbDim;i++){
00533 M_A[i]=subGraph2->meanMT[time][MTk1][i];M_B[i]=subGraph2->meanMT[time][MTk2][i];
00534 for (int j=0;j<subGraph2->nbDim;j++){
00535 C_A[i][j]=subGraph2->covMT[time][MTk1][i][j];C_B[i][j]=subGraph2->covMT[time][MTk2][i][j];
00536 }
00537 }
00538 }
00540 void LoadTL1preTL1MeanCov(int time,int nodek1,int preNodek1){
00541
00542 for (int i=0;i<subGraph1->nbDim;i++){
00543 M_A[i]=subGraph1->meanTL[time][nodek1][i];
00544 M_B[i]=subGraph1->meanTL[time-1][preNodek1][i];
00545 for (int j=0;j<subGraph1->nbDim;j++){
00546 C_A[i][j]=subGraph1->covTL[time][nodek1][i][j];
00547 C_B[i][j]=subGraph1->covTL[time-1][preNodek1][i][j];
00548 }
00549 }
00550 }
00552 void LoadTL2preTL2MeanCov(int time,int nodek2,int preNodek2){
00553
00554 for (int i=0;i<subGraph2->nbDim;i++){
00555 M_A[i]=subGraph2->meanTL[time][nodek2][i];
00556 M_B[i]=subGraph2->meanTL[time-1][preNodek2][i];
00557 for (int j=0;j<subGraph2->nbDim;j++){
00558 C_A[i][j]=subGraph2->covTL[time][nodek2][i][j];
00559 C_B[i][j]=subGraph2->covTL[time-1][preNodek2][i][j];
00560 }
00561 }
00562 }
00564 bool CheckMTCoherentEdge1(int time,int MTk1,int k,int nodek1){
00565
00566 return (subGraph1->divMatrix[time][subGraph1->indexMTinTL[time][nodek1][MTk1]][k][nodek1]!=-1);
00567
00568 }
00570 bool CheckMTCoherentEdge2(int time,int MTk2,int k,int nodek2){
00571
00572 return (subGraph2->divMatrix[time][subGraph2->indexMTinTL[time][nodek2][MTk2]][k][nodek2]!=-1);
00573
00574 }
00575
00576 };