30 using namespace shogun;
38 const char* description) {
40 add_type(&type, param, name, description);
45 const char* description) {
47 add_type(&type, param, name, description);
52 const char* description) {
54 add_type(&type, param, name, description);
59 const char* description) {
61 add_type(&type, param, name, description);
66 const char* description) {
68 add_type(&type, param, name, description);
73 const char* description) {
75 add_type(&type, param, name, description);
80 const char* description) {
82 add_type(&type, param, name, description);
87 const char* description) {
89 add_type(&type, param, name, description);
94 const char* description) {
96 add_type(&type, param, name, description);
101 const char* description) {
103 add_type(&type, param, name, description);
108 const char* description) {
110 add_type(&type, param, name, description);
115 const char* description) {
117 add_type(&type, param, name, description);
122 const char* description) {
124 add_type(&type, param, name, description);
129 const char* description) {
130 TSGDataType type(CT_SCALAR, ST_NONE, PT_COMPLEX128);
131 add_type(&type, param, name, description);
136 const char* name,
const char* description) {
138 add_type(&type, param, name, description);
143 const char* description) {
145 add_type(&type, param, name, description);
150 const char* description) {
152 add_type(&type, param, name, description);
157 const char* description) {
159 add_type(&type, param, name, description);
164 const char* description) {
166 add_type(&type, param, name, description);
171 const char* description) {
173 add_type(&type, param, name, description);
178 const char* description) {
180 add_type(&type, param, name, description);
185 const char* description) {
187 add_type(&type, param, name, description);
192 const char* description) {
194 add_type(&type, param, name, description);
199 const char* description) {
201 add_type(&type, param, name, description);
206 const char* description) {
208 add_type(&type, param, name, description);
213 const char* description) {
214 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOAT32);
215 add_type(&type, param, name, description);
220 const char* description) {
221 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOAT64);
222 add_type(&type, param, name, description);
227 const char* description) {
228 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOATMAX);
229 add_type(&type, param, name, description);
234 const char* description) {
236 add_type(&type, param, name, description);
241 const char* description) {
243 add_type(&type, param, name, description);
248 const char* description) {
250 add_type(&type, param, name, description);
255 const char* description) {
257 add_type(&type, param, name, description);
262 const char* description) {
264 add_type(&type, param, name, description);
269 const char* description) {
271 add_type(&type, param, name, description);
276 const char* description) {
278 add_type(&type, param, name, description);
283 const char* description) {
285 add_type(&type, param, name, description);
290 const char* description) {
292 add_type(&type, param, name, description);
297 const char* description) {
299 add_type(&type, param, name, description);
304 const char* description) {
305 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOAT32);
306 add_type(&type, param, name, description);
311 const char* description) {
312 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOAT64);
313 add_type(&type, param, name, description);
318 const char* description) {
319 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOATMAX);
320 add_type(&type, param, name, description);
325 const char* description) {
326 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_COMPLEX128);
327 add_type(&type, param, name, description);
335 bool** param,
index_t* length,
const char* name,
336 const char* description) {
337 TSGDataType type(CT_VECTOR, ST_NONE, PT_BOOL, length);
338 add_type(&type, param, name, description);
343 char** param,
index_t* length,
const char* name,
344 const char* description) {
345 TSGDataType type(CT_VECTOR, ST_NONE, PT_CHAR, length);
346 add_type(&type, param, name, description);
351 int8_t** param,
index_t* length,
const char* name,
352 const char* description) {
353 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT8, length);
354 add_type(&type, param, name, description);
359 uint8_t** param,
index_t* length,
const char* name,
360 const char* description) {
361 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT8, length);
362 add_type(&type, param, name, description);
367 int16_t** param,
index_t* length,
const char* name,
368 const char* description) {
369 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT16, length);
370 add_type(&type, param, name, description);
375 uint16_t** param,
index_t* length,
const char* name,
376 const char* description) {
377 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT16, length);
378 add_type(&type, param, name, description);
383 int32_t** param,
index_t* length,
const char* name,
384 const char* description) {
385 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT32, length);
386 add_type(&type, param, name, description);
391 uint32_t** param,
index_t* length,
const char* name,
392 const char* description) {
393 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT32, length);
394 add_type(&type, param, name, description);
399 int64_t** param,
index_t* length,
const char* name,
400 const char* description) {
401 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT64, length);
402 add_type(&type, param, name, description);
407 uint64_t** param,
index_t* length,
const char* name,
408 const char* description) {
409 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT64, length);
410 add_type(&type, param, name, description);
416 const char* description) {
417 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOAT32, length);
418 add_type(&type, param, name, description);
424 const char* description) {
425 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOAT64, length);
426 add_type(&type, param, name, description);
432 const char* description) {
433 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOATMAX, length);
434 add_type(&type, param, name, description);
440 const char* description) {
441 TSGDataType type(CT_VECTOR, ST_NONE, PT_COMPLEX128, length);
442 add_type(&type, param, name, description);
447 const char* name,
const char* description) {
450 add_type(&type, param, name, description);
455 const char* name,
const char* description) {
456 TSGDataType type(CT_VECTOR, ST_STRING, PT_BOOL, length);
457 add_type(&type, param, name, description);
462 const char* name,
const char* description) {
463 TSGDataType type(CT_VECTOR, ST_STRING, PT_CHAR, length);
464 add_type(&type, param, name, description);
469 const char* name,
const char* description) {
470 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT8, length);
471 add_type(&type, param, name, description);
476 const char* name,
const char* description) {
477 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT8, length);
478 add_type(&type, param, name, description);
483 const char* name,
const char* description) {
484 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT16, length);
485 add_type(&type, param, name, description);
490 const char* name,
const char* description) {
491 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT16, length);
492 add_type(&type, param, name, description);
497 const char* name,
const char* description) {
498 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT32, length);
499 add_type(&type, param, name, description);
504 const char* name,
const char* description) {
505 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT32, length);
506 add_type(&type, param, name, description);
511 const char* name,
const char* description) {
512 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT64, length);
513 add_type(&type, param, name, description);
518 const char* name,
const char* description) {
519 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT64, length);
520 add_type(&type, param, name, description);
525 const char* name,
const char* description) {
526 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOAT32, length);
527 add_type(&type, param, name, description);
532 const char* name,
const char* description) {
533 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOAT64, length);
534 add_type(&type, param, name, description);
539 const char* name,
const char* description) {
540 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOATMAX, length);
541 add_type(&type, param, name, description);
546 const char* name,
const char* description) {
547 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_BOOL, length);
548 add_type(&type, param, name, description);
553 const char* name,
const char* description) {
554 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_CHAR, length);
555 add_type(&type, param, name, description);
560 const char* name,
const char* description) {
561 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT8, length);
562 add_type(&type, param, name, description);
567 const char* name,
const char* description) {
568 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT8, length);
569 add_type(&type, param, name, description);
574 const char* name,
const char* description) {
575 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT16, length);
576 add_type(&type, param, name, description);
581 const char* name,
const char* description) {
582 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT16, length);
583 add_type(&type, param, name, description);
588 const char* name,
const char* description) {
589 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT32, length);
590 add_type(&type, param, name, description);
595 const char* name,
const char* description) {
596 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT32, length);
597 add_type(&type, param, name, description);
602 const char* name,
const char* description) {
603 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT64, length);
604 add_type(&type, param, name, description);
609 const char* name,
const char* description) {
610 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT64, length);
611 add_type(&type, param, name, description);
616 const char* name,
const char* description) {
617 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOAT32, length);
618 add_type(&type, param, name, description);
623 const char* name,
const char* description) {
624 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOAT64, length);
625 add_type(&type, param, name, description);
630 const char* name,
const char* description) {
631 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOATMAX, length);
632 add_type(&type, param, name, description);
637 const char* name,
const char* description) {
638 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_COMPLEX128, length);
639 add_type(&type, param, name, description);
646 const char* description)
653 const char* description)
660 const char* description)
667 const char* description)
674 const char* description)
681 const char* description)
688 const char* description)
695 const char* description)
702 const char* description)
709 const char* description)
716 const char* description)
723 const char* description)
730 const char* description)
737 const char* description)
744 const char* description)
751 const char* description)
753 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_BOOL, ¶m->vlen);
754 add_type(&type, ¶m->vector, name, description);
758 const char* description)
760 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_CHAR, ¶m->vlen);
761 add_type(&type, ¶m->vector, name, description);
765 const char* name,
const char* description)
767 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT8, ¶m->vlen);
768 add_type(&type, ¶m->vector, name, description);
772 const char* name,
const char* description)
774 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT8, ¶m->vlen);
775 add_type(&type, ¶m->vector, name, description);
779 const char* name,
const char* description)
781 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT16, ¶m->vlen);
782 add_type(&type, ¶m->vector, name, description);
786 const char* name,
const char* description)
788 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT16, ¶m->vlen);
789 add_type(&type, ¶m->vector, name, description);
793 const char* name,
const char* description)
795 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT32, ¶m->vlen);
796 add_type(&type, ¶m->vector, name, description);
800 const char* name,
const char* description)
802 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT32, ¶m->vlen);
803 add_type(&type, ¶m->vector, name, description);
807 const char* name,
const char* description)
809 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT64, ¶m->vlen);
810 add_type(&type, ¶m->vector, name, description);
814 const char* name,
const char* description)
816 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT64, ¶m->vlen);
817 add_type(&type, ¶m->vector, name, description);
821 const char* name,
const char* description)
823 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOAT32, ¶m->vlen);
824 add_type(&type, ¶m->vector, name, description);
828 const char* name,
const char* description)
830 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOAT64, ¶m->vlen);
831 add_type(&type, ¶m->vector, name, description);
835 const char* name,
const char* description)
837 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOATMAX, ¶m->vlen);
838 add_type(&type, ¶m->vector, name, description);
842 const char* name,
const char* description)
844 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_BOOL, ¶m->vlen);
845 add_type(&type, ¶m->vector, name, description);
849 const char* name,
const char* description)
851 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_CHAR, ¶m->vlen);
852 add_type(&type, ¶m->vector, name, description);
856 const char* name,
const char* description)
858 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT8, ¶m->vlen);
859 add_type(&type, ¶m->vector, name, description);
863 const char* name,
const char* description)
865 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT8, ¶m->vlen);
866 add_type(&type, ¶m->vector, name, description);
870 const char* name,
const char* description)
872 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT16, ¶m->vlen);
873 add_type(&type, ¶m->vector, name, description);
877 const char* name,
const char* description)
879 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT16, ¶m->vlen);
880 add_type(&type, ¶m->vector, name, description);
884 const char* name,
const char* description)
886 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT32, ¶m->vlen);
887 add_type(&type, ¶m->vector, name, description);
891 const char* name,
const char* description)
893 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT32, ¶m->vlen);
894 add_type(&type, ¶m->vector, name, description);
898 const char* name,
const char* description)
900 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT64, ¶m->vlen);
901 add_type(&type, ¶m->vector, name, description);
905 const char* name,
const char* description)
907 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT64, ¶m->vlen);
908 add_type(&type, ¶m->vector, name, description);
912 const char* name,
const char* description)
914 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOAT32, ¶m->vlen);
915 add_type(&type, ¶m->vector, name, description);
919 const char* name,
const char* description)
921 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOAT64, ¶m->vlen);
922 add_type(&type, ¶m->vector, name, description);
926 const char* name,
const char* description)
928 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOATMAX, ¶m->vlen);
929 add_type(&type, ¶m->vector, name, description);
933 const char* name,
const char* description)
935 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_COMPLEX128, ¶m->vlen);
936 add_type(&type, ¶m->vector, name, description);
945 const char* name,
const char* description) {
946 TSGDataType type(CT_MATRIX, ST_NONE, PT_BOOL, length_y,
948 add_type(&type, param, name, description);
954 const char* name,
const char* description) {
955 TSGDataType type(CT_MATRIX, ST_NONE, PT_CHAR, length_y,
957 add_type(&type, param, name, description);
963 const char* name,
const char* description) {
964 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT8, length_y,
966 add_type(&type, param, name, description);
972 const char* name,
const char* description) {
973 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT8, length_y,
975 add_type(&type, param, name, description);
981 const char* name,
const char* description) {
982 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT16, length_y,
984 add_type(&type, param, name, description);
990 const char* name,
const char* description) {
991 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT16, length_y,
993 add_type(&type, param, name, description);
999 const char* name,
const char* description) {
1000 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT32, length_y,
1002 add_type(&type, param, name, description);
1008 const char* name,
const char* description) {
1009 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT32, length_y,
1011 add_type(&type, param, name, description);
1017 const char* name,
const char* description) {
1018 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT64, length_y,
1020 add_type(&type, param, name, description);
1026 const char* name,
const char* description) {
1027 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT64, length_y,
1029 add_type(&type, param, name, description);
1035 const char* name,
const char* description) {
1036 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOAT32, length_y,
1038 add_type(&type, param, name, description);
1044 const char* name,
const char* description) {
1045 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOAT64, length_y,
1047 add_type(&type, param, name, description);
1053 const char* name,
const char* description) {
1054 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOATMAX, length_y,
1056 add_type(&type, param, name, description);
1062 const char* name,
const char* description) {
1063 TSGDataType type(CT_MATRIX, ST_NONE, PT_COMPLEX128, length_y,
1065 add_type(&type, param, name, description);
1071 const char* name,
const char* description) {
1073 length_y, length_x);
1074 add_type(&type, param, name, description);
1080 const char* name,
const char* description) {
1081 TSGDataType type(CT_MATRIX, ST_STRING, PT_BOOL, length_y,
1083 add_type(&type, param, name, description);
1089 const char* name,
const char* description) {
1090 TSGDataType type(CT_MATRIX, ST_STRING, PT_CHAR, length_y,
1092 add_type(&type, param, name, description);
1098 const char* name,
const char* description) {
1099 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT8, length_y,
1101 add_type(&type, param, name, description);
1107 const char* name,
const char* description) {
1108 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT8, length_y,
1110 add_type(&type, param, name, description);
1116 const char* name,
const char* description) {
1117 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT16, length_y,
1119 add_type(&type, param, name, description);
1125 const char* name,
const char* description) {
1126 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT16, length_y,
1128 add_type(&type, param, name, description);
1134 const char* name,
const char* description) {
1135 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT32, length_y,
1137 add_type(&type, param, name, description);
1143 const char* name,
const char* description) {
1144 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT32, length_y,
1146 add_type(&type, param, name, description);
1152 const char* name,
const char* description) {
1153 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT64, length_y,
1155 add_type(&type, param, name, description);
1161 const char* name,
const char* description) {
1162 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT64, length_y,
1164 add_type(&type, param, name, description);
1170 const char* name,
const char* description) {
1171 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOAT32, length_y,
1173 add_type(&type, param, name, description);
1179 const char* name,
const char* description) {
1180 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOAT64, length_y,
1182 add_type(&type, param, name, description);
1188 const char* name,
const char* description) {
1189 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOATMAX, length_y,
1191 add_type(&type, param, name, description);
1197 const char* name,
const char* description) {
1198 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_BOOL, length_y,
1200 add_type(&type, param, name, description);
1206 const char* name,
const char* description) {
1207 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_CHAR, length_y,
1209 add_type(&type, param, name, description);
1215 const char* name,
const char* description) {
1216 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT8, length_y,
1218 add_type(&type, param, name, description);
1224 const char* name,
const char* description) {
1225 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT8, length_y,
1227 add_type(&type, param, name, description);
1233 const char* name,
const char* description) {
1234 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT16, length_y,
1236 add_type(&type, param, name, description);
1242 const char* name,
const char* description) {
1243 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT16, length_y,
1245 add_type(&type, param, name, description);
1251 const char* name,
const char* description) {
1252 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT32, length_y,
1254 add_type(&type, param, name, description);
1260 const char* name,
const char* description) {
1261 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT32, length_y,
1263 add_type(&type, param, name, description);
1269 const char* name,
const char* description) {
1270 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT64, length_y,
1272 add_type(&type, param, name, description);
1278 const char* name,
const char* description) {
1279 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT64, length_y,
1281 add_type(&type, param, name, description);
1287 const char* name,
const char* description) {
1288 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOAT32, length_y,
1290 add_type(&type, param, name, description);
1296 const char* name,
const char* description) {
1297 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOAT64, length_y,
1299 add_type(&type, param, name, description);
1305 const char* name,
const char* description) {
1306 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOATMAX, length_y,
1308 add_type(&type, param, name, description);
1314 const char* name,
const char* description) {
1315 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_COMPLEX128, length_y,
1317 add_type(&type, param, name, description);
1324 const char* description)
1332 const char* description)
1340 const char* description)
1348 const char* description)
1356 const char* description)
1364 const char* description)
1372 const char* description)
1380 const char* description)
1388 const char* description)
1396 const char* description)
1404 const char* description)
1412 const char* description)
1420 const char* description)
1428 const char* description)
1436 const char* description)
1444 const char* description)
1446 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_BOOL, ¶m->num_rows,
1448 add_type(&type, ¶m->matrix, name, description);
1452 const char* description)
1454 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_CHAR, ¶m->num_rows,
1456 add_type(&type, ¶m->matrix, name, description);
1460 const char* name,
const char* description)
1462 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT8, ¶m->num_rows,
1464 add_type(&type, ¶m->matrix, name, description);
1468 const char* name,
const char* description)
1470 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT8, ¶m->num_rows,
1472 add_type(&type, ¶m->matrix, name, description);
1476 const char* name,
const char* description)
1478 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT16, ¶m->num_rows,
1480 add_type(&type, ¶m->matrix, name, description);
1484 const char* name,
const char* description)
1486 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT16, ¶m->num_rows,
1488 add_type(&type, ¶m->matrix, name, description);
1492 const char* name,
const char* description)
1494 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT32, ¶m->num_rows,
1496 add_type(&type, ¶m->matrix, name, description);
1500 const char* name,
const char* description)
1502 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT32, ¶m->num_rows,
1504 add_type(&type, ¶m->matrix, name, description);
1508 const char* name,
const char* description)
1510 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT64, ¶m->num_rows,
1512 add_type(&type, ¶m->matrix, name, description);
1516 const char* name,
const char* description)
1518 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT64, ¶m->num_rows,
1520 add_type(&type, ¶m->matrix, name, description);
1524 const char* name,
const char* description)
1526 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOAT32, ¶m->num_rows,
1528 add_type(&type, ¶m->matrix, name, description);
1532 const char* name,
const char* description)
1534 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOAT64, ¶m->num_rows,
1536 add_type(&type, ¶m->matrix, name, description);
1540 const char* name,
const char* description)
1542 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOATMAX, ¶m->num_rows,
1544 add_type(&type, ¶m->matrix, name, description);
1548 const char* name,
const char* description)
1550 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_BOOL, ¶m->num_rows,
1552 add_type(&type, ¶m->matrix, name, description);
1556 const char* name,
const char* description)
1558 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_CHAR, ¶m->num_rows,
1560 add_type(&type, ¶m->matrix, name, description);
1564 const char* name,
const char* description)
1566 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT8, ¶m->num_rows,
1568 add_type(&type, ¶m->matrix, name, description);
1572 const char* name,
const char* description)
1574 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT8, ¶m->num_rows,
1576 add_type(&type, ¶m->matrix, name, description);
1580 const char* name,
const char* description)
1582 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT16, ¶m->num_rows,
1584 add_type(&type, ¶m->matrix, name, description);
1588 const char* name,
const char* description)
1590 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT16, ¶m->num_rows,
1592 add_type(&type, ¶m->matrix, name, description);
1596 const char* name,
const char* description)
1598 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT32, ¶m->num_rows,
1600 add_type(&type, ¶m->matrix, name, description);
1604 const char* name,
const char* description)
1606 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT32, ¶m->num_rows,
1608 add_type(&type, ¶m->matrix, name, description);
1612 const char* name,
const char* description)
1614 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT64, ¶m->num_rows,
1616 add_type(&type, ¶m->matrix, name, description);
1620 const char* name,
const char* description)
1622 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT64, ¶m->num_rows,
1624 add_type(&type, ¶m->matrix, name, description);
1628 const char* name,
const char* description)
1630 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOAT32, ¶m->num_rows,
1632 add_type(&type, ¶m->matrix, name, description);
1636 const char* name,
const char* description)
1638 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOAT64, ¶m->num_rows,
1640 add_type(&type, ¶m->matrix, name, description);
1644 const char* name,
const char* description)
1646 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOATMAX, ¶m->num_rows,
1648 add_type(&type, ¶m->matrix, name, description);
1652 const char* name,
const char* description)
1654 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_COMPLEX128, ¶m->num_rows,
1656 add_type(&type, ¶m->matrix, name, description);
1660 const char* name,
const char* description)
1668 const char* name,
const char* description)
1676 const char* name,
const char* description)
1684 const char* name,
const char* description)
1692 const char* name,
const char* description)
1700 const char* name,
const char* description)
1708 const char* name,
const char* description)
1716 const char* name,
const char* description)
1724 const char* name,
const char* description)
1732 const char* name,
const char* description)
1740 const char* name,
const char* description)
1748 const char* name,
const char* description)
1756 const char* name,
const char* description)
1764 const char* name,
const char* description)
1772 const char* name,
const char* description)
1783 const char* name,
const char* description)
1784 :m_datatype(*datatype)
1787 m_name = get_strdup(name);
1802 SG_SDEBUG(
"deleting from scratch data\n")
1835 TParameter::new_prefix(
const char* s1,
const char* s2)
1837 char* tmp = SG_MALLOC(
char, strlen(s1)+strlen(s2)+2);
1839 sprintf(tmp,
"%s%s/", s1, s2);
1858 char* p = new_prefix(prefix,
m_name);
1865 TParameter::delete_cont()
1873 case CT_MATRIX:
case CT_SGMATRIX:
1875 case CT_SCALAR:
case CT_VECTOR:
case CT_SGVECTOR:
break;
1876 case CT_UNDEFINED:
default:
1877 SG_SERROR(
"Implementation error: undefined container type\n");
1916 for (
index_t i=0; i<old_length; i++)
1922 case PT_UNDEFINED:
default:
1923 SG_SERROR(
"Implementation error: undefined primitive type\n");
1929 for (
index_t i=0; i<old_length; i++) {
1965 SG_SERROR(
"TParameter::delete_cont(): Parameters of strings"
1966 " of complex128_t are not supported");
1969 SG_SERROR(
"TParameter::delete_cont(): Implementation "
1970 "error: Could not delete "
1971 "String<SGSerializable*>");
1973 case PT_UNDEFINED:
default:
1974 SG_SERROR(
"Implementation error: undefined primitive type\n");
1979 for (
index_t i=0; i<old_length; i++) {
2015 SG_SERROR(
"TParameter::delete_cont(): Implementation "
2016 "error: Could not delete "
2017 "Sparse<SGSerializable*>");
2019 case PT_UNDEFINED:
default:
2020 SG_SERROR(
"Implementation error: undefined primitive type\n");
2024 case ST_UNDEFINED:
default:
2025 SG_SERROR(
"Implementation error: undefined structure type\n");
2036 char* s=SG_MALLOC(
char, 200);
2038 SG_SDEBUG(
"entering TParameter::new_cont for \"%s\" of type %s\n",
2044 if (new_length == 0)
return;
2051 = SG_MALLOC(
bool, new_length);
break;
2054 = SG_MALLOC(
char, new_length);
break;
2057 = SG_MALLOC(int8_t, new_length);
break;
2060 = SG_MALLOC(uint8_t, new_length);
break;
2063 = SG_MALLOC(int16_t, new_length);
break;
2066 = SG_MALLOC(uint16_t, new_length);
break;
2069 = SG_MALLOC(int32_t, new_length);
break;
2072 = SG_MALLOC(uint32_t, new_length);
break;
2075 = SG_MALLOC(int64_t, new_length);
break;
2078 = SG_MALLOC(uint64_t, new_length);
break;
2081 = SG_MALLOC(
float32_t, new_length);
break;
2084 = SG_MALLOC(
float64_t, new_length);
break;
2095 case PT_UNDEFINED:
default:
2096 SG_SERROR(
"Implementation error: undefined primitive type\n");
2142 SG_SERROR(
"TParameter::new_cont(): Implementation "
2143 "error: Could not allocate "
2144 "String<complex128>");
2147 SG_SERROR(
"TParameter::new_cont(): Implementation "
2148 "error: Could not allocate "
2149 "String<SGSerializable*>");
2151 case PT_UNDEFINED:
default:
2152 SG_SERROR(
"Implementation error: undefined primitive type\n");
2204 SG_SERROR(
"TParameter::new_cont(): Implementation "
2205 "error: Could not allocate "
2206 "Sparse<SGSerializable*>");
2208 case PT_UNDEFINED:
default:
2209 SG_SERROR(
"Implementation error: undefined primitive type\n");
2213 case ST_UNDEFINED:
default:
2214 SG_SERROR(
"Implementation error: undefined structure type\n");
2218 s=SG_MALLOC(
char, 200);
2220 SG_SDEBUG(
"leaving TParameter::new_cont for \"%s\" of type %s\n",
2226 TParameter::new_sgserial(
CSGObject** param,
2227 EPrimitiveType
generic,
2228 const char* sgserializable_name,
2236 if (*param == NULL) {
2247 "Class `C%s%s' was not listed during compiling Shogun"
2248 " :( ... Can not construct it for `%s%s'!",
2249 sgserializable_name, buf, prefix,
m_name);
2263 const char* sgserial_name =
"";
2267 sgserial_name = (*(
CSGObject**) param)->get_name();
2268 (*(
CSGObject**) param)->is_generic(&
generic);
2271 if (!file->write_sgserializable_begin(
2274 if (*sgserial_name !=
'\0') {
2275 char* p = new_prefix(prefix,
m_name);
2277 ->save_serializable(file, p);
2279 if (!result)
return false;
2281 if (!file->write_sgserializable_end(
2286 param))
return false;
2299 if (!file->read_sgserializable_begin(
2302 if (*sgserial_name !=
'\0') {
2303 if (!new_sgserial((
CSGObject**) param,
generic,
2304 sgserial_name, prefix))
2307 char* p = new_prefix(prefix,
m_name);
2309 ->load_serializable(file, p);
2311 if (!result)
return false;
2313 if (!file->read_sgserializable_end(
2318 param))
return false;
2333 if (!save_ptype(file, param, prefix))
return false;
2336 len_real = str_ptr->
slen;
2337 if (str_ptr->
string == NULL && len_real != 0) {
2338 SG_SWARNING(
"Inconsistency between data structure and "
2339 "len during saving string `%s%s'! Continuing"
2344 if (!file->write_string_begin(
2346 for (
index_t i=0; i<len_real; i++) {
2347 if (!file->write_stringentry_begin(
2349 if (!save_ptype(file, (
char*) str_ptr->
string
2352 if (!file->write_stringentry_end(
2355 if (!file->write_string_end(
2360 if (spr_ptr->
features == NULL && len_real != 0) {
2361 SG_SWARNING(
"Inconsistency between data structure and "
2362 "len during saving sparse `%s%s'! Continuing"
2367 if (!file->write_sparse_begin(
2369 for (
index_t i=0; i<len_real; i++) {
2373 if (!file->write_sparseentry_begin(
2378 prefix))
return false;
2379 if (!file->write_sparseentry_end(
2383 if (!file->write_sparse_end(
2386 case ST_UNDEFINED:
default:
2387 SG_SERROR(
"Implementation error: undefined structure type\n");
2404 if (!load_ptype(file, param, prefix))
return false;
2407 if (!file->read_string_begin(
2410 str_ptr->
string = len_real > 0
2412 for (
index_t i=0; i<len_real; i++) {
2413 if (!file->read_stringentry_begin(
2415 if (!load_ptype(file, (
char*) str_ptr->
string
2418 if (!file->read_stringentry_end(
2421 if (!file->read_string_end(
2424 str_ptr->
slen = len_real;
2427 if (!file->read_sparse_begin(
2432 for (
index_t i=0; i<len_real; i++) {
2436 if (!file->read_sparseentry_begin(
2441 prefix))
return false;
2442 if (!file->read_sparseentry_end(
2452 case ST_UNDEFINED:
default:
2453 SG_SERROR(
"Implementation error: undefined structure type\n");
2461 uint32_t& hash, uint32_t& carry, uint32_t& total_length)
2473 total_length += size;
2475 &hash, &carry, data, size);
2478 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2480 index_t len_real_y = 0, len_real_x = 0;
2488 if (*(
void**)
m_parameter == NULL && len_real_y != 0)
2490 SG_SWARNING(
"Inconsistency between data structure and "
2491 "len_y during hashing `%s'! Continuing with "
2502 case CT_VECTOR:
case CT_SGVECTOR:
2505 case CT_MATRIX:
case CT_SGMATRIX:
2508 if (*(
void**)
m_parameter == NULL && len_real_x != 0)
2510 SG_SWARNING(
"Inconsistency between data structure and "
2511 "len_x during hashing %s'! Continuing "
2517 if (len_real_x *len_real_y == 0)
2518 len_real_x = len_real_y = 0;
2522 case CT_SCALAR:
break;
2523 case CT_UNDEFINED:
default:
2524 SG_SERROR(
"Implementation error: undefined container type\n");
2529 total_length += size;
2534 &hash, &carry, data, size);
2537 case CT_UNDEFINED:
default:
2538 SG_SERROR(
"Implementation error: undefined container type\n");
2552 const int32_t buflen=100;
2553 char* buf=SG_MALLOC(
char, buflen);
2566 if (!save_stype(file,
m_parameter, prefix))
return false;
2568 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2570 index_t len_real_y = 0, len_real_x = 0;
2573 if (*(
void**)
m_parameter == NULL && len_real_y != 0) {
2574 SG_SWARNING(
"Inconsistency between data structure and "
2575 "len_y during saving `%s%s'! Continuing with "
2585 case CT_VECTOR:
case CT_SGVECTOR:
2588 case CT_MATRIX:
case CT_SGMATRIX:
2590 if (*(
void**)
m_parameter == NULL && len_real_x != 0) {
2591 SG_SWARNING(
"Inconsistency between data structure and "
2592 "len_x during saving `%s%s'! Continuing "
2598 if (len_real_x *len_real_y == 0)
2599 len_real_x = len_real_y = 0;
2602 case CT_SCALAR:
break;
2603 case CT_UNDEFINED:
default:
2604 SG_SERROR(
"Implementation error: undefined container type\n");
2609 len_real_y, len_real_x))
2614 for (
index_t x=0; x<len_real_x; x++)
2615 for (
index_t y=0; y<len_real_y; y++) {
2616 if (!file->write_item_begin(
2623 prefix))
return false;
2624 if (!file->write_item_end(
2632 len_real_y, len_real_x))
2637 case CT_UNDEFINED:
default:
2638 SG_SERROR(
"Implementation error: undefined container type\n");
2651 const int32_t buflen=100;
2652 char* buf=SG_MALLOC(
char, buflen);
2670 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2684 case CT_VECTOR:
case CT_SGVECTOR:
2688 case CT_MATRIX:
case CT_SGMATRIX:
2693 case CT_UNDEFINED:
default:
2694 SG_SERROR(
"Implementation error: undefined container type\n");
2698 for (
index_t x=0; x<dims[0]; x++)
2700 for (
index_t y=0; y<dims[1]; y++)
2702 if (!file->read_item_begin(
2709 prefix))
return false;
2710 if (!file->read_item_end(
2721 case CT_VECTOR:
case CT_SGVECTOR:
2724 case CT_MATRIX:
case CT_SGMATRIX:
2730 case CT_UNDEFINED:
default:
2731 SG_SERROR(
"Implementation error: undefined container type\n");
2741 case CT_UNDEFINED:
default:
2742 SG_SERROR(
"Implementation error: undefined container type\n");
2771 const char* name,
const char* description)
2773 if (name == NULL || *name ==
'\0')
2774 SG_SERROR(
"FATAL: Parameter::add_type(): `name' is empty!\n")
2776 for (
size_t i=0; i<strlen(name); ++i)
2778 if (!std::isalnum(name[i]) && name[i]!=
'_' && name[i]!=
'.')
2780 SG_SERROR(
"Character %d of parameter with name \"%s\" is illegal "
2781 "(only alnum or underscore is allowed)\n",
2787 if (strcmp(
m_params.get_element(i)->m_name, name) == 0)
2788 SG_SERROR(
"FATAL: Parameter::add_type(): "
2789 "Double parameter `%s'!\n", name);
2792 new TParameter(type, param, name, description)
2800 m_params.get_element(i)->print(prefix);
2808 if (!
m_params.get_element(i)->save(file, prefix))
2840 if (!strcmp(own->m_name, current->
m_name))
2842 if (own->m_datatype==current_type)
2850 char* given_type=SG_MALLOC(
char, l);
2851 char* own_type=SG_MALLOC(
char, l);
2853 own->m_datatype.to_string(own_type, l);
2854 SG_SERROR(
"given parameter \"%s\" has a different type (%s)"
2855 " than existing one (%s)\n", current->
m_name,
2856 given_type, own_type);
2857 SG_FREE(given_type);
2867 SG_SERROR(
"parameter with name %s does not exist\n",
2872 if (current_type.
m_ptype==PT_SGOBJECT)
2875 if (own->m_datatype.m_stype==ST_NONE)
2877 if (own->m_datatype.m_ctype==CT_SCALAR)
2882 if ((*to_ref)!=(*to_unref))
2895 for (
index_t j=0; j<own->m_datatype.get_num_elements(); ++j)
2897 if ((*to_ref)[j]!=(*to_unref)[j])
2906 SG_SERROR(
"primitive type PT_SGOBJECT occurred with structure "
2907 "type other than ST_NONE");
2913 if (current_type.
m_ctype==CT_SCALAR)
2916 dest=own->m_parameter;
2922 if (own->m_datatype.m_ptype==PT_SGOBJECT)
2937 switch (own->m_datatype.m_ptype)
2955 memcpy(dest, source, own->m_datatype.get_size());
2973 if (!strcmp(name,
m_params[i]->m_name))
3000 SG_SDEBUG(
"entering TParameter::allocate_data_from_scratch of "
3009 case CT_VECTOR:
case CT_SGVECTOR:
3013 case CT_MATRIX:
case CT_SGMATRIX:
3026 case CT_UNDEFINED:
default:
3027 SG_SERROR(
"Implementation error: undefined container type\n");
3033 SG_SERROR(
"TParameter::allocate_data_from_scratch must not be called "
3034 "when the underlying TParameter instance already has data.\n");
3059 void** data_p=SG_MALLOC(
void*, 1);
3068 *data_p=SG_MALLOC(
void**, 1);
3069 **(
void***)data_p=NULL;
3082 SG_SDEBUG(
"leaving TParameter::allocate_data_from_scratch of "
3103 SG_SDEBUG(
"Copying scalar data of size %d from %p to %p\n",
3123 for (
index_t j=0; j<length; ++j)
3148 SG_SDEBUG(
"entering TParameter::equals()\n");
3152 SG_SDEBUG(
"leaving TParameter::equals(): other parameter is NULL\n");
3158 SG_SDEBUG(
"leaving TParameter::equals(): name \"%s\" is different from"
3159 " other parameter's name \"%s\"\n",
m_name, other->
m_name);
3166 SG_SDEBUG(
"leaving TParameter::equals(): type of \"%s\" is different "
3167 "from other parameter's \"%s\" type\n",
m_name, other->
m_name);
3174 SG_SDEBUG(
"leaving TParameter::equals(): both parameters are NULL\n");
3180 SG_SDEBUG(
"leaving TParameter::equals(): param1 is at %p while "
3194 accuracy, tolerant))
3196 SG_SDEBUG(
"leaving TParameter::equals(): scalar data differs\n");
3201 case CT_VECTOR:
case CT_SGVECTOR:
3203 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
3210 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3214 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3218 accuracy, tolerant))
3220 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3230 case CT_MATRIX:
case CT_SGMATRIX:
3232 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
3249 for (
index_t i=0; i<length; ++i)
3251 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3255 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3259 accuracy, tolerant))
3261 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3278 SG_SERROR(
"TParameter::equals(): Not yet implemented for "
3282 case CT_UNDEFINED:
default:
3283 SG_SERROR(
"Implementation error: undefined container type\n");
3287 SG_SDEBUG(
"leaving TParameter::equals(): Parameters are equal\n");
3294 SG_SDEBUG(
"entering TParameter::compare_ptype()\n");
3296 if ((data1 && !data2) || (!data1 && data2))
3298 SG_SINFO(
"leaving TParameter::compare_ptype(): data1 is at %p while "
3299 "data2 is at %p\n", data1, data2);
3304 if (!data1 && !data2)
3306 SG_SDEBUG(
"leaving TParameter::compare_ptype(): both data are NULL\n");
3314 bool casted1=*((
bool*)data1);
3315 bool casted2=*((
bool*)data2);
3319 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_BOOL: "
3320 "data1=%d, data2=%d\n", casted1, casted2);
3327 char casted1=*((
char*)data1);
3328 char casted2=*((
char*)data2);
3332 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_CHAR: "
3333 "data1=%c, data2=%c\n", casted1, casted2);
3340 int8_t casted1=*((int8_t*)data1);
3341 int8_t casted2=*((int8_t*)data2);
3345 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT8: "
3346 "data1=%d, data2=%d\n", casted1, casted2);
3353 uint8_t casted1=*((uint8_t*)data1);
3354 uint8_t casted2=*((uint8_t*)data2);
3358 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT8: "
3359 "data1=%d, data2=%d\n", casted1, casted2);
3366 int16_t casted1=*((int16_t*)data1);
3367 int16_t casted2=*((int16_t*)data2);
3371 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT16: "
3372 "data1=%d, data2=%d\n", casted1, casted2);
3379 uint16_t casted1=*((uint16_t*)data1);
3380 uint16_t casted2=*((uint16_t*)data2);
3384 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT16: "
3385 "data1=%d, data2=%d\n", casted1, casted2);
3392 int32_t casted1=*((int32_t*)data1);
3393 int32_t casted2=*((int32_t*)data2);
3397 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT32: "
3398 "data1=%d, data2=%d\n", casted1, casted2);
3405 uint32_t casted1=*((uint32_t*)data1);
3406 uint32_t casted2=*((uint32_t*)data2);
3410 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT32: "
3411 "data1=%d, data2=%d\n", casted1, casted2);
3418 int64_t casted1=*((int64_t*)data1);
3419 int64_t casted2=*((int64_t*)data2);
3423 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT64: "
3424 "data1=%d, data2=%d\n", casted1, casted2);
3431 uint64_t casted1=*((uint64_t*)data1);
3432 uint64_t casted2=*((uint64_t*)data2);
3436 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT64: "
3437 "data1=%d, data2=%d\n", casted1, casted2);
3447 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT32: "
3448 "data1=%f, data2=%f\n", casted1, casted2);
3450 return CMath::fequals<float32_t>(casted1, casted2, accuracy, tolerant);
3458 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT64: "
3459 "data1=%f, data2=%f\n", casted1, casted2);
3461 return CMath::fequals<float64_t>(casted1, casted2, accuracy, tolerant);
3469 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOATMAX: "
3470 "data1=%f, data2=%f\n", casted1, casted2);
3472 return CMath::fequals<floatmax_t>(casted1, casted2, accuracy, tolerant);
3481 if (
CMath::abs(casted1_real-casted2_real)>accuracy ||
3482 CMath::abs(casted1_imag-casted2_imag)>accuracy)
3484 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_COMPLEX128: "
3485 "data1=%f+i%f, data2=%f+i%f\n",
3486 casted1_real, casted1_imag,
3487 casted2_real, casted2_imag);
3498 if (!casted1 && ! casted2)
3500 SG_SDEBUG(
"leaving TParameter::compare_ptype(): SGObjects are equal\n");
3507 if (!(casted1->
equals(casted2, accuracy)))
3509 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3510 "equals returned false\n");
3516 if (!(casted2->
equals(casted1, accuracy)))
3518 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3519 "equals returned false\n");
3527 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3528 "-type: %d\n", ptype);
3532 SG_SDEBUG(
"leaving TParameter::compare_ptype(): Data are equal\n");
3538 SG_SDEBUG(
"entering TParameter::copy_ptype()\n");
3547 *((
bool*)target)=*((
bool*)source);
3548 SG_SDEBUG(
"after copy of ptype PT_BOOL: source %d, target %d\n",
3549 *((
bool*)source), *((
bool*)target));
3554 *((
char*)target)=*((
char*)source);
3555 SG_SDEBUG(
"after copy of ptype PT_CHAR: source %c, target %c\n",
3556 *((
char*)source), *((
char*)target));
3561 *((int8_t*)target)=*((int8_t*)source);
3562 SG_SDEBUG(
"after copy of ptype PT_INT8: source %d, target %d\n",
3563 *((int8_t*)source), *((int8_t*)target));
3568 *((uint8_t*)target)=*((uint8_t*)source);
3569 SG_SDEBUG(
"after copy of ptype PT_UINT8: source %d, target %d\n",
3570 *((uint8_t*)source), *((uint8_t*)target));
3575 *((int16_t*)target)=*((int16_t*)source);
3576 SG_SDEBUG(
"after copy of ptype PT_INT16: source %d, target %d\n",
3577 *((int16_t*)source), *((int16_t*)target));
3582 *((uint16_t*)target)=*((uint16_t*)source);
3583 SG_SDEBUG(
"after copy of ptype PT_UINT16: source %d, target %d\n",
3584 *((uint16_t*)source), *((uint16_t*)target));
3589 *((int32_t*)target)=*((int32_t*)source);
3590 SG_SDEBUG(
"after copy of ptype PT_INT32: source %d, target %d\n",
3591 *((int32_t*)source), *((int32_t*)target));
3596 *((uint32_t*)target)=*((uint32_t*)source);
3597 SG_SDEBUG(
"after copy of ptype PT_UINT32: source %d, target %d\n",
3598 *((uint32_t*)source), *((uint32_t*)target));
3603 *((int64_t*)target)=*((int64_t*)source);
3604 SG_SDEBUG(
"after copy of ptype PT_INT64: source %d, target %d\n",
3605 *((int64_t*)source), *((int64_t*)target));
3610 *((uint64_t*)target)=*((uint64_t*)source);
3611 SG_SDEBUG(
"after copy of ptype PT_UINT64: source %d, target %d\n",
3612 *((uint64_t*)source), *((uint64_t*)target));
3618 SG_SDEBUG(
"after copy of ptype PT_FLOAT32: source %f, target %f\n",
3625 SG_SDEBUG(
"after copy of ptype PT_FLOAT64: source %f, target %f\n",
3632 SG_SDEBUG(
"after copy of ptype PT_FLOATMAX: source %Lf, target %Lf\n",
3639 SG_SDEBUG(
"after copy of ptype PT_COMPLEX128: "
3640 "source real %f, target real %f,"
3641 "source imag %f, target imag %f,"
3653 if (!casted1 && ! casted2)
3655 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Both SGObjects are NULL\n");
3670 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3671 "-type: %d\n", ptype);
3676 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Copy successful\n");
3681 void* data1,
void* data2,
float64_t accuracy,
bool tolerant)
3683 SG_SDEBUG(
"entering TParameter::compare_stype()\n");
3688 if (!data1 && !data2)
3690 SG_SDEBUG(
"leaving TParameter::compare_stype(): both data are NULL\n");
3695 if ((data1 && !data2) || (!data1 && data2))
3697 SG_SINFO(
"leaving TParameter::compare_stype(): data1 is at %p while "
3698 "data2 is at %p\n", data1, data2);
3718 SG_SINFO(
"leaving TParameter::compare_stype(): Length of "
3719 "sparse vector1 (%d) is different of vector 2 (%d)\n",
3724 SG_SDEBUG(
"Comparing sparse vectors\n");
3727 SG_SDEBUG(
"Comparing sparse entry %d at offset %d\n", i,
3742 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3743 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3746 pointer2, accuracy, tolerant))
3748 SG_SINFO(
"leaving TParameter::compare_stype(): Data of"
3749 " sparse vector element is different\n");
3756 SG_SINFO(
"leaving TParameter::compare_stype(): Feature "
3757 "index of sparse vector element is different. "
3758 "source: %d, target: %d\n",
3771 if (str_ptr1->
slen != str_ptr2->
slen)
3773 SG_SINFO(
"leaving TParameter::compare_stype(): Length of "
3774 "string1 (%d) is different of string2 (%d)\n",
3782 SG_SDEBUG(
"Comparing string element %d at offset %d\n", i,
3784 void* pointer1=str_ptr1->
string+i*size_ptype;
3785 void* pointer2=str_ptr2->
string+i*size_ptype;
3788 pointer2, accuracy, tolerant))
3790 SG_SINFO(
"leaving TParameter::compare_stype(): Data of"
3791 " string element is different\n");
3799 SG_SERROR(
"TParameter::compare_stype(): Undefined struct type\n");
3804 SG_SDEBUG(
"leaving TParameter::compare_stype(): Data were equal\n");
3809 void* source,
void* target)
3811 SG_SDEBUG(
"entering TParameter::copy_stype()\n");
3839 if (source_ptr->
slen != target_ptr->
slen)
3841 SG_SDEBUG(
"string lengths different (source: %d vs target: %d),"
3842 " freeing memory.\n", source_ptr->
slen, target_ptr->
slen);
3845 SG_FREE(target_ptr->
string);
3853 size_t num_bytes=source_ptr->
slen * size_ptype;
3855 SG_SDEBUG(
"target string data NULL, allocating %d bytes.\n",
3857 target_ptr->
string=SG_MALLOC(
char, num_bytes);
3864 SG_SDEBUG(
"Copying string element %d at offset %d\n", i,
3866 void* pointer1=source_ptr->
string+i*size_ptype;
3867 void* pointer2=target_ptr->
string+i*size_ptype;
3871 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of string"
3872 " element failed.\n");
3886 SG_SDEBUG(
"sparse vector lengths different (source: %d vs target: %d),"
3887 " freeing memory.\n",
3902 SG_SDEBUG(
"target sparse data NULL, allocating %d bytes.\n",
3911 SG_SDEBUG(
"Copying sparse entry %d at offset %d\n", i,
3926 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3927 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3931 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of sparse"
3932 " vector element failed\n");
3944 SG_SERROR(
"TParameter::copy_stype(): Undefined struct type\n");
3950 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy successful\n");
3956 SG_SDEBUG(
"entering TParameter::copy()\n");
3960 SG_SDEBUG(
"leaving TParameter::copy(): other parameter is NULL\n");
3966 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of source is NULL\n");
3972 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of target is NULL\n");
3978 SG_SDEBUG(
"leaving TParameter::copy(): name \"%s\" is different from"
3979 " target parameter's "
3984 SG_SDEBUG(
"Comparing datatypes without length\n");
3987 SG_SDEBUG(
"leaving TParameter::copy(): type of \"%s\" is different "
3988 "from target parameter's \"%s\" type\n",
m_name, target->
m_name);
4001 SG_SDEBUG(
"leaving TParameter::copy(): scalar data copy error\n");
4006 case CT_VECTOR:
case CT_SGVECTOR:
4008 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
4013 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
4025 SG_SDEBUG(
"allocating %d bytes memory for target vector\n", num_bytes);
4027 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
4031 memset(*(
void**)target->
m_parameter, 0, num_bytes);
4046 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
4050 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
4055 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
4065 case CT_MATRIX:
case CT_SGMATRIX:
4067 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
4072 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
4081 SG_SDEBUG(
"allocating memory for target vector\n");
4090 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
4095 memset(*(
void**)target->
m_parameter, 0, num_bytes);
4101 SG_SDEBUG(
"%d bytes are allocated\n", num_bytes);
4118 for (
index_t i=0; i<length; ++i)
4120 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
4124 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
4129 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
4146 SG_SERROR(
"TParameter::copy(): Not yet implemented for "
4150 case CT_UNDEFINED:
default:
4151 SG_SERROR(
"Implementation error: undefined container type\n");
4155 SG_SDEBUG(
"leaving TParameter::copy(): Copy successful\n");
template class SGSparseMatrix
std::complex< float64_t > complex128_t
virtual int32_t get_num_parameters()
virtual CSGObject * clone()
static size_t offset_sparseentry(EPrimitiveType ptype)
bool operator==(const TParameter &other) const
TParameter * get_parameter(int32_t idx)
SGSparseVector< T > * sparse_matrix
array of sparse vectors of size num_vectors
size_t sizeof_ptype() const
int64_t get_num_elements()
static bool compare_stype(EStructType stype, EPrimitiveType ptype, void *data1, void *data2, float64_t accuracy=0.0, bool tolerant=false)
virtual void print(const char *prefix="")
#define SG_SNOTIMPLEMENTED
static void ptype_to_string(char *dest, EPrimitiveType ptype, size_t n)
index_t num_vectors
total number of vectors
Datatypes that shogun supports.
bool operator<(const TParameter &other) const
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry* vector is orde...
bool equals_without_length(TSGDataType other)
bool equals(TParameter *other, float64_t accuracy=0.0, bool tolerant=false)
virtual void add_type(const TSGDataType *type, void *param, const char *name, const char *description)
bool save(CSerializableFile *file, const char *prefix="")
TParameter(const TSGDataType *datatype, void *parameter, const char *name, const char *description)
void add(bool *param, const char *name, const char *description="")
DynArray< TParameter * > m_params
static bool compare_ptype(EPrimitiveType ptype, void *data1, void *data2, float64_t accuracy=0.0, bool tolerant=false)
Class SGObject is the base class of all shogun objects.
bool m_was_allocated_from_scratch
static T product(T *vec, int32_t len)
return the product of the vectors elements
virtual bool save(CSerializableFile *file, const char *prefix="")
index_t num_features
total number of features
size_t sizeof_stype() const
CSGObject * new_sgserializable(const char *sgserializable_name, EPrimitiveType generic)
void print(const char *prefix)
static bool copy_ptype(EPrimitiveType ptype, void *source, void *target)
void get_incremental_hash(uint32_t &hash, uint32_t &carry, uint32_t &total_length)
virtual bool equals(CSGObject *other, float64_t accuracy=0.0, bool tolerant=false)
void set_from_parameters(Parameter *params)
void to_string(char *dest, size_t n) const
bool contains_parameter(const char *name)
void add_vector(bool **param, index_t *length, const char *name, const char *description="")
static void IncrementalMurmurHash3(uint32_t *hash, uint32_t *carry, uint8_t *data, int32_t len)
bool load(CSerializableFile *file, const char *prefix="")
template class SGSparseVectorEntry
void add_parameters(Parameter *params)
bool copy(TParameter *target)
bool equals(TSGDataType other)
void copy_data(const TParameter *source)
char string_t[STRING_LEN]
void add_matrix(bool **param, index_t *length_y, index_t *length_x, const char *name, const char *description="")
static size_t sizeof_sparseentry(EPrimitiveType ptype)
void allocate_data_from_scratch(SGVector< index_t > dims, bool new_cont_call=true)
static T abs(T a)
return the absolute value of a number
static bool copy_stype(EStructType stype, EPrimitiveType ptype, void *source, void *target)
bool operator>(const TParameter &other) const
SGSparseVectorEntry< T > * features