本文整理汇总了C++中LocalVector::PermuteBackward方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalVector::PermuteBackward方法的具体用法?C++ LocalVector::PermuteBackward怎么用?C++ LocalVector::PermuteBackward使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalVector
的用法示例。
在下文中一共展示了LocalVector::PermuteBackward方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
if (argc == 1) {
std::cerr << argv[0] << " <matrix> [Num threads]" << std::endl;
exit(1);
}
init_paralution();
if (argc > 2) {
set_omp_threads_paralution(atoi(argv[2]));
}
info_paralution();
LocalVector<double> x;
LocalVector<double> rhs;
LocalMatrix<double> mat;
mat.ReadFileMTX(std::string(argv[1]));
// Compute and apply (R)CMK ordering
LocalVector<int> cmk;
// mat.CMK(&cmk);
mat.RCMK(&cmk);
mat.Permute(cmk);
mat.MoveToAccelerator();
x.MoveToAccelerator();
rhs.MoveToAccelerator();
x.Allocate("x", mat.get_nrow());
rhs.Allocate("rhs", mat.get_nrow());
// Linear Solver
CG<LocalMatrix<double>, LocalVector<double>, double > ls;
// Preconditioner
ILU<LocalMatrix<double>, LocalVector<double>, double > p;
double tick, tack;
rhs.Ones();
x.Zeros();
ls.SetOperator(mat);
ls.SetPreconditioner(p);
ls.Build();
mat.info();
tick = paralution_time();
ls.Solve(rhs, &x);
tack = paralution_time();
std::cout << "Solver execution:" << (tack-tick)/1000000 << " sec" << std::endl;
// Revert CMK ordering on solution vector
x.PermuteBackward(cmk);
stop_paralution();
return 0;
}