00001
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _GAN_PSEUDO_INVERSE_H
00030 #define _GAN_PSEUDO_INVERSE_H
00031
00032 #include <gandalf/linalg/vec_gen.h>
00033 #include <gandalf/linalg/mat_gen.h>
00034 #include <gandalf/linalg/mat_square.h>
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00060
00061
00062 typedef struct
00063 {
00064 Gan_SquMatrix SaaT;
00065 Gan_Matrix SabT;
00068 Gan_SquMatrix L;
00069 Gan_Matrix X;
00071
00072 Gan_Bool solved;
00073
00075 Gan_Vector a, b;
00076
00078 Gan_Matrix *C, *D;
00079
00081 int null_space;
00082
00084 double ratio_thres;
00085
00087 int low_values_allowed;
00088
00090 Gan_Matrix *U;
00091
00093 Gan_Vector *null_vector;
00094
00096 Gan_Bool alloc;
00097 } Gan_PseudoInverseStruct;
00098
00099 Gan_PseudoInverseStruct *gan_pseudoinv_form ( Gan_PseudoInverseStruct *psi,
00100 long max_asize,
00101 long max_bsize );
00102
00116 Gan_PseudoInverseStruct *gan_pseudoinv_alloc ( long max_asize,
00117 long max_bsize );
00118
00119 void gan_pseudoinv_free ( Gan_PseudoInverseStruct *pis );
00120 Gan_Bool gan_pseudoinv_reset ( Gan_PseudoInverseStruct *pis,
00121 long asize, long bsize );
00122 Gan_Bool gan_pseudoinv_increment ( Gan_PseudoInverseStruct *pis,
00123 double scale, ... );
00124 Gan_Bool gan_pseudoinv_decrement ( Gan_PseudoInverseStruct *pis,
00125 double scale, ... );
00126 Gan_Bool gan_pseudoinv_set_constraint ( Gan_PseudoInverseStruct *pis,
00127 Gan_Matrix *C, Gan_Matrix *D );
00128 Gan_Bool gan_pseudoinv_set_null_space ( Gan_PseudoInverseStruct *pis,
00129 int null_space );
00130 Gan_Bool gan_pseudoinv_set_ratio_thres ( Gan_PseudoInverseStruct *pis,
00131 double ratio_thres );
00132 Gan_Bool gan_pseudoinv_set_low_values_allowed ( Gan_PseudoInverseStruct *pis,
00133 int low_values_allowed );
00134 Gan_Bool gan_pseudoinv_solve ( Gan_PseudoInverseStruct *pis, int *error_code );
00135 Gan_Matrix *
00136 gan_pseudoinv_get_solution ( Gan_PseudoInverseStruct *pis );
00137 Gan_Vector *
00138 gan_pseudoinv_get_null_vector ( Gan_PseudoInverseStruct *pis );
00139
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159
00160 #endif