本文整理汇总了C++中parameters::get_bool方法的典型用法代码示例。如果您正苦于以下问题:C++ parameters::get_bool方法的具体用法?C++ parameters::get_bool怎么用?C++ parameters::get_bool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parameters
的用法示例。
在下文中一共展示了parameters::get_bool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: diagonalize_bisection
parameters diagonalize_bisection(localized_matrix<double, MATRIX_MAJOR>& mat, double* eigvals,
localized_matrix<double, MATRIX_MAJOR>& eigvecs,
parameters const& params) {
rokko::parameters params_out;
char jobz = 'V'; // eigenvalues / eigenvectors
int dim = mat.outerSize();
int ldim_mat = mat.innerSize();
int ldim_eigvec = eigvecs.innerSize();
std::vector<lapack_int> ifail(dim);
lapack_int m; // output: found eigenvalues
double abstol;
get_key(params, "abstol", abstol);
if (abstol < 0) {
std::cerr << "Error in diagonalize_bisection" << std::endl
<< "abstol is negative value, which means QR method." << std::endl
<< "To use dsyevx as bisection solver, set abstol a positive value" << std::endl;
throw;
}
if (!params.defined("abstol")) { // default: optimal value for bisection method
abstol = 2 * LAPACKE_dlamch('S');
}
params_out.set("abstol", abstol);
char uplow = get_matrix_part(params);
lapack_int il, iu;
double vl, vu;
char range = get_eigenvalues_range(params, vl, vu, il, iu);
int info;
if(mat.is_col_major())
info = LAPACKE_dsyevx(LAPACK_COL_MAJOR, jobz, range, uplow, dim, &mat(0,0), ldim_mat, vl, vu, il, iu, abstol, &m, eigvals, &eigvecs(0,0), ldim_eigvec, &ifail[0]);
else
info = LAPACKE_dsyevx(LAPACK_ROW_MAJOR, jobz, range, uplow, dim, &mat(0,0), ldim_mat, vl, vu, il, iu, abstol, &m, eigvals, &eigvecs(0,0), ldim_eigvec, &ifail[0]);
if (info) {
std::cerr << "Error at dsyevx function. info=" << info << std::endl;
if (params.get_bool("verbose")) {
std::cerr << "This means that ";
if (info < 0) {
std::cerr << "the " << abs(info) << "-th argument had an illegal value." << std::endl;
} else {
std::cerr << "This means that " << info << " eigenvectors failed to converge." << std::endl;
std::cerr << "The indices of the eigenvectors that failed to converge:" << std::endl;
for (int i=0; i<ifail.size(); ++i) {
if (ifail[i] == 0) break;
std::cerr << ifail[i] << " ";
}
std::cerr << std::endl;
}
}
exit(1);
}
params_out.set("m", m);
params_out.set("ifail", ifail);
if (params.get_bool("verbose")) {
print_verbose("dsyevx (bisecition)", jobz, range, uplow, vl, vu, il, iu, params_out);
}
return params_out;
}