The diagonal precondtioner just stores the inverse (if nonzero) of the diagonal of the matrix argument of the constructor. All matrix types are allowed. But off course, the preconditioner has to be built only when the the matrix is filled. If you need to declare the preconditioner before you fill the matrix, you can declare it without argument, then use P.build_with(SM) to build the preconditioner. For instance:
typedef gmm::row_matrix< gmm::wsvector<complex<double> > > mymatrixtype; mymatrixtype C(N2,N2); gmm::diagonal_precond<mymatrixtype> P(); // ... ... fill C // ... P.build_with(C); Sincerly, Yves. Le Jeudi 5 Octobre 2006 17:47, vous avez écrit : > I have an embarassingly simple question. In the user manual for gmm++ > there is the following: > > >>>>> gmm::diagonal_precond<matrix_type> P(SM) > > The question is what is SM? Is this the coefficient matrix from which the > diagonal is extracted? If my coefficient matrix is of type: > > >>>>> gmm::row_matrix< gmm::wsvector<complex<double> > > > > what matrix type should matrices P and SM be? > Hi: > > I am trying to solve a system of equations using iterative solver, QMR, in > particular. I have a problem with getting preconditioners. I tried the > following, where C(N2,N2) is the coefficient matrix: > > ********************** > gmm::row_matrix< gmm::wsvector<complex<double> > > C(N2,N2); > gmm::row_matrix<std::vector<std::complex<double> > > C1(N2,N2); > gmm::copy(C,C1); > gmm::diagonal_precond<gmm::row_matrix<std::vector<std::complex<double> > > > > P(C1); > > **************** > > This did not work owing to the large size of C1(N2,N2). What is > permissible for matrix_type in "gmm::diagonal_precond<matrix_type>? Note > that the I tried the following and it did not work: > > gmm::diagonal_precond<gmm::row_matrix<std::vector<std::complex<double> > > > > > P(C); > > Please help. It appears that matrix_type cannot be: > gmm::row_matrix< gmm::wsvector<complex<double> > > > > Sincerely, > -- Bwalya > Bwalya Malama, Ph.D. > Center for Geophysical Research of the Shallow Subsurface > Boise State University > Boise, Idaho > tel: 208-426-2959 > email: [EMAIL PROTECTED] > > _______________________________________________ > Getfem-users mailing list > [email protected] > https://mail.gna.org/listinfo/getfem-users -- ------------------------------------------------------------------------- Yves Renard ([EMAIL PROTECTED]) tel : (33) 04.72.43.80.11 Pole de Mathematiques, INSA de Lyon fax : (33) 04.72.43.85.29 Departement d'Informatique Institut Camille Jordan - UMR 5208 20, rue Albert Einstein 69621 Villeurbanne Cedex, FRANCE http://math.univ-lyon1.fr/~renard ------------------------------------------------------------------------- _______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users
