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);
1798 TParameter::new_prefix(
const char* s1,
const char* s2)
1800 char* tmp = SG_MALLOC(
char, strlen(s1)+strlen(s2)+2);
1802 sprintf(tmp,
"%s%s/", s1, s2);
1821 char* p = new_prefix(prefix,
m_name);
1828 TParameter::delete_cont()
1836 case CT_MATRIX:
case CT_SGMATRIX:
1838 case CT_SCALAR:
case CT_VECTOR:
case CT_SGVECTOR:
break;
1839 case CT_UNDEFINED:
default:
1840 SG_SERROR(
"Implementation error: undefined container type\n");
1879 for (
index_t i=0; i<old_length; i++)
1885 case PT_UNDEFINED:
default:
1886 SG_SERROR(
"Implementation error: undefined primitive type\n");
1892 for (
index_t i=0; i<old_length; i++) {
1928 SG_SERROR(
"TParameter::delete_cont(): Parameters of strings"
1929 " of complex128_t are not supported");
1932 SG_SERROR(
"TParameter::delete_cont(): Implementation "
1933 "error: Could not delete "
1934 "String<SGSerializable*>");
1936 case PT_UNDEFINED:
default:
1937 SG_SERROR(
"Implementation error: undefined primitive type\n");
1942 for (
index_t i=0; i<old_length; i++) {
1978 SG_SERROR(
"TParameter::delete_cont(): Implementation "
1979 "error: Could not delete "
1980 "Sparse<SGSerializable*>");
1982 case PT_UNDEFINED:
default:
1983 SG_SERROR(
"Implementation error: undefined primitive type\n");
1987 case ST_UNDEFINED:
default:
1988 SG_SERROR(
"Implementation error: undefined structure type\n");
1999 char* s=SG_MALLOC(
char, 200);
2001 SG_SDEBUG(
"entering TParameter::new_cont for \"%s\" of type %s\n",
2007 if (new_length == 0)
return;
2014 = SG_MALLOC(
bool, new_length);
break;
2017 = SG_MALLOC(
char, new_length);
break;
2020 = SG_MALLOC(int8_t, new_length);
break;
2023 = SG_MALLOC(uint8_t, new_length);
break;
2026 = SG_MALLOC(int16_t, new_length);
break;
2029 = SG_MALLOC(uint16_t, new_length);
break;
2032 = SG_MALLOC(int32_t, new_length);
break;
2035 = SG_MALLOC(uint32_t, new_length);
break;
2038 = SG_MALLOC(int64_t, new_length);
break;
2041 = SG_MALLOC(uint64_t, new_length);
break;
2044 = SG_MALLOC(
float32_t, new_length);
break;
2047 = SG_MALLOC(
float64_t, new_length);
break;
2058 case PT_UNDEFINED:
default:
2059 SG_SERROR(
"Implementation error: undefined primitive type\n");
2105 SG_SERROR(
"TParameter::new_cont(): Implementation "
2106 "error: Could not allocate "
2107 "String<complex128>");
2110 SG_SERROR(
"TParameter::new_cont(): Implementation "
2111 "error: Could not allocate "
2112 "String<SGSerializable*>");
2114 case PT_UNDEFINED:
default:
2115 SG_SERROR(
"Implementation error: undefined primitive type\n");
2167 SG_SERROR(
"TParameter::new_cont(): Implementation "
2168 "error: Could not allocate "
2169 "Sparse<SGSerializable*>");
2171 case PT_UNDEFINED:
default:
2172 SG_SERROR(
"Implementation error: undefined primitive type\n");
2176 case ST_UNDEFINED:
default:
2177 SG_SERROR(
"Implementation error: undefined structure type\n");
2181 s=SG_MALLOC(
char, 200);
2183 SG_SDEBUG(
"leaving TParameter::new_cont for \"%s\" of type %s\n",
2189 TParameter::new_sgserial(
CSGObject** param,
2190 EPrimitiveType
generic,
2191 const char* sgserializable_name,
2199 if (*param == NULL) {
2210 "Class `C%s%s' was not listed during compiling Shogun"
2211 " :( ... Can not construct it for `%s%s'!",
2212 sgserializable_name, buf, prefix,
m_name);
2226 const char* sgserial_name =
"";
2230 sgserial_name = (*(
CSGObject**) param)->get_name();
2231 (*(
CSGObject**) param)->is_generic(&
generic);
2234 if (!file->write_sgserializable_begin(
2237 if (*sgserial_name !=
'\0') {
2238 char* p = new_prefix(prefix,
m_name);
2240 ->save_serializable(file, p);
2242 if (!result)
return false;
2244 if (!file->write_sgserializable_end(
2249 param))
return false;
2262 if (!file->read_sgserializable_begin(
2265 if (*sgserial_name !=
'\0') {
2266 if (!new_sgserial((
CSGObject**) param,
generic,
2267 sgserial_name, prefix))
2270 char* p = new_prefix(prefix,
m_name);
2272 ->load_serializable(file, p);
2274 if (!result)
return false;
2276 if (!file->read_sgserializable_end(
2281 param))
return false;
2296 if (!save_ptype(file, param, prefix))
return false;
2299 len_real = str_ptr->
slen;
2300 if (str_ptr->
string == NULL && len_real != 0) {
2301 SG_SWARNING(
"Inconsistency between data structure and "
2302 "len during saving string `%s%s'! Continuing"
2307 if (!file->write_string_begin(
2309 for (
index_t i=0; i<len_real; i++) {
2310 if (!file->write_stringentry_begin(
2312 if (!save_ptype(file, (
char*) str_ptr->
string
2315 if (!file->write_stringentry_end(
2318 if (!file->write_string_end(
2323 if (spr_ptr->
features == NULL && len_real != 0) {
2324 SG_SWARNING(
"Inconsistency between data structure and "
2325 "len during saving sparse `%s%s'! Continuing"
2330 if (!file->write_sparse_begin(
2332 for (
index_t i=0; i<len_real; i++) {
2336 if (!file->write_sparseentry_begin(
2341 prefix))
return false;
2342 if (!file->write_sparseentry_end(
2346 if (!file->write_sparse_end(
2349 case ST_UNDEFINED:
default:
2350 SG_SERROR(
"Implementation error: undefined structure type\n");
2367 if (!load_ptype(file, param, prefix))
return false;
2370 if (!file->read_string_begin(
2373 str_ptr->
string = len_real > 0
2375 for (
index_t i=0; i<len_real; i++) {
2376 if (!file->read_stringentry_begin(
2378 if (!load_ptype(file, (
char*) str_ptr->
string
2381 if (!file->read_stringentry_end(
2384 if (!file->read_string_end(
2387 str_ptr->
slen = len_real;
2390 if (!file->read_sparse_begin(
2395 for (
index_t i=0; i<len_real; i++) {
2399 if (!file->read_sparseentry_begin(
2404 prefix))
return false;
2405 if (!file->read_sparseentry_end(
2415 case ST_UNDEFINED:
default:
2416 SG_SERROR(
"Implementation error: undefined structure type\n");
2424 uint32_t& hash, uint32_t& carry, uint32_t& total_length)
2436 total_length += size;
2438 &hash, &carry, data, size);
2441 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2443 index_t len_real_y = 0, len_real_x = 0;
2451 if (*(
void**)
m_parameter == NULL && len_real_y != 0)
2453 SG_SWARNING(
"Inconsistency between data structure and "
2454 "len_y during hashing `%s'! Continuing with "
2465 case CT_VECTOR:
case CT_SGVECTOR:
2468 case CT_MATRIX:
case CT_SGMATRIX:
2471 if (*(
void**)
m_parameter == NULL && len_real_x != 0)
2473 SG_SWARNING(
"Inconsistency between data structure and "
2474 "len_x during hashing %s'! Continuing "
2480 if (len_real_x *len_real_y == 0)
2481 len_real_x = len_real_y = 0;
2485 case CT_SCALAR:
break;
2486 case CT_UNDEFINED:
default:
2487 SG_SERROR(
"Implementation error: undefined container type\n");
2492 total_length += size;
2497 &hash, &carry, data, size);
2500 case CT_UNDEFINED:
default:
2501 SG_SERROR(
"Implementation error: undefined container type\n");
2515 const int32_t buflen=100;
2516 char* buf=SG_MALLOC(
char, buflen);
2529 if (!save_stype(file,
m_parameter, prefix))
return false;
2531 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2533 index_t len_real_y = 0, len_real_x = 0;
2536 if (*(
void**)
m_parameter == NULL && len_real_y != 0) {
2537 SG_SWARNING(
"Inconsistency between data structure and "
2538 "len_y during saving `%s%s'! Continuing with "
2548 case CT_VECTOR:
case CT_SGVECTOR:
2551 case CT_MATRIX:
case CT_SGMATRIX:
2553 if (*(
void**)
m_parameter == NULL && len_real_x != 0) {
2554 SG_SWARNING(
"Inconsistency between data structure and "
2555 "len_x during saving `%s%s'! Continuing "
2561 if (len_real_x *len_real_y == 0)
2562 len_real_x = len_real_y = 0;
2565 case CT_SCALAR:
break;
2566 case CT_UNDEFINED:
default:
2567 SG_SERROR(
"Implementation error: undefined container type\n");
2572 len_real_y, len_real_x))
2577 for (
index_t x=0; x<len_real_x; x++)
2578 for (
index_t y=0; y<len_real_y; y++) {
2579 if (!file->write_item_begin(
2586 prefix))
return false;
2587 if (!file->write_item_end(
2595 len_real_y, len_real_x))
2600 case CT_UNDEFINED:
default:
2601 SG_SERROR(
"Implementation error: undefined container type\n");
2614 REQUIRE(file != NULL,
"Serializable file object should be != NULL\n");
2616 const int32_t buflen=100;
2617 char* buf=SG_MALLOC(
char, buflen);
2635 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2649 case CT_VECTOR:
case CT_SGVECTOR:
2653 case CT_MATRIX:
case CT_SGMATRIX:
2658 case CT_UNDEFINED:
default:
2659 SG_SERROR(
"Implementation error: undefined container type\n");
2663 for (
index_t x=0; x<dims[0]; x++)
2665 for (
index_t y=0; y<dims[1]; y++)
2667 if (!file->read_item_begin(
2674 prefix))
return false;
2675 if (!file->read_item_end(
2686 case CT_VECTOR:
case CT_SGVECTOR:
2689 case CT_MATRIX:
case CT_SGMATRIX:
2695 case CT_UNDEFINED:
default:
2696 SG_SERROR(
"Implementation error: undefined container type\n");
2706 case CT_UNDEFINED:
default:
2707 SG_SERROR(
"Implementation error: undefined container type\n");
2736 const char* name,
const char* description)
2738 if (name == NULL || *name ==
'\0')
2739 SG_SERROR(
"FATAL: Parameter::add_type(): `name' is empty!\n")
2741 for (
size_t i=0; i<strlen(name); ++i)
2743 if (!std::isalnum(name[i]) && name[i]!=
'_' && name[i]!=
'.')
2745 SG_SERROR(
"Character %d of parameter with name \"%s\" is illegal "
2746 "(only alnum or underscore is allowed)\n",
2752 if (strcmp(
m_params.get_element(i)->m_name, name) == 0)
2753 SG_SERROR(
"FATAL: Parameter::add_type(): "
2754 "Double parameter `%s'!\n", name);
2757 new TParameter(type, param, name, description)
2765 m_params.get_element(i)->print(prefix);
2773 if (!
m_params.get_element(i)->save(file, prefix))
2784 if (!
m_params.get_element(i)->load(file, prefix))
2805 if (!strcmp(own->m_name, current->
m_name))
2807 if (own->m_datatype==current_type)
2815 char* given_type=SG_MALLOC(
char, l);
2816 char* own_type=SG_MALLOC(
char, l);
2818 own->m_datatype.to_string(own_type, l);
2819 SG_SERROR(
"given parameter \"%s\" has a different type (%s)"
2820 " than existing one (%s)\n", current->
m_name,
2821 given_type, own_type);
2822 SG_FREE(given_type);
2832 SG_SERROR(
"parameter with name %s does not exist\n",
2837 if (current_type.
m_ptype==PT_SGOBJECT)
2840 if (own->m_datatype.m_stype==ST_NONE)
2842 if (own->m_datatype.m_ctype==CT_SCALAR)
2847 if ((*to_ref)!=(*to_unref))
2860 for (
index_t j=0; j<own->m_datatype.get_num_elements(); ++j)
2862 if ((*to_ref)[j]!=(*to_unref)[j])
2871 SG_SERROR(
"primitive type PT_SGOBJECT occurred with structure "
2872 "type other than ST_NONE");
2878 if (current_type.
m_ctype==CT_SCALAR)
2881 dest=own->m_parameter;
2887 if (own->m_datatype.m_ptype==PT_SGOBJECT)
2902 switch (own->m_datatype.m_ptype)
2920 memcpy(dest, source, own->m_datatype.get_size());
2938 if (!strcmp(name,
m_params[i]->m_name))
2964 SG_SDEBUG(
"entering TParameter::equals()\n");
2968 SG_SDEBUG(
"leaving TParameter::equals(): other parameter is NULL\n");
2974 SG_SDEBUG(
"leaving TParameter::equals(): name \"%s\" is different from"
2975 " other parameter's name \"%s\"\n",
m_name, other->
m_name);
2982 SG_SDEBUG(
"leaving TParameter::equals(): type of \"%s\" is different "
2983 "from other parameter's \"%s\" type\n",
m_name, other->
m_name);
2990 SG_SDEBUG(
"leaving TParameter::equals(): both parameters are NULL\n");
2996 SG_SDEBUG(
"leaving TParameter::equals(): param1 is at %p while "
3010 accuracy, tolerant))
3012 SG_SDEBUG(
"leaving TParameter::equals(): scalar data differs\n");
3017 case CT_VECTOR:
case CT_SGVECTOR:
3019 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
3026 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3030 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3034 accuracy, tolerant))
3036 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3046 case CT_MATRIX:
case CT_SGMATRIX:
3048 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
3065 for (
index_t i=0; i<length; ++i)
3067 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3071 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3075 accuracy, tolerant))
3077 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3094 SG_SERROR(
"TParameter::equals(): Not yet implemented for "
3098 case CT_UNDEFINED:
default:
3099 SG_SERROR(
"Implementation error: undefined container type\n");
3103 SG_SDEBUG(
"leaving TParameter::equals(): Parameters are equal\n");
3110 SG_SDEBUG(
"entering TParameter::compare_ptype()\n");
3112 if ((data1 && !data2) || (!data1 && data2))
3114 SG_SINFO(
"leaving TParameter::compare_ptype(): data1 is at %p while "
3115 "data2 is at %p\n", data1, data2);
3120 if (!data1 && !data2)
3122 SG_SDEBUG(
"leaving TParameter::compare_ptype(): both data are NULL\n");
3130 bool casted1=*((
bool*)data1);
3131 bool casted2=*((
bool*)data2);
3135 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_BOOL: "
3136 "data1=%d, data2=%d\n", casted1, casted2);
3143 char casted1=*((
char*)data1);
3144 char casted2=*((
char*)data2);
3148 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_CHAR: "
3149 "data1=%c, data2=%c\n", casted1, casted2);
3156 int8_t casted1=*((int8_t*)data1);
3157 int8_t casted2=*((int8_t*)data2);
3161 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT8: "
3162 "data1=%d, data2=%d\n", casted1, casted2);
3169 uint8_t casted1=*((uint8_t*)data1);
3170 uint8_t casted2=*((uint8_t*)data2);
3174 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT8: "
3175 "data1=%d, data2=%d\n", casted1, casted2);
3182 int16_t casted1=*((int16_t*)data1);
3183 int16_t casted2=*((int16_t*)data2);
3187 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT16: "
3188 "data1=%d, data2=%d\n", casted1, casted2);
3195 uint16_t casted1=*((uint16_t*)data1);
3196 uint16_t casted2=*((uint16_t*)data2);
3200 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT16: "
3201 "data1=%d, data2=%d\n", casted1, casted2);
3208 int32_t casted1=*((int32_t*)data1);
3209 int32_t casted2=*((int32_t*)data2);
3213 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT32: "
3214 "data1=%d, data2=%d\n", casted1, casted2);
3221 uint32_t casted1=*((uint32_t*)data1);
3222 uint32_t casted2=*((uint32_t*)data2);
3226 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT32: "
3227 "data1=%d, data2=%d\n", casted1, casted2);
3234 int64_t casted1=*((int64_t*)data1);
3235 int64_t casted2=*((int64_t*)data2);
3239 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT64: "
3240 "data1=%d, data2=%d\n", casted1, casted2);
3247 uint64_t casted1=*((uint64_t*)data1);
3248 uint64_t casted2=*((uint64_t*)data2);
3252 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT64: "
3253 "data1=%d, data2=%d\n", casted1, casted2);
3263 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT32: "
3264 "data1=%f, data2=%f\n", casted1, casted2);
3266 return CMath::fequals<float32_t>(casted1, casted2, accuracy, tolerant);
3274 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT64: "
3275 "data1=%f, data2=%f\n", casted1, casted2);
3277 return CMath::fequals<float64_t>(casted1, casted2, accuracy, tolerant);
3285 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOATMAX: "
3286 "data1=%f, data2=%f\n", casted1, casted2);
3288 return CMath::fequals<floatmax_t>(casted1, casted2, accuracy, tolerant);
3297 if (
CMath::abs(casted1_real-casted2_real)>accuracy ||
3298 CMath::abs(casted1_imag-casted2_imag)>accuracy)
3300 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_COMPLEX128: "
3301 "data1=%f+i%f, data2=%f+i%f\n",
3302 casted1_real, casted1_imag,
3303 casted2_real, casted2_imag);
3314 if (!casted1 && ! casted2)
3316 SG_SDEBUG(
"leaving TParameter::compare_ptype(): SGObjects are equal\n");
3323 if (!(casted1->
equals(casted2, accuracy)))
3325 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3326 "equals returned false\n");
3332 if (!(casted2->
equals(casted1, accuracy)))
3334 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3335 "equals returned false\n");
3343 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3344 "-type: %d\n", ptype);
3348 SG_SDEBUG(
"leaving TParameter::compare_ptype(): Data are equal\n");
3354 SG_SDEBUG(
"entering TParameter::copy_ptype()\n");
3363 *((
bool*)target)=*((
bool*)source);
3364 SG_SDEBUG(
"after copy of ptype PT_BOOL: source %d, target %d\n",
3365 *((
bool*)source), *((
bool*)target));
3370 *((
char*)target)=*((
char*)source);
3371 SG_SDEBUG(
"after copy of ptype PT_CHAR: source %c, target %c\n",
3372 *((
char*)source), *((
char*)target));
3377 *((int8_t*)target)=*((int8_t*)source);
3378 SG_SDEBUG(
"after copy of ptype PT_INT8: source %d, target %d\n",
3379 *((int8_t*)source), *((int8_t*)target));
3384 *((uint8_t*)target)=*((uint8_t*)source);
3385 SG_SDEBUG(
"after copy of ptype PT_UINT8: source %d, target %d\n",
3386 *((uint8_t*)source), *((uint8_t*)target));
3391 *((int16_t*)target)=*((int16_t*)source);
3392 SG_SDEBUG(
"after copy of ptype PT_INT16: source %d, target %d\n",
3393 *((int16_t*)source), *((int16_t*)target));
3398 *((uint16_t*)target)=*((uint16_t*)source);
3399 SG_SDEBUG(
"after copy of ptype PT_UINT16: source %d, target %d\n",
3400 *((uint16_t*)source), *((uint16_t*)target));
3405 *((int32_t*)target)=*((int32_t*)source);
3406 SG_SDEBUG(
"after copy of ptype PT_INT32: source %d, target %d\n",
3407 *((int32_t*)source), *((int32_t*)target));
3412 *((uint32_t*)target)=*((uint32_t*)source);
3413 SG_SDEBUG(
"after copy of ptype PT_UINT32: source %d, target %d\n",
3414 *((uint32_t*)source), *((uint32_t*)target));
3419 *((int64_t*)target)=*((int64_t*)source);
3420 SG_SDEBUG(
"after copy of ptype PT_INT64: source %d, target %d\n",
3421 *((int64_t*)source), *((int64_t*)target));
3426 *((uint64_t*)target)=*((uint64_t*)source);
3427 SG_SDEBUG(
"after copy of ptype PT_UINT64: source %d, target %d\n",
3428 *((uint64_t*)source), *((uint64_t*)target));
3434 SG_SDEBUG(
"after copy of ptype PT_FLOAT32: source %f, target %f\n",
3441 SG_SDEBUG(
"after copy of ptype PT_FLOAT64: source %f, target %f\n",
3448 SG_SDEBUG(
"after copy of ptype PT_FLOATMAX: source %Lf, target %Lf\n",
3455 SG_SDEBUG(
"after copy of ptype PT_COMPLEX128: "
3456 "source real %f, target real %f,"
3457 "source imag %f, target imag %f,"
3469 if (!casted1 && ! casted2)
3471 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Both SGObjects are NULL\n");
3486 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3487 "-type: %d\n", ptype);
3492 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Copy successful\n");
3497 void* data1,
void* data2,
float64_t accuracy,
bool tolerant)
3499 SG_SDEBUG(
"entering TParameter::compare_stype()\n");
3504 if (!data1 && !data2)
3506 SG_SDEBUG(
"leaving TParameter::compare_stype(): both data are NULL\n");
3511 if ((data1 && !data2) || (!data1 && data2))
3513 SG_SINFO(
"leaving TParameter::compare_stype(): data1 is at %p while "
3514 "data2 is at %p\n", data1, data2);
3534 SG_SINFO(
"leaving TParameter::compare_stype(): Length of "
3535 "sparse vector1 (%d) is different of vector 2 (%d)\n",
3540 SG_SDEBUG(
"Comparing sparse vectors\n");
3543 SG_SDEBUG(
"Comparing sparse entry %d at offset %d\n", i,
3558 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3559 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3562 pointer2, accuracy, tolerant))
3564 SG_SINFO(
"leaving TParameter::compare_stype(): Data of"
3565 " sparse vector element is different\n");
3572 SG_SINFO(
"leaving TParameter::compare_stype(): Feature "
3573 "index of sparse vector element is different. "
3574 "source: %d, target: %d\n",
3587 if (str_ptr1->
slen != str_ptr2->
slen)
3589 SG_SINFO(
"leaving TParameter::compare_stype(): Length of "
3590 "string1 (%d) is different of string2 (%d)\n",
3598 SG_SDEBUG(
"Comparing string element %d at offset %d\n", i,
3600 void* pointer1=str_ptr1->
string+i*size_ptype;
3601 void* pointer2=str_ptr2->
string+i*size_ptype;
3604 pointer2, accuracy, tolerant))
3606 SG_SINFO(
"leaving TParameter::compare_stype(): Data of"
3607 " string element is different\n");
3615 SG_SERROR(
"TParameter::compare_stype(): Undefined struct type\n");
3620 SG_SDEBUG(
"leaving TParameter::compare_stype(): Data were equal\n");
3625 void* source,
void* target)
3627 SG_SDEBUG(
"entering TParameter::copy_stype()\n");
3655 if (source_ptr->
slen != target_ptr->
slen)
3657 SG_SDEBUG(
"string lengths different (source: %d vs target: %d),"
3658 " freeing memory.\n", source_ptr->
slen, target_ptr->
slen);
3661 SG_FREE(target_ptr->
string);
3669 size_t num_bytes=source_ptr->
slen * size_ptype;
3671 SG_SDEBUG(
"target string data NULL, allocating %d bytes.\n",
3673 target_ptr->
string=SG_MALLOC(
char, num_bytes);
3680 SG_SDEBUG(
"Copying string element %d at offset %d\n", i,
3682 void* pointer1=source_ptr->
string+i*size_ptype;
3683 void* pointer2=target_ptr->
string+i*size_ptype;
3687 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of string"
3688 " element failed.\n");
3702 SG_SDEBUG(
"sparse vector lengths different (source: %d vs target: %d),"
3703 " freeing memory.\n",
3718 SG_SDEBUG(
"target sparse data NULL, allocating %d bytes.\n",
3727 SG_SDEBUG(
"Copying 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;
3747 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of sparse"
3748 " vector element failed\n");
3760 SG_SERROR(
"TParameter::copy_stype(): Undefined struct type\n");
3766 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy successful\n");
3772 SG_SDEBUG(
"entering TParameter::copy()\n");
3776 SG_SDEBUG(
"leaving TParameter::copy(): other parameter is NULL\n");
3782 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of source is NULL\n");
3788 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of target is NULL\n");
3794 SG_SDEBUG(
"leaving TParameter::copy(): name \"%s\" is different from"
3795 " target parameter's "
3800 SG_SDEBUG(
"Comparing datatypes without length\n");
3803 SG_SDEBUG(
"leaving TParameter::copy(): type of \"%s\" is different "
3804 "from target parameter's \"%s\" type\n",
m_name, target->
m_name);
3817 SG_SDEBUG(
"leaving TParameter::copy(): scalar data copy error\n");
3822 case CT_VECTOR:
case CT_SGVECTOR:
3824 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
3829 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
3841 SG_SDEBUG(
"allocating %d bytes memory for target vector\n", num_bytes);
3843 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
3847 memset(*(
void**)target->
m_parameter, 0, num_bytes);
3862 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
3866 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
3871 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
3881 case CT_MATRIX:
case CT_SGMATRIX:
3883 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
3888 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
3897 SG_SDEBUG(
"allocating memory for target vector\n");
3906 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
3911 memset(*(
void**)target->
m_parameter, 0, num_bytes);
3917 SG_SDEBUG(
"%d bytes are allocated\n", num_bytes);
3934 for (
index_t i=0; i<length; ++i)
3936 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
3940 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
3945 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
3962 SG_SERROR(
"TParameter::copy(): Not yet implemented for "
3966 case CT_UNDEFINED:
default:
3967 SG_SERROR(
"Implementation error: undefined container type\n");
3971 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)
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)
Datatypes that shogun supports.
virtual bool load(CSerializableFile *file, const char *prefix="")
bool operator<(const TParameter &other) const
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="")
static T product(T *vec, int32_t len)
Return the product of the vectors elements.
DynArray< TParameter * > m_params
static bool compare_ptype(EPrimitiveType ptype, void *data1, void *data2, float64_t accuracy=0.0, bool tolerant=false)
index_t num_features
total number of features
Class SGObject is the base class of all shogun objects.
virtual bool save(CSerializableFile *file, const char *prefix="")
size_t sizeof_stype() const
SGSparseVector< T > * sparse_matrix
array of sparse vectors of size num_vectors
CSGObject * new_sgserializable(const char *sgserializable_name, EPrimitiveType generic)
void print(const char *prefix)
SGSparseVectorEntry< T > * features
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)
all of classes and functions are contained in the shogun namespace
bool load(CSerializableFile *file, const char *prefix="")
template class SGSparseVectorEntry
void add_parameters(Parameter *params)
bool copy(TParameter *target)
bool equals(TSGDataType other)
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry* vector is orde...
char string_t[STRING_LEN]
index_t num_vectors
total number of vectors
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)
static bool copy_stype(EStructType stype, EPrimitiveType ptype, void *source, void *target)
bool operator>(const TParameter &other) const