Program listing for file numerics/src/tools/lumod_wrapper.h

Program listing for file numerics/src/tools/lumod_wrapper.h#

 1#ifndef LUMOD_WRAPPER_H
 2#define LUMOD_WRAPPER_H
 3
 4#include "NumericsFwd.h"
 5#include "SiconosLapack.h"
 6#include "assert.h"
 7
 8#define SN_LUMOD_NEED_REFACTORIZATION 1
 9
10
11typedef struct {
12  unsigned n;
13  unsigned maxmod;
14  unsigned k;
15  double* LU_H;
16  lapack_int* ipiv_LU_H;
17  unsigned* factorized_basis;
18  int* row_col_indx;
19  double* Uk;
20  double* Yk;
21  double* L_C;
22  double* U_C;
23  double* y;
24  double* z;
25  double* w;
26} SN_lumod_dense_data;
27
28
29
30static inline unsigned SN_lumod_need_refactorization(int info) { return (info == SN_LUMOD_NEED_REFACTORIZATION ? 1 : 0); }
31
32static inline unsigned SN_lumod_find_arg_var(int* array, int p, unsigned n)
33{
34  for (unsigned i = 0; i < 2*n + 1; ++i)
35  {
36    if (array[i] == p) return i;
37  }
38  assert(0 && "We should not be here");
39  return 0;
40}
41
42SN_lumod_dense_data* SN_lumod_dense_allocate(unsigned n, unsigned maxmod);
43void SM_lumod_dense_free(SN_lumod_dense_data* lumod_data);
44int SN_lumod_dense_solve(SN_lumod_dense_data* lumod_data, double* x, double* col_tilde);
45void SN_lumod_add_row_col(SN_lumod_dense_data* lumod_data, unsigned leaving_indx, double* col);
46void SN_lumod_replace_col(SN_lumod_dense_data* lumod_data, unsigned index_col, double* col);
47void SN_lumod_replace_row(SN_lumod_dense_data* lumod_data, unsigned index_row, unsigned leaving_indx);
48void SN_lumod_delete_row_col(SN_lumod_dense_data* lumod_data, unsigned index_row, unsigned index_col);
49int SN_lumod_factorize(SN_lumod_dense_data* lumod_data, unsigned* basis, NumericsMatrix* M, double* covering_vector);
50
51#endif