我正在尝试使用CUSP来使用GMRES方法求解复杂矩阵。
编译时,我收到一条错误消息: "没有合适的转换函数来自" cusp :: complex"到"漂浮"存在"
如果我去查看错误来自哪里,它会给我gmres.inl,第143行
resid[0] = s[0];
其中渣油和类型是
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;
为什么它告诉我浮动,当两者的类型都很复杂时?
代码:` //创建一个空的稀疏矩阵结构(CSR格式) 尖瓣:: csr_matrix,尖点:: device_memory&gt;一种;
// 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);//`