Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix norm-issue in inverse-iteration example
  • Loading branch information
Thomas Grützmacher committed Aug 11, 2020
commit 8fcb07ebd540d4affa4387efd73ab3c5d9f8ed6a
7 changes: 4 additions & 3 deletions examples/inverse-iteration/inverse-iteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ int main(int argc, char *argv[])
{
// Some shortcuts
using precision = std::complex<double>;
using real_precision = double;
using real_precision = gko::remove_complex<precision>;
using vec = gko::matrix::Dense<precision>;
using real_vec = gko::matrix::Dense<real_precision>;
using mtx = gko::matrix::Csr<precision>;
using solver_type = gko::solver::Bicgstab<precision>;

Expand Down Expand Up @@ -126,7 +127,7 @@ int main(int argc, char *argv[])
}();
auto y = clone(x);
auto tmp = clone(x);
auto norm = clone(one);
auto norm = gko::share(gko::initialize<real_vec>({1.0}, exec));
auto inv_norm = clone(this_exec, one);
Comment thread
pratikvn marked this conversation as resolved.
auto g = clone(one);

Expand All @@ -142,7 +143,7 @@ int main(int argc, char *argv[])
// x = y / || y ||
x->compute_norm2(lend(norm));
inv_norm->get_values()[0] =
precision{1.0} / clone(this_exec, norm)->get_values()[0];
real_precision{1.0} / clone(this_exec, norm)->get_values()[0];
x->scale(lend(clone(exec, inv_norm)));
// g = x^* A x
A->apply(lend(x), lend(tmp));
Expand Down