本文整理汇总了C++中DiagonalMatrix::LogDeterminant方法的典型用法代码示例。如果您正苦于以下问题:C++ DiagonalMatrix::LogDeterminant方法的具体用法?C++ DiagonalMatrix::LogDeterminant怎么用?C++ DiagonalMatrix::LogDeterminant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiagonalMatrix
的用法示例。
在下文中一共展示了DiagonalMatrix::LogDeterminant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trymate
//.........这里部分代码省略.........
Clean(D,0.000000001);
Print(D);
EigenValues(S2, D, V);
CheckIsSorted(D, true);
V = S2 - V * D * V.t();
Clean(V,0.000000001);
Print(V);
for (i=2; i<=21; i++) D(i) -= (i-1)*i;
Clean(D,0.000000001);
Print(D);
EigenValues(S1, D);
CheckIsSorted(D, true);
for (i=1; i<=20; i++) D(i) -= (i+1)*i;
Clean(D,0.000000001);
Print(D);
EigenValues(S2, D);
CheckIsSorted(D, true);
for (i=2; i<=21; i++) D(i) -= (i-1)*i;
Clean(D,0.000000001);
Print(D);
}
{
Tracer et1("Stage 3");
Matrix A(30,30);
int i,j;
for (i=1; i<=30; i++) for (j=1; j<=30; j++)
{
if (i>j) A(i,j) = 0;
else if (i==j) A(i,j) = 1;
else A(i,j) = -1;
}
Real d1 = A.LogDeterminant().Value();
DiagonalMatrix D;
Matrix U;
Matrix V;
DiagonalMatrix I(A.Ncols());
I=1.0;
SVD(A,D,U,V);
CheckIsSorted(D);
Matrix SU = U.t() * U - I;
Clean(SU,0.000000001);
Print(SU);
Matrix SV = V.t() * V - I;
Clean(SV,0.000000001);
Print(SV);
Real d2 = D.LogDeterminant().Value();
Matrix B = U * D * V.t() - A;
Clean(B,0.000000001);
Print(B);
Real d3 = D.LogDeterminant().Value();
ColumnVector Test(3);
Test(1) = d1 - 1;
Test(2) = d2 - 1;
Test(3) = d3 - 1;
Clean(Test,0.00000001);
Print(Test); // only 8 decimal figures
A.ReSize(2,2);
Real a = 1.5;
Real b = 2;
Real c = 2 * (a*a + b*b);
A << a << b << a << b;
I.ReSize(2);
I=1;
SVD(A,D,U,V);