本文整理汇总了C++中MatrixView::upperTri方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixView::upperTri方法的具体用法?C++ MatrixView::upperTri怎么用?C++ MatrixView::upperTri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixView
的用法示例。
在下文中一共展示了MatrixView::upperTri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TMVAssert
void LUDiv<T>::doMakeInverseATA(MatrixView<T> ata) const
{
TMVAssert(ata.colsize() == pimpl->LUx.colsize());
TMVAssert(ata.rowsize() == pimpl->LUx.colsize());
// (At A)^-1 = A^-1 (A^-1)t
// = (U^-1 L^-1 Pt) (P L^-1t U^-1t)
// = U^-1 L^-1 L^-1t U^-1t
//
// if PLU is really AT, then
// A^-1 = P L^-1T U^-1T
// (At A)^-1 = P L^-1T U^-1T U^-1* L^-1* Pt
LowerTriMatrixView<T> L = pimpl->LUx.lowerTri(UnitDiag);
UpperTriMatrixView<T> U = pimpl->LUx.upperTri();
if (pimpl->istrans) {
UpperTriMatrixView<T> uinv = ata.upperTri();
uinv = U.inverse();
ata = uinv.transpose() * uinv.conjugate();
ata /= L.transpose();
ata %= L.conjugate();
ata.reversePermuteCols(pimpl->P.getValues());
ata.reversePermuteRows(pimpl->P.getValues());
} else {
LowerTriMatrixView<T> linv = ata.lowerTri(UnitDiag);
linv = L.inverse();
ata = linv * linv.adjoint();
ata /= U;
ata %= U.adjoint();
}
}
示例2: T
void SymBandSVDiv<T>::doMakeInverse(MatrixView<T1> minv) const
{
CallSymSV_Inverse(
T(),pimpl->U,pimpl->S,pimpl->Vt,pimpl->kmax,
SymMatrixViewOf(minv,Upper));
if (pimpl->S.size() > 1)
minv.lowerTri().offDiag() = minv.upperTri().offDiag().transpose();
}
示例3: LU_Inverse
void LU_Inverse(
const GenBandMatrix<T1>& LUx, const ptrdiff_t* p, MatrixView<T> minv)
{
TMVAssert(LUx.isSquare());
TMVAssert(minv.isSquare());
TMVAssert(minv.colsize() == LUx.colsize());
#ifdef XDEBUG
LowerTriMatrix<T,UnitDiag> L0(LUx.colsize());
LU_PackedPL_Unpack(LUx,p,L0.view());
UpperTriMatrix<T> U0 = BandMatrixViewOf(LUx,0,LUx.nhi());
Matrix<T> PLU = L0 * U0;
if (LUx.nlo() > 0) PLU.reversePermuteRows(p);
Matrix<T> minv2 = PLU.inverse();
#endif
if (minv.colsize() > 0) {
if ( !(minv.iscm() || minv.isrm())) {
Matrix<T,ColMajor> temp(minv.colsize(),minv.colsize());
LU_Inverse(LUx,p,temp.view());
minv = temp;
} else {
minv.setZero();
UpperTriMatrixView<T> U = minv.upperTri();
U = BandMatrixViewOf(LUx,0,LUx.nhi());
TriInverse(U,LUx.nhi());
LU_PackedPL_RDivEq(LUx,p,minv);
}
}
#ifdef XDEBUG
TMV_RealType(T) normdiff = Norm(PLU*minv - T(1));
TMV_RealType(T) kappa = Norm(PLU)*Norm(minv);
if (normdiff > 0.001*kappa*minv.colsize()) {
cerr<<"LUInverse:\n";
cerr<<"LUx = "<<LUx<<endl;
cerr<<"p = ";
for(ptrdiff_t i=0;i<LUx.colsize();i++) cerr<<p[i]<<" ";
cerr<<endl;
cerr<<"PLU = "<<PLU<<endl;
cerr<<"minv = "<<minv<<endl;
cerr<<"minv2 = "<<minv2<<endl;
cerr<<"m*minv = "<<PLU*minv<<endl;
cerr<<"minv*m = "<<minv*PLU<<endl;
cerr<<"Norm(m*minv - 1) = "<<normdiff<<endl;
cerr<<"kappa = "<<kappa<<endl;
abort();
}
#endif
}