accelerInt  v0.1
rational_approximant.c
Go to the documentation of this file.
1 
11 //cf
12 #include "header.h"
13 #include "cf.h"
14 #include "solver_options.h"
15 #include <complex.h>
16 
17 double complex poles[N_RA];
18 double complex res[N_RA];
19 
24 {
25  // get poles and residues for rational approximant to matrix exponential
26  double *poles_r = (double *) calloc (N_RA, sizeof(double));
27  double *poles_i = (double *) calloc (N_RA, sizeof(double));
28  double *res_r = (double *) calloc (N_RA, sizeof(double));
29  double *res_i = (double *) calloc (N_RA, sizeof(double));
30 
31  cf (N_RA, poles_r, poles_i, res_r, res_i);
32 
33  for (int i = 0; i < N_RA; ++i)
34  {
35  poles[i] = poles_r[i] + poles_i[i] * _Complex_I;
36  res[i] = res_r[i] + res_i[i] * _Complex_I;
37  }
38 
39  // free memory
40  free (poles_r);
41  free (poles_i);
42  free (res_r);
43  free (res_i);
44 }
An example header file that defines system size and other required methods for integration of the van...
void cf(int n, double *poles_r, double *poles_i, double *res_r, double *res_i)
Function that calculates the poles and residuals of best rational (partial fraction) approximant to t...
Definition: cf.c:41
#define N_RA
A file generated by Scons that specifies various options to the solvers.
double complex res[N_RA]
void find_poles_and_residuals()
get poles and residues for rational approximant to matrix exponential
double complex poles[N_RA]
Header definition for rational approximation to matrix exponential.