ld_fisher.c
Go to the documentation of this file.
1 #include <libgen.h>
2 #include <math.h>
3 
4 #include <options/options.h>
5 #include "../csm/csm_all.h"
6 
7 
9  double sigma;
10 };
11 
12 val ld_fisher0(LDP ld);
13 
14 int main(int argc, const char * argv[]) {
15  sm_set_program_name(argv[0]);
16 
17  struct ld_fisher_params p;
18 
19  struct option* ops = options_allocate(3);
20  options_double(ops, "sigma", &p.sigma, 0.01,
21  "Std deviation of gaussian noise");
22 
23  if(!options_parse_args(ops, argc, argv)) {
24  fprintf(stderr, "Writes Fisher's information matrix.\n\nUsage:\n");
25  options_print_help(ops, stderr);
26  return -1;
27  }
28 
29  egsl_push();
30 
31  LDP ld;
32  while( (ld = ld_from_json_stream(stdin))) {
33  egsl_push();
34  val fisher = egsl_scale( square(p.sigma), ld_fisher0(ld) );
35 
36  JO jo = matrix_to_json(egsl_gslm(fisher));
37  printf("%s\n", json_object_to_json_string(jo));
38  jo_free(jo);
39  egsl_pop();
40  ld_free(ld);
41  }
42 
43  egsl_pop();
44 
45  return 0;
46 }
void sm_set_program_name(const char *name)
Definition: logging.c:21
void egsl_pop()
Definition: egsl.c:89
Definition: egsl.h:12
void options_double(struct option *, const char *name, double *p, double def_value, const char *desc)
void egsl_push()
Definition: egsl.c:88
struct option * ops
Definition: rb_sm.c:31
Definition: options.h:49
void ld_free(LDP ld)
Definition: laser_data.c:87
int main(int argc, const char *argv[])
Definition: ld_fisher.c:14
struct option * options_allocate(int n)
LDP ld_from_json_stream(FILE *file)
const char * json_object_to_json_string(struct json_object *this)
Definition: json_object.c:199
val ld_fisher0(LDP ld)
JO matrix_to_json(gsl_matrix *m)
val egsl_scale(double, val)
Definition: egsl_ops.c:77
gsl_matrix * egsl_gslm(val v)
Definition: egsl.c:83
void options_print_help(struct option *options, FILE *f)
Definition: options.c:398
double square(double x)
Definition: math_utils.c:124
double sigma
Definition: ld_fisher.c:9
int options_parse_args(struct option *ops, int argc, const char *argv[])
Definition: options.c:66
#define jo_free


csm
Author(s): Andrea Censi
autogenerated on Tue May 11 2021 02:18:23