本文整理汇总了C++中MatrixView::iscm方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixView::iscm方法的具体用法?C++ MatrixView::iscm怎么用?C++ MatrixView::iscm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixView
的用法示例。
在下文中一共展示了MatrixView::iscm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LAPV
template <> void LapHessenberg(
MatrixView<double> A, VectorView<double> Ubeta)
{
TMVAssert(A.iscm());
TMVAssert(A.colsize() == A.rowsize());
TMVAssert(Ubeta.size() == A.rowsize()-1);
TMVAssert(A.ct()==NonConj);
int n = A.rowsize();
int ilo = 1;
int ihi = n;
int lda = A.stepj();
int Lap_info=0;
#ifndef LAPNOWORK
int lwork = n*LAP_BLOCKSIZE;
double* work = LAP_DWork(lwork);
#endif
LAPNAME(dgehrd) (
LAPCM LAPV(n),LAPV(ilo),LAPV(ihi),
LAPP(A.ptr()),LAPV(lda),LAPP(Ubeta.ptr())
LAPWK(work) LAPVWK(lwork) LAPINFO);
#ifdef LAPNOWORK
LAP_Results(Lap_info,"dgehrd");
#else
LAP_Results(Lap_info,int(work[0]),m,n,lwork,"dgehrd");
#endif
}
示例2: NonBlockHessenberg
static void NonBlockHessenberg(
MatrixView<T> A, VectorView<T> Ubeta)
{
#ifdef XDEBUG
cout<<"Start NonBlock Hessenberg Reduction: A = "<<A<<endl;
Matrix<T> A0(A);
#endif
// Decompose A into U H Ut
// H is a Hessenberg Matrix
// U is a Unitary Matrix
// On output, H is stored in the upper-Hessenberg part of A
// U is stored in compact form in the rest of A along with
// the vector Ubeta.
const ptrdiff_t N = A.rowsize();
TMVAssert(A.colsize() == A.rowsize());
TMVAssert(N > 0);
TMVAssert(Ubeta.size() == N-1);
TMVAssert(A.iscm() || A.isrm());
TMVAssert(!Ubeta.isconj());
TMVAssert(Ubeta.step()==1);
// We use Householder reflections to reduce A to the Hessenberg form:
T* Uj = Ubeta.ptr();
T det = 0; // Ignore Householder det calculations
for(ptrdiff_t j=0;j<N-1;++j,++Uj) {
#ifdef TMVFLDEBUG
TMVAssert(Uj >= Ubeta._first);
TMVAssert(Uj < Ubeta._last);
#endif
*Uj = Householder_Reflect(A.subMatrix(j+1,N,j,N),det);
if (*Uj != T(0))
Householder_LMult(A.col(j+2,N),*Uj,A.subMatrix(0,N,j+1,N).adjoint());
}
#ifdef XDEBUG
Matrix<T> U(N,N,T(0));
U.subMatrix(1,N,1,N) = A.subMatrix(1,N,0,N-1);
U.upperTri().setZero();
Vector<T> Ubeta2(N);
Ubeta2.subVector(1,N) = Ubeta;
Ubeta2(0) = T(0);
GetQFromQR(U.view(),Ubeta2);
Matrix<T> H = A;
if (N>2) LowerTriMatrixViewOf(H).offDiag(2).setZero();
Matrix<T> AA = U*H*U.adjoint();
if (Norm(A0-AA) > 0.001*Norm(A0)) {
cerr<<"NonBlock Hessenberg: A = "<<Type(A)<<" "<<A0<<endl;
cerr<<"A = "<<A<<endl;
cerr<<"Ubeta = "<<Ubeta<<endl;
cerr<<"U = "<<U<<endl;
cerr<<"H = "<<H<<endl;
cerr<<"UHUt = "<<AA<<endl;
abort();
}
#endif
}
示例3: Hessenberg
static inline void Hessenberg(
MatrixView<T> A, VectorView<T> Ubeta)
{
TMVAssert(A.colsize() == A.rowsize());
TMVAssert(Ubeta.size() == A.rowsize()-1);
TMVAssert(A.isrm() || A.iscm());
TMVAssert(A.ct()==NonConj);
TMVAssert(Ubeta.step() == 1);
if (A.rowsize() > 0) {
#ifdef LAP
if (A.iscm())
LapHessenberg(A,Ubeta);
else
#endif
NonLapHessenberg(A,Ubeta);
}
}
示例4: 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
}