本文整理汇总了C++中Permutation::invert_permute_vector方法的典型用法代码示例。如果您正苦于以下问题:C++ Permutation::invert_permute_vector方法的具体用法?C++ Permutation::invert_permute_vector怎么用?C++ Permutation::invert_permute_vector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permutation
的用法示例。
在下文中一共展示了Permutation::invert_permute_vector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solve
bool SystemSolver_FASTCG::solve(const SparseMatrix& A_in, Vector& x_in, const Vector& b_in) {
typedef double CoeffType ;
typedef Array1d<CoeffType> VectorType ;
typedef SparseMatrixBCRS<CoeffType, 2, 2> MatrixType ;
unsigned int N0 = A_in.n() ;
std::cerr << "N0 = " << N0 << std::endl ;
Permutation permutation;
compute_permutation(A_in, permutation) ;
MatrixType A ;
::OGF::convert_matrix(A_in, A, permutation) ;
// ::OGF::compress_indices(A) ;
std::cerr << "filling ratio:" << (A.filling_ratio() * 100.0) << "%" << std::endl ;
if(false) {
std::cerr << "Saving matrix to disk (matrix.dat)" << std::endl ;
std::ofstream out("matrix.dat") ;
// A.print(out) ;
::OGF::output_matrix(A, out) ;
}
unsigned int N = A.n() ; // Can be greater than N0 due to blocking
N = QuickBLAS::aligned_size(N, sizeof(CoeffType)) ;
std::cerr <<"N = " << N << std::endl ;
int max_iter = (nb_iters_ == 0) ? 5 * N : nb_iters_ ;
double eps = threshold_ ;
std::cerr << "nb iters = " << max_iter << " threshold = " << eps << std::endl ;
VectorType b(N, alignment_for_SSE2) ;
VectorType x(N, alignment_for_SSE2) ;
permutation.invert_permute_vector(b_in, b) ;
permutation.invert_permute_vector(x_in, x) ;
solve_cg(A, x, b, eps, max_iter) ;
permutation.permute_vector(x, x_in) ;
return true ;
}