1

我正在尝试使用 CUSP 使用 GMRES 方法求解复杂矩阵。

编译时,我收到一条错误消息:“不存在从“cusp::complex”到“float”的合适转换函数”

如果我去看看错误来自哪里,它会给我 gmres.inl,第 143 行

resid[0] = s[0];

resid 和 s 类型在哪里

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;

当两者的类型都很复杂时,为什么它告诉我浮动?

code:` // 创建一个空的稀疏矩阵结构(CSR 格式) 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);//`
4

0 回答 0