1

I am trying to use CUSP to solve a complex matrix using the GMRES method.

When compiling, I get a error that says: "no suitable conversion function from "cusp::complex" to "float" exists"

and if I go see where the error comes from it gives me gmres.inl, line 143

resid[0] = s[0];

where resid and s type are

cusp::array1d<NormType,cusp::host_memory> resid(1);
cusp::array1d<ValueType,cusp::host_memory> s(R+1);
  typedef typename LinearOperator::value_type   ValueType;
  typedef typename LinearOperator::memory_space MemorySpace;
  typedef typename norm_type<ValueType>::type NormType;

Why is it telling me float, when the type of both is complex?

code:` // create an empty sparse matrix structure (CSR format) cusp::csr_matrix,cusp::device_memory>A;

// initialize matrix from file
    cusp::io::read_matrix_market_file(A, PATH);

// allocate storage for solution (x) and right hand side (b)
cusp::array1d<complex<float>, cusp::device_memory> x(A.num_rows, 0);
cusp::array1d<complex<float>, cusp::device_memory> b(A.num_rows, 1);
// set stopping criteria:
//  iteration_limit    = 100
//  relative_tolerance = 1e-6
cusp::verbose_monitor<complex<float>> monitor(b,10000, 1e-6);
int restart = 50;
// set preconditioner (identity)
cusp::identity_operator<complex<float>, cusp::device_memory> M(A.num_rows, A.num_rows);
// solve the linear system A x = b
cusp::krylov::gmres(A, x, b, restart, monitor,M);//`
user3812584
  • 73
  • 1
  • 5

0 Answers0