/********* * Run the network which was trained in train_xor.c * * First, run train_xor * Then compile and run this with * $ export LD_LIBRARY_PATH=/usr/local/lib * $ gcc -O2 -march=athlon64 -lfann -lm run_xor.c -o run_xor * $ ./run_xor * **********/ #include #include "floatfann.h" int main(){ fann_type *calc_out; fann_type input[2]; char* network_file="xor.net"; struct fann *ann = fann_create_from_file(network_file); input[0] = -1; input[1] = 1; calc_out = fann_run(ann, input); printf("xor test (%f,%f) -> %f\n", input[0], input[1], calc_out[0]); fann_destroy(ann); return 0; }