Implementing generalized eigensolver
Hello!
I'm trying to implement a generalized eigensolver into AMGX (i.e. A*x=lambda*M*x). For now, I'm hacking it into SingleIteration_EigenSolver (power iteration method). I'm working on my own fork here. I have managed to enable access to both an A & M matrix in the class but any time I try to call a member function of the M matrix (e.g. m_M->currentView()), I get an invalid memory reference. The pointer is not null.
Any tips to help with this implementation would be greatly appreciated. Thanks!
Main question that need to be resolved is a distributed functionality. We keep single matrix and use it's row->process/neighbour mapping for all vectors that operate with this matrix (binding vector to a matrix). Distributed manager is assumed for a single matrix and is not stateless, so one need to consider how distributed operations would be carried out. There might be shortcuts if process mappings match, but that is separate limitation/assumption.
Briefly looked at your changes. I don't see example that uses new API and how matrix M is created.
Thank you so much for taking a look!
I'm using the C API right now. My main code uses the MFEM framework (github) so I have routines to generate AMGX_matrix_handle for A & M matrices. The MFEM wrapper includes some of the work originally by Chuang and Barba from AmgXWrapper so it should handle distributed memory. Unless I misunderstand your question.
To set the A & M matrices, I call my new AMGX_generalized_eigensolver_setup() here which should store pointers to the matrices.
My code is in C++ so I'm considering switching to the C++ API and treating it as a linear algebra library that I can use to implement the necessary algorithms outside of AmgX. It would mean I would have to do the memory management myself or use something like the AmgXWrapper. Unfortunately, the C API does not provide enough routines to implement the algorithms I'm interested in without upload/download all the time.