ld_fisher.c
Go to the documentation of this file.
00001 #include <libgen.h>
00002 #include <math.h>
00003 
00004 #include <options/options.h>
00005 #include "../csm/csm_all.h"
00006 
00007 
00008 struct ld_fisher_params {
00009         double sigma;
00010 };
00011 
00012 val ld_fisher0(LDP ld);
00013 
00014 int main(int argc, const char * argv[]) {
00015         sm_set_program_name(argv[0]);
00016         
00017         struct ld_fisher_params p;
00018         
00019         struct option* ops = options_allocate(3);
00020         options_double(ops, "sigma", &p.sigma, 0.01, 
00021                 "Std deviation of gaussian noise");
00022                 
00023         if(!options_parse_args(ops, argc, argv)) {
00024                 fprintf(stderr, "Writes Fisher's information matrix.\n\nUsage:\n");
00025                 options_print_help(ops, stderr);
00026                 return -1;
00027         }
00028 
00029         egsl_push();
00030 
00031         LDP ld;
00032         while( (ld = ld_from_json_stream(stdin))) {
00033                 egsl_push();
00034                         val fisher = egsl_scale( square(p.sigma),  ld_fisher0(ld) );
00035                         
00036                         JO jo = matrix_to_json(egsl_gslm(fisher));
00037                         printf("%s\n", json_object_to_json_string(jo));
00038                         jo_free(jo);
00039                 egsl_pop();
00040                 ld_free(ld);
00041         }
00042 
00043         egsl_pop();
00044         
00045         return 0;
00046 }


csm
Author(s): Andrea Censi
autogenerated on Mon Jan 16 2017 03:48:29