yk-choi-yk / cusp-library

Automatically exported from code.google.com/p/cusp-library
Apache License 2.0
0 stars 0 forks source link

identity_operator constructor that takes MatrixType A #53

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In order to use the identity_operator as a preconditioner in something like this

template<typename PreconditionerType>
void solve() {
  cusp::csr_matrix<int,float,cusp::device_memory> A;
  PreconditionerType M(A);
  cusp::krylov::cg(A, x, b, monitor, M);
}

I found it necessary to add an identity_operator constructor like so

template<typename MatrixType>
identity_operator(const MatrixType& A)
: Parent(A.num_rows, A.num_cols) {}

regards,
Sam

Original issue reported on code.google.com by sam.mos...@gmail.com on 22 Nov 2010 at 12:48