-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Error] inverse-iteration #606
Comments
Hi, thanks for the issue indeed we can easily reproduce this. We will fix this ASAP. |
And I don't know if This example can run on CudaExecutor? |
Hello @nghiakvnvsd, diff --git a/examples/inverse-iteration/inverse-iteration.cpp b/examples/inverse-iteration/inverse-iteration.cpp
index 856483bfb..5be92f905 100644
--- a/examples/inverse-iteration/inverse-iteration.cpp
+++ b/examples/inverse-iteration/inverse-iteration.cpp
@@ -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>;
@@ -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);
auto g = clone(one);
@@ -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)); And yes, this should also run with the CudaExecutor (to be sure, I am currently running tests for that). |
@nghiakvnvsd Can confirm that the fix also works on the CudaExecutor (should also work on HIP, but currently not when compiling for both HIP and CUDA at the same time, see PR #602 for a solution there). |
Thank you so much!!! |
I have a question about eigenvalues and eigenvectors. While searching ideas, I saw the topic: #135 . I know you guys developing it but I don't know if it is finished. I'm looking forward it because it is very useful for scientists. Thank you! |
Hello everyone!
When I ran the inverse-iteration example, it reports: Operation gko::as<gko::matrix::Dense> does not support parameters of type gko::matrix::Dense<std::complex >. I have no idea about it. May you help me?
Thank you!
The text was updated successfully, but these errors were encountered: