Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /* gsl_multilarge.h
0002  * 
0003  * Copyright (C) 2015 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_MULTILARGE_H__
0021 #define __GSL_MULTILARGE_H__
0022 
0023 #include <gsl/gsl_math.h>
0024 #include <gsl/gsl_vector.h>
0025 #include <gsl/gsl_matrix.h>
0026 #include <gsl/gsl_types.h>
0027 
0028 #undef __BEGIN_DECLS
0029 #undef __END_DECLS
0030 #ifdef __cplusplus
0031 # define __BEGIN_DECLS extern "C" {
0032 # define __END_DECLS }
0033 #else
0034 # define __BEGIN_DECLS /* empty */
0035 # define __END_DECLS /* empty */
0036 #endif
0037 
0038 __BEGIN_DECLS
0039 
0040 /* iteration solver type */
0041 typedef struct
0042 {
0043   const char *name;
0044   void * (*alloc) (const size_t p);
0045   int (*reset) (void *);
0046   int (*accumulate) (gsl_matrix * X, gsl_vector * y,
0047                      void *);
0048   int (*solve) (const double lambda, gsl_vector * c,
0049                 double * rnorm, double * snorm, void *);
0050   int (*rcond) (double * rcond, void *);
0051   int (*lcurve) (gsl_vector * reg_param, gsl_vector * rho,
0052                  gsl_vector * eta, void *);
0053   const gsl_matrix * (*matrix_ptr) (const void *);
0054   const gsl_vector * (*rhs_ptr) (const void *);
0055   void (*free) (void *);
0056 } gsl_multilarge_linear_type;
0057 
0058 typedef struct
0059 {
0060   const gsl_multilarge_linear_type * type;
0061   void * state;
0062   size_t p;
0063 } gsl_multilarge_linear_workspace;
0064 
0065 /* available types */
0066 GSL_VAR const gsl_multilarge_linear_type * gsl_multilarge_linear_normal;
0067 GSL_VAR const gsl_multilarge_linear_type * gsl_multilarge_linear_tsqr;
0068 
0069 /*
0070  * Prototypes
0071  */
0072 gsl_multilarge_linear_workspace *
0073 gsl_multilarge_linear_alloc(const gsl_multilarge_linear_type * T,
0074                             const size_t p);
0075 
0076 void gsl_multilarge_linear_free(gsl_multilarge_linear_workspace * w);
0077 
0078 const char *gsl_multilarge_linear_name(const gsl_multilarge_linear_workspace * w);
0079 
0080 int gsl_multilarge_linear_reset(gsl_multilarge_linear_workspace * w);
0081 
0082 int gsl_multilarge_linear_accumulate(gsl_matrix * X,
0083                                      gsl_vector * y,
0084                                      gsl_multilarge_linear_workspace * w);
0085 
0086 int gsl_multilarge_linear_solve(const double lambda, gsl_vector * c,
0087                                 double * rnorm, double * snorm,
0088                                 gsl_multilarge_linear_workspace * w);
0089 
0090 int gsl_multilarge_linear_rcond(double *rcond, gsl_multilarge_linear_workspace * w);
0091 
0092 int gsl_multilarge_linear_lcurve(gsl_vector * reg_param, gsl_vector * rho,
0093                                  gsl_vector * eta,
0094                                  gsl_multilarge_linear_workspace * w);
0095 
0096 int gsl_multilarge_linear_wstdform1 (const gsl_vector * L,
0097                                      const gsl_matrix * X,
0098                                      const gsl_vector * w,
0099                                      const gsl_vector * y,
0100                                      gsl_matrix * Xs,
0101                                      gsl_vector * ys,
0102                                      gsl_multilarge_linear_workspace * work);
0103 
0104 int gsl_multilarge_linear_stdform1 (const gsl_vector * L,
0105                                     const gsl_matrix * X,
0106                                     const gsl_vector * y,
0107                                     gsl_matrix * Xs,
0108                                     gsl_vector * ys,
0109                                     gsl_multilarge_linear_workspace * work);
0110 
0111 int gsl_multilarge_linear_L_decomp (gsl_matrix * L, gsl_vector * tau);
0112 
0113 int gsl_multilarge_linear_wstdform2 (const gsl_matrix * LQR,
0114                                      const gsl_vector * Ltau,
0115                                      const gsl_matrix * X,
0116                                      const gsl_vector * w,
0117                                      const gsl_vector * y,
0118                                      gsl_matrix * Xs,
0119                                      gsl_vector * ys,
0120                                      gsl_multilarge_linear_workspace * work);
0121 
0122 int gsl_multilarge_linear_stdform2 (const gsl_matrix * LQR,
0123                                     const gsl_vector * Ltau,
0124                                     const gsl_matrix * X,
0125                                     const gsl_vector * y,
0126                                     gsl_matrix * Xs,
0127                                     gsl_vector * ys,
0128                                     gsl_multilarge_linear_workspace * work);
0129 
0130 int gsl_multilarge_linear_genform1 (const gsl_vector * L,
0131                                     const gsl_vector * cs,
0132                                     gsl_vector * c,
0133                                     gsl_multilarge_linear_workspace * work);
0134 
0135 int gsl_multilarge_linear_genform2 (const gsl_matrix * LQR,
0136                                     const gsl_vector * Ltau,
0137                                     const gsl_vector * cs,
0138                                     gsl_vector * c,
0139                                     gsl_multilarge_linear_workspace * work);
0140 
0141 const gsl_matrix * gsl_multilarge_linear_matrix_ptr (const gsl_multilarge_linear_workspace * work);
0142 
0143 const gsl_vector * gsl_multilarge_linear_rhs_ptr (const gsl_multilarge_linear_workspace * work);
0144 
0145 __END_DECLS
0146 
0147 #endif /* __GSL_MULTILARGE_H__ */