![]() |
|
Coding often relies on gathering together many libraries; there is a section at the bottom of the outline linking to references for some libraries upon which Apohenia builds.
#include <apop.h>
norm for vectors
and
would be apop_vector_distance(v1, v2, 'L', 3);
apop_vector_distance(v1, v2, 'E');
apop_vector_distance(v1, v2);
apop_vector_distance(v1, .metric='M');
See the Designated initializers page for details of this syntax.
gcc -lapophenia (as well as the other usual flags). For example, gcc sample.c -lapophenia -lsqlite3 -lgsl -lgslcblas -o run_me -g will produce an output file named run_me from the input source code sample.c. It will include symbols for debugging (-g) and will correctly find the functions in the Apophenia, GSL, and SQLite libraries (-lapophenia -lgsl ...). Order matters in the linking list: the files a package depends on should be listed after the package. E.g., since sample.c depends on Apophenia, gcc sample.c -lapophenia will work, while gcc -lapophenia sample.c is likely to give you errors. Similarly, list -lapophenia before -lgsl, which comes before -lgslcblas.apop_opts.verbose turns on some diagnostics, such as printing the query sent to the databse engine (which is useful if you are substituting in many %ses). Just set apop_opts.verbose =1 when you want feedback and apop_opts.verbose=0 when you don't.
If you use gdb, you can define macros to use the pretty-printing functions on your data, which can be a significant help. Add these to your .gdbinit:
define pv
p apop_vector_show($arg0)
end
define pm
p apop_matrix_show($arg0)
end
define pd
p apop_data_show($arg0)
end
define pa
p *($arg0)@$arg1
end
Then just pd mydata to see all components of your data set neatly displayed, or pa myarray 5 to see the first five elements of your array.
vim, add the following two lines to /usr/share/vim/syntax/c.vim: syn keyword cType gsl_matrix gsl_rng gsl_vector apop_data syn keyword cType apop_name apop_model