本文整理汇总了C++中TMatrix::madd方法的典型用法代码示例。如果您正苦于以下问题:C++ TMatrix::madd方法的具体用法?C++ TMatrix::madd怎么用?C++ TMatrix::madd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMatrix
的用法示例。
在下文中一共展示了TMatrix::madd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StepFrom
//---------------------------------------------------------------------------
void MAT_SMOOTH::StepFrom(TMatrix &newX, TMatrix &newQ,
TMatrix &curX, TMatrix &curQ,
TMatrix &oldX, TMatrix &oldQ)
{
long double d;
QT1 = curQ;
d = QT1.Inverse();
while(d==0)
{
printf("4 \n");
QT1.addDiag(1e-5);
QT1.Inverse();
}
H.mmul(U_1, QT1);
H.addDiag(1.);
d = H.Inverse();
while(d==0)
{
printf("5 \n");
H.addDiag(1e-5);
H.Inverse();
}
XT1.mmul(A, oldX);
XT2.msub(XT1, curX);
XT3.mmul(H, XT2);
newX.madd(curX, XT3);
QT1.mmul(A, oldQ);
QT2.mmul(QT1, AT);
QT1.mtra(H);
QT3.mmul(QT2, QT1);
QT1.madd(QT3, U_1);
newQ.mmul(H, QT1);
}
示例2: Merge
//---------------------------------------------------------------------------
void TSmoothVect::Merge(TMatrix &newX, TMatrix &newQ,
TMatrix &leftX, TMatrix &leftQ,
TMatrix &curX, TMatrix &curQ,
TMatrix &rightX, TMatrix &rightQ)
{
long double d;
// ^<-> ~<- 0 ~->
// Q = Q + Q + Q
// i i-1 i i+1
newQ=curQ; newQ.madd(leftQ); newQ.madd(rightQ);
// ^<-> /^<-> \-1 / ~<- ~<- 0 0 ~-> ~-> \
// X = |Q | | Q X + Q X + Q X |
// i \ i / \ i-1 i-1 i i i+1 i+1 /
// ----1----
// ---------------2-----------------
// ----------------------3---------------------------
//1
Tmp1=newQ; d = Tmp1.Inverse();
while(d==0)
{
printf("Error of inversing 3 \n");
getchar();
}
//2
TmpV1.mmul(leftQ,leftX);
TmpV2.mmul(curQ,curX);
TmpV1.madd(TmpV2);
TmpV2.mmul(rightQ,rightX);
TmpV1.madd(TmpV2);
//3
newX.mmul(Tmp1,TmpV1);
}
示例3: StepTo
//---------------------------------------------------------------------------
void MAT_SMOOTH::StepTo(TMatrix &newX, TMatrix &newQ,
TMatrix &curX, TMatrix &curQ,
TMatrix &oldX, TMatrix &oldQ)
{
long double d;
QT1.madd(oldQ, U_1);
d = QT1.Inverse();
while(d==0)
{
printf("1 \n");
QT1.addDiag(1e-5);
QT1.Inverse();
}
QT2.mmul(AT, QT1);
QT3.mmul(QT2, A);
QT1 = curQ;
d = QT1.Inverse();
while(d==0)
{
printf("2 \n");
QT1.addDiag(1e-5);
d = QT1.Inverse();
}
newQ.madd(QT1, QT3);
XT1.mmul(QT1, curX);
XT2.mmul(QT2, oldX);
XT3.madd(XT1, XT2);
d = newQ.Inverse();
while(d==0)
{
printf("3 \n");
newQ.addDiag(1e-5);
newQ.Inverse();
}
newX.mmul(newQ, XT3);
};
示例4: StepFrom
void TSmoothVect::StepFrom(TMatrix &newX, TMatrix &newQ,
TMatrix &curX, TMatrix &curQ,
TMatrix &oldX, TMatrix &oldQ, float norma)
{
long double d;
H.mmul(U_1, curQ); /*H*=1/norma;*/
H.addDiag(1.);
d = H.Inverse();
while(d==0)
{
printf("Error of inversing 4 \n");
getchar();
}
XT1.msub(oldX,curX);
XT2.mmul(H, XT1);
newX.madd(curX, XT2);
QT1=oldQ;
d = QT1.Inverse();
while(d==0)
{
printf("Error of inversing 5 \n");
getchar();
}
QT2.mtra(H);
QT3.mmul(QT1, QT2);
QT3.madd(U_1); /* M1=U_1; M1*=1/norma; QT3.madd(M1);*/
newQ.mmul(H, QT3);
d = newQ.Inverse();
while(d==0)
{
printf("Error of inversing 6 \n");
getchar();
}
}
示例5: StepTo
//---------------------------------------------------------------------------
void TSmoothVect::StepTo(TMatrix &newX, TMatrix &newQ,
TMatrix &curX, TMatrix &curQ,
TMatrix &oldX, TMatrix &oldQ, float norma)
{
long double d;
// ~ 0 ~ ~ -1
// Q = Q + Q (Q + U ) U
// i i i-1 i-1 i i
// -----1-----
// --------2----------
// -------------3---------------
// 1
Tmp1.madd(oldQ,U); /* M1=U; M1*=norma; Tmp1.madd(oldQ,M1);*/
d=Tmp1.Inverse();
while(d==0)
{
printf("Error of inversing 1 \n");
getchar();
}
// 2
Tmp2.mmul(oldQ,Tmp1);
Tmp1.mmul(Tmp2,U); /* Tmp1*=norma;*/
// 3
newQ.madd(curQ,Tmp1);
// ~ -1 / 0 0 ~ ~ -1 ~ \
// Q |Q X + Q (Q + U ) U X |
// i \ i i i-1 i-1 i i i-1/
// --1-- --2-- -------------3-----------
// ---------------4-----------------
// -------------------5-------------------
// 1
Tmp2=newQ;
if (Tmp2.Inverse() != 0 || 1) {
// 2
TmpV1.mmul(curQ,curX);
// 3
TmpV2.mmul(Tmp1,oldX);
// 4
TmpV1.madd(TmpV2);
newX.mmul(Tmp2,TmpV1);
}
else {
// see documentation
V1.mmul(Tmp1,oldX);
V2.mmul(curQ,curX);
V1.madd(V2);
//M1=newQ; M1.Inverse();
//V1.mmul(M1,V2);
M1=newQ; M1.Transpose();
V2.mmul(M1,V1);
//Y=curX; V1=Y; V1*=1e-10; V2.madd(V1);
M2.mmul(M1,newQ);
//M2.addDiag(1e-10);
if( M2.Inverse()==0){
printf("Error of inversing 2\n");
getchar();
}
newX.mmul(M2,V2);
}
};