Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:03:54

0001 /* gsl_splinalg.h
0002  * 
0003  * Copyright (C) 2012-2014 Patrick Alken
0004  * 
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 3 of the License, or (at
0008  * your option) any later version.
0009  * 
0010  * This program is distributed in the hope that it will be useful, but
0011  * WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * General Public License for more details.
0014  * 
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef __GSL_SPLINALG_H__
0021 #define __GSL_SPLINALG_H__
0022 
0023 #include <gsl/gsl_math.h>
0024 #include <gsl/gsl_vector.h>
0025 #include <gsl/gsl_matrix.h>
0026 #include <gsl/gsl_spmatrix.h>
0027 #include <gsl/gsl_linalg.h>
0028 #include <gsl/gsl_types.h>
0029 
0030 #undef __BEGIN_DECLS
0031 #undef __END_DECLS
0032 #ifdef __cplusplus
0033 # define __BEGIN_DECLS extern "C" {
0034 # define __END_DECLS }
0035 #else
0036 # define __BEGIN_DECLS /* empty */
0037 # define __END_DECLS /* empty */
0038 #endif
0039 
0040 __BEGIN_DECLS
0041 
0042 /* iteration solver type */
0043 typedef struct
0044 {
0045   const char *name;
0046   void * (*alloc) (const size_t n, const size_t m);
0047   int (*iterate) (const gsl_spmatrix *A, const gsl_vector *b,
0048                   const double tol, gsl_vector *x, void *);
0049   double (*normr)(const void *);
0050   void (*free) (void *);
0051 } gsl_splinalg_itersolve_type;
0052 
0053 typedef struct
0054 {
0055   const gsl_splinalg_itersolve_type * type;
0056   double normr; /* current residual norm || b - A x || */
0057   void * state;
0058 } gsl_splinalg_itersolve;
0059 
0060 /* available types */
0061 GSL_VAR const gsl_splinalg_itersolve_type * gsl_splinalg_itersolve_gmres;
0062 
0063 /*
0064  * Prototypes
0065  */
0066 gsl_splinalg_itersolve *
0067 gsl_splinalg_itersolve_alloc(const gsl_splinalg_itersolve_type *T,
0068                              const size_t n, const size_t m);
0069 void gsl_splinalg_itersolve_free(gsl_splinalg_itersolve *w);
0070 const char *gsl_splinalg_itersolve_name(const gsl_splinalg_itersolve *w);
0071 int gsl_splinalg_itersolve_iterate(const gsl_spmatrix *A,
0072                                    const gsl_vector *b,
0073                                    const double tol, gsl_vector *x,
0074                                    gsl_splinalg_itersolve *w);
0075 double gsl_splinalg_itersolve_normr(const gsl_splinalg_itersolve *w);
0076 
0077 __END_DECLS
0078 
0079 #endif /* __GSL_SPLINALG_H__ */