80 lines
3.8 KiB
C++
80 lines
3.8 KiB
C++
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
|
/* ******** *** SparseLib++ */
|
|
/* ******* ** *** *** *** v. 1.5c */
|
|
/* ***** *** ******** ******** */
|
|
/* ***** *** ******** ******** R. Pozo */
|
|
/* ** ******* *** ** *** *** K. Remington */
|
|
/* ******** ******** A. Lumsdaine */
|
|
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
|
/* */
|
|
/* */
|
|
/* SparseLib++ : Sparse Matrix Library */
|
|
/* */
|
|
/* National Institute of Standards and Technology */
|
|
/* University of Notre Dame */
|
|
/* Authors: R. Pozo, K. Remington, A. Lumsdaine */
|
|
/* */
|
|
/* NOTICE */
|
|
/* */
|
|
/* Permission to use, copy, modify, and distribute this software and */
|
|
/* its documentation for any purpose and without fee is hereby granted */
|
|
/* provided that the above notice appear in all copies and supporting */
|
|
/* documentation. */
|
|
/* */
|
|
/* Neither the Institutions (National Institute of Standards and Technology, */
|
|
/* University of Notre Dame) nor the Authors make any representations about */
|
|
/* the suitability of this software for any purpose. This software is */
|
|
/* provided ``as is'' without expressed or implied warranty. */
|
|
/* */
|
|
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
|
|
|
// modification GR
|
|
// 1) on utilise une interface unique pour tous les préconditionneurs
|
|
// d'où l'héritage d'une classe virtuelle
|
|
// 2) on utilise sytématiquement les classes templates MV++
|
|
// 3) introduction des matrices carrées et des matrices bandes
|
|
|
|
#ifndef DIAGPRE_GR_H
|
|
#define DIAGPRE_GR_H
|
|
|
|
//#include "vecdefs.h"
|
|
#include "vecdefs_GR.h" // modif GR
|
|
//#include VECTOR_H
|
|
|
|
#include "comprow_double.h"
|
|
#include "compcol_double.h"
|
|
|
|
#include "pre_cond_double.h"
|
|
#include "Mat_abstraite.h"
|
|
|
|
class DiagPreconditioner_double : public Pre_cond_double
|
|
{
|
|
|
|
private:
|
|
VECTOR_double diag_;
|
|
|
|
public:
|
|
DiagPreconditioner_double (const CompCol_Mat_double &);
|
|
DiagPreconditioner_double (const CompRow_Mat_double &);
|
|
// cas d'une matrice abstraite
|
|
DiagPreconditioner_double(const Mat_abstraite &A);
|
|
~DiagPreconditioner_double (void) { };
|
|
|
|
// méthodes-------
|
|
|
|
VECTOR_double solve (const VECTOR_double &x) const;
|
|
VECTOR_double trans_solve (const VECTOR_double &x) const;
|
|
|
|
protected : // modif GR : les deux fonctions suivantes ne sont pas génériques
|
|
// d'où le status protected
|
|
const double& diag(int i) const { return diag_(i); }
|
|
double& diag(int i) { return diag_(i); }
|
|
|
|
// modif GR : cette fonction est interne, elle n'avait pas de prototype !!
|
|
int CopyInvDiagonals(int n, const int *pntr, const int *indx,
|
|
const double *sa, double *diag);
|
|
// surcharge de la fonction pour les matrices autres que celle sparse
|
|
int CopyInvDiagonals(const Mat_abstraite& A);
|
|
};
|
|
|
|
#endif
|