void cGenSysSurResol::Indexee_EcrireDansMatrWithQuad ( ElMatrix<tSysCho> &aMatr, const std::vector<cSsBloc> & aVx, const std::vector<cSsBloc> & aVy ) const { int xout = 0; for (int aKx=0 ; aKx <int(aVx.size()) ; aKx++) { int aI0x = aVx[aKx].I0AbsSolve(); int aI1x = aVx[aKx].I1AbsSolve(); for (int xin = aI0x; xin < aI1x ; xin++) { int yout=0; for (int aKy=0 ; aKy <int(aVy.size()) ; aKy++) { int aI0y = aVy[aKy].I0AbsSolve(); int aI1y = aVy[aKy].I1AbsSolve(); for (int yin = aI0y; yin < aI1y ; yin++) { aMatr(xout,yout) = GetElemQuad(xin,yin); yout++; } } xout ++; } } }
void cGenSysSurResol::Indexee_EcrireDansMatrWithQuad ( ElMatrix<tSysCho> &aMatr, const std::vector<INT> & aVIndx, const std::vector<INT> & aVIndy ) const { for (int aKx=0 ; aKx <int(aVIndx.size()) ; aKx++) for (int aKy=0 ; aKy <int(aVIndy.size()) ; aKy++) aMatr(aKx,aKy) = GetElemQuad(aVIndx[aKx],aVIndy[aKy]); }
tSysCho cGenSysSurResol::SomQuad() const { tSysCho aRes = 0; for (int aKx=0 ; aKx<NbVar(); aKx++) { for (int aKy=0 ; aKy<NbVar(); aKy++) { aRes = ElSquare(GetElemQuad(aKx,aKy)); } } return aRes; }
void cGenSysSurResol::Indexee_SoustraitMatrInQuad ( const ElMatrix<tSysCho> &aMatr, const std::vector<INT> & aVIndx, const std::vector<INT> & aVIndy ) { for (int aKx=0 ; aKx <int(aVIndx.size()) ; aKx++) for (int aKy=0 ; aKy <int(aVIndy.size()) ; aKy++) { SetElemQuad(aVIndx[aKx],aVIndy[aKy], GetElemQuad(aVIndx[aKx],aVIndy[aKy])-aMatr(aKx,aKy)); } }
ElMatrix<tSysCho> cGenSysSurResol::MatQuad() const { int aNbV=NbVar(); ElMatrix<tSysCho> aRes (aNbV,aNbV,0.0); for (int anX=0 ; anX<aNbV ; anX++) { for (int anY=0 ; anY<aNbV ; anY++) { aRes(anX,anY) = GetElemQuad(anX,anY); } } return aRes; }
void cGenSysSurResol::ShowGSR(int aMode) { for (int aKy=0 ; aKy<NbVar() ; aKy++) { for (int aKx=0 ; aKx<NbVar() ; aKx++) { double aV = GetElemQuad(aKx,aKy); if (aMode==0) { std::cout << ((aV==0) ? "-" : "*"); } else { ELISE_ASSERT(false,"cGenSysSurResol::ShowGSR"); } } std::cout << " " << aKy << " " << GetElemLin(aKy) << "\n"; // printf(" %2d L=%2e\n",aKy,GetElemLin(aKy)); //std::cout << " : " << aKy << "\n"; } }
Im1D_REAL8 cGenSysSurResol::GSSR_Solve(bool * aResOk) { Im1D_REAL8 aSol = V_GSSR_Solve(aResOk); if (true && (NbVar() >8)) { /* ElMatrix<double> aM2(NbVar(),NbVar()); ElMatrix<double> aL2(1,NbVar()); for (int aJ=0; aJ< NbVar() ; aJ++) { aL2(0,aJ) = GetElemLin(aJ); for (int aI=0; aI< NbVar() ; aI++) aM2(aI,aJ) = GetElemQuad(aI,aJ); } ElMatrix<double> aS2 = gaussj(aM2) * aL2; std::cout << "NBV " << NbVar() << "NB CONTRAINTE " << mNbContrainte << " Assumed : " << ContraintesAssumed() << "\n"; for (int aK=0 ; aK<NbVar() ; aK++) std::cout << "*************jjkk--- " << aK << " " << aSol.data()[aK] << " " << aS2(0,aK) << " M2 " << aM2(aK,aK) << "\n"; getchar(); */ if (0) { for (int aJ=0; aJ< NbVar() ; aJ++) { double aS0=0; for (int aK=0; aK< NbVar() ; aK++) aS0 += aSol.data()[aK] * GetElemQuad(aJ,aK); float aV = (float)GetElemLin(aJ); printf("%d %f %f %f :: ",aJ,aSol.data()[aJ],aV,aS0); for (int aK=0 ; aK< NbVar() ; aK++) { float aV = (float)GetElemQuad(aJ,aK); printf("%f ",aV); } printf("\n"); } } } if ((mNbContrainte==0) || mCstrAssumed) return aSol; for (INT y=0 ; y<NbVar() ; y++) mSol(0,y) = aSol.data()[y]; mSol += mE; mCSol.mul(mC,mSol); for (INT y=0 ; y<NbVar() ; y++) { aSol.data()[y] = mCSol(0,y); } return aSol; }
void cGenSysSurResol::SoutraitProduc3x3 ( bool Sym, ElMatrix<tSysCho> &aM1, ElMatrix<tSysCho> &aM2, const std::vector<cSsBloc> * aYVSB ) { // std::cout << "AV 333x3333\n"; tSysCho ** aData1 = aM1.data(); tSysCho ** aData2 = aM2.data(); tSysCho * aL2A = aData2[0]; tSysCho * aL2B = aData2[1]; tSysCho * aL2C = aData2[2]; /* // std::cout << "AAAAAAAAAAAAAAAAaakkkkkkkkkkkkkk\n"; if ((!aYVSB) || (aYVSB->size()!=1)) { std::cout << "aYVSB: " << aYVSB << "\n"; std::cout << " size: " << aYVSB->size() << "\n"; ELISE_ASSERT(aYVSB && (aYVSB->size()==1),"cGenSysSurResol::SoutraitProduc3x3"); } */ ELISE_ASSERT(aYVSB,"cGenSysSurResol::SoutraitProduc3x3"); int aY=0; for (int aKBy=0 ; aKBy <int(aYVSB->size()) ; aKBy++) { const cSsBloc & aBlY = (*aYVSB)[aKBy]; for (int aKy=aBlY.I0AbsSolve() ; aKy <aBlY.I1AbsSolve() ; aKy++) { int aDebX = Sym ? aY : 0; tSysCho A1 = aData1[aY][0]; tSysCho B1 = aData1[aY][1]; tSysCho C1 = aData1[aY][2]; int aX=0; for (int aKBx=0 ; aKBx <int(aYVSB->size()) ; aKBx++) { const cSsBloc & aBlX = (*aYVSB)[aKBx]; for (int aKx=aBlX.I0AbsSolve() ; aKx <aBlX.I1AbsSolve() ; aKx++) { if (aX>=aDebX) { SetElemQuad(aKx,aKy,GetElemQuad(aKx,aKy) -(A1 * aL2A[aX] + B1 * aL2B[aX] + C1 *aL2C[aX])); } aX++; } } /* for (int aKx=aDebX ; aKx <int(aVIndy.size()) ; aKx++) { GetElemQuad(aVIndy[aKx],aVIndy[aKy]) -= A1 * aL2A[aKx] + B1 * aL2B[aKx] + C1 *aL2C[aKx]; } */ aY++; } } /* for (int aKy=0 ; aKy <int(aVIndy.size()) ; aKy++) { int aDebX = Sym ? aKy : 0; double A1 = aData1[aKy][0]; double B1 = aData1[aKy][1]; double C1 = aData1[aKy][2]; for (int aKx=aDebX ; aKx <int(aVIndy.size()) ; aKx++) { GetElemQuad(aVIndy[aKx],aVIndy[aKy]) -= A1 * aL2A[aKx] + B1 * aL2B[aKx] + C1 *aL2C[aKx]; } } */ // std::cout << "AV 333x3333\n"; }
void cGenSysSurResol::LVM_Mul(const tSysCho& aLambda,int aKx) { SetElemQuad(aKx,aKx,(1+aLambda)*GetElemQuad(aKx,aKx)); }
void cGenSysSurResol::LVM_Mul(const tSysCho& aLambda) { for (int aKx=0 ; aKx<NbVar(); aKx++) SetElemQuad(aKx,aKx,(1+aLambda)*GetElemQuad(aKx,aKx)); }