It appears Solaris's cc is ignoring the signedness of bitfield types.
[xiph/unicode.git] / sushivision / example_discrete.c
blob90dbfa78fbe608084e18fdcf40de08e650703ed2
1 /*
3 * sushivision copyright (C) 2006-2007 Monty <monty@xiph.org>
5 * sushivision is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * sushivision is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with sushivision; see the file COPYING. If not, write to the
17 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 #define _GNU_SOURCE
23 #include <stdio.h>
24 #include <math.h>
25 #include "sushimacro.h"
27 static void discrete_objective(double *d, double *ret){
29 int X = rint(d[0]);
30 int Y = rint(d[1]);
32 if(!(X%100) && !(Y%100))
33 ret[0]=0.;
34 else
35 ret[0]=1.;
38 int sv_submain(int argc, char *argv[]){
40 svm_new("alignment test");
42 svm_scale_vals(-500,-10,0,10,500);
43 svm_dim(0,"A");
44 svm_dim_discrete(1,1);
45 svm_dim_value(-2,NAN,2);
47 svm_scale_vals(-500,-10,0,10,500);
48 svm_dim(1,"B");
49 svm_dim_discrete(1,1);
50 svm_dim_value(-2,NAN,2);
52 //sv_func_t *f = sv_func_new(s, 0, 1, discrete_objective, 0);
53 #if 0
54 //sv_obj_t *o0 = sv_obj_new(s,0,"test pattern",
55 // (sv_func_t *[]){f},
56 // (int []){0},
57 // "Y",0);
58 //sv_obj_make_scale(o0, 2, (double []){0, 1.0}, NULL, 0);
60 svm_scale_vals(0,1);
61 svm_obj_simple(0,"test pattern",f,"Y");
63 //sv_panel_t *p2 = sv_panel_new_2d(s,0,"Discrete data example",
64 // (sv_obj_t *[]){o0,NULL},
65 // (sv_dim_t *[]){d0,d1,NULL},
66 // 0);
68 svm_panel_2d(0,"Discrete data example");
70 //sv_panel_t *px = sv_panel_new_1d(s,1,"X Slice", s->objective_list[0]->scale,
71 // (sv_obj_t *[]){o0,NULL},
72 // NULL,0);
73 //sv_panel_link_1d(px, p2, SV_PANEL_LINK_X);
75 svm_scale(0, 1.0);
76 svm_obj_list(0);
77 svm_panel_1d(1,"X Slice");
78 svm_panel_linkx(0);
80 //sv_panel_t *py = sv_panel_new_1d(s,2,"Y Slice", s->objective_list[0]->scale,
81 // (sv_obj_t *[]){o0,NULL},
82 // NULL,SV_PANEL_FLIP);
83 //sv_panel_link_1d(py, p2, SV_PANEL_LINK_Y);
85 svm_scale(0, 1.0);
86 svm_obj_list(0);
87 svm_panel_1d(2,"Y Slice");
88 svm_panel_linky(0);
89 #endif
90 return 0;