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 REQUIRE(file != NULL,
"Serializable file object should be != NULL\n");
2653 const int32_t buflen=100;
2654 char* buf=SG_MALLOC(
char, buflen);
2672 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2686 case CT_VECTOR:
case CT_SGVECTOR:
2690 case CT_MATRIX:
case CT_SGMATRIX:
2695 case CT_UNDEFINED:
default:
2696 SG_SERROR(
"Implementation error: undefined container type\n");
2700 for (
index_t x=0; x<dims[0]; x++)
2702 for (
index_t y=0; y<dims[1]; y++)
2704 if (!file->read_item_begin(
2711 prefix))
return false;
2712 if (!file->read_item_end(
2723 case CT_VECTOR:
case CT_SGVECTOR:
2726 case CT_MATRIX:
case CT_SGMATRIX:
2732 case CT_UNDEFINED:
default:
2733 SG_SERROR(
"Implementation error: undefined container type\n");
2743 case CT_UNDEFINED:
default:
2744 SG_SERROR(
"Implementation error: undefined container type\n");
2773 const char* name,
const char* description)
2775 if (name == NULL || *name ==
'\0')
2776 SG_SERROR(
"FATAL: Parameter::add_type(): `name' is empty!\n")
2778 for (
size_t i=0; i<strlen(name); ++i)
2780 if (!std::isalnum(name[i]) && name[i]!=
'_' && name[i]!=
'.')
2782 SG_SERROR(
"Character %d of parameter with name \"%s\" is illegal "
2783 "(only alnum or underscore is allowed)\n",
2789 if (strcmp(
m_params.get_element(i)->m_name, name) == 0)
2790 SG_SERROR(
"FATAL: Parameter::add_type(): "
2791 "Double parameter `%s'!\n", name);
2794 new TParameter(type, param, name, description)
2802 m_params.get_element(i)->print(prefix);
2810 if (!
m_params.get_element(i)->save(file, prefix))
2842 if (!strcmp(own->m_name, current->
m_name))
2844 if (own->m_datatype==current_type)
2852 char* given_type=SG_MALLOC(
char, l);
2853 char* own_type=SG_MALLOC(
char, l);
2855 own->m_datatype.to_string(own_type, l);
2856 SG_SERROR(
"given parameter \"%s\" has a different type (%s)"
2857 " than existing one (%s)\n", current->
m_name,
2858 given_type, own_type);
2859 SG_FREE(given_type);
2869 SG_SERROR(
"parameter with name %s does not exist\n",
2874 if (current_type.
m_ptype==PT_SGOBJECT)
2877 if (own->m_datatype.m_stype==ST_NONE)
2879 if (own->m_datatype.m_ctype==CT_SCALAR)
2884 if ((*to_ref)!=(*to_unref))
2897 for (
index_t j=0; j<own->m_datatype.get_num_elements(); ++j)
2899 if ((*to_ref)[j]!=(*to_unref)[j])
2908 SG_SERROR(
"primitive type PT_SGOBJECT occurred with structure "
2909 "type other than ST_NONE");
2915 if (current_type.
m_ctype==CT_SCALAR)
2918 dest=own->m_parameter;
2924 if (own->m_datatype.m_ptype==PT_SGOBJECT)
2939 switch (own->m_datatype.m_ptype)
2957 memcpy(dest, source, own->m_datatype.get_size());
2975 if (!strcmp(name,
m_params[i]->m_name))
3002 SG_SDEBUG(
"entering TParameter::allocate_data_from_scratch of "
3011 case CT_VECTOR:
case CT_SGVECTOR:
3015 case CT_MATRIX:
case CT_SGMATRIX:
3028 case CT_UNDEFINED:
default:
3029 SG_SERROR(
"Implementation error: undefined container type\n");
3035 SG_SERROR(
"TParameter::allocate_data_from_scratch must not be called "
3036 "when the underlying TParameter instance already has data.\n");
3061 void** data_p=SG_MALLOC(
void*, 1);
3070 *data_p=SG_MALLOC(
void**, 1);
3071 **(
void***)data_p=NULL;
3084 SG_SDEBUG(
"leaving TParameter::allocate_data_from_scratch of "
3105 SG_SDEBUG(
"Copying scalar data of size %d from %p to %p\n",
3125 for (
index_t j=0; j<length; ++j)
3150 SG_SDEBUG(
"entering TParameter::equals()\n");
3154 SG_SDEBUG(
"leaving TParameter::equals(): other parameter is NULL\n");
3160 SG_SDEBUG(
"leaving TParameter::equals(): name \"%s\" is different from"
3161 " other parameter's name \"%s\"\n",
m_name, other->
m_name);
3168 SG_SDEBUG(
"leaving TParameter::equals(): type of \"%s\" is different "
3169 "from other parameter's \"%s\" type\n",
m_name, other->
m_name);
3176 SG_SDEBUG(
"leaving TParameter::equals(): both parameters are NULL\n");
3182 SG_SDEBUG(
"leaving TParameter::equals(): param1 is at %p while "
3196 accuracy, tolerant))
3198 SG_SDEBUG(
"leaving TParameter::equals(): scalar data differs\n");
3203 case CT_VECTOR:
case CT_SGVECTOR:
3205 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
3212 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3216 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3220 accuracy, tolerant))
3222 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3232 case CT_MATRIX:
case CT_SGMATRIX:
3234 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
3251 for (
index_t i=0; i<length; ++i)
3253 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3257 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3261 accuracy, tolerant))
3263 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3280 SG_SERROR(
"TParameter::equals(): Not yet implemented for "
3284 case CT_UNDEFINED:
default:
3285 SG_SERROR(
"Implementation error: undefined container type\n");
3289 SG_SDEBUG(
"leaving TParameter::equals(): Parameters are equal\n");
3296 SG_SDEBUG(
"entering TParameter::compare_ptype()\n");
3298 if ((data1 && !data2) || (!data1 && data2))
3300 SG_SINFO(
"leaving TParameter::compare_ptype(): data1 is at %p while "
3301 "data2 is at %p\n", data1, data2);
3306 if (!data1 && !data2)
3308 SG_SDEBUG(
"leaving TParameter::compare_ptype(): both data are NULL\n");
3316 bool casted1=*((
bool*)data1);
3317 bool casted2=*((
bool*)data2);
3321 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_BOOL: "
3322 "data1=%d, data2=%d\n", casted1, casted2);
3329 char casted1=*((
char*)data1);
3330 char casted2=*((
char*)data2);
3334 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_CHAR: "
3335 "data1=%c, data2=%c\n", casted1, casted2);
3342 int8_t casted1=*((int8_t*)data1);
3343 int8_t casted2=*((int8_t*)data2);
3347 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT8: "
3348 "data1=%d, data2=%d\n", casted1, casted2);
3355 uint8_t casted1=*((uint8_t*)data1);
3356 uint8_t casted2=*((uint8_t*)data2);
3360 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT8: "
3361 "data1=%d, data2=%d\n", casted1, casted2);
3368 int16_t casted1=*((int16_t*)data1);
3369 int16_t casted2=*((int16_t*)data2);
3373 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT16: "
3374 "data1=%d, data2=%d\n", casted1, casted2);
3381 uint16_t casted1=*((uint16_t*)data1);
3382 uint16_t casted2=*((uint16_t*)data2);
3386 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT16: "
3387 "data1=%d, data2=%d\n", casted1, casted2);
3394 int32_t casted1=*((int32_t*)data1);
3395 int32_t casted2=*((int32_t*)data2);
3399 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT32: "
3400 "data1=%d, data2=%d\n", casted1, casted2);
3407 uint32_t casted1=*((uint32_t*)data1);
3408 uint32_t casted2=*((uint32_t*)data2);
3412 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT32: "
3413 "data1=%d, data2=%d\n", casted1, casted2);
3420 int64_t casted1=*((int64_t*)data1);
3421 int64_t casted2=*((int64_t*)data2);
3425 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT64: "
3426 "data1=%d, data2=%d\n", casted1, casted2);
3433 uint64_t casted1=*((uint64_t*)data1);
3434 uint64_t casted2=*((uint64_t*)data2);
3438 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT64: "
3439 "data1=%d, data2=%d\n", casted1, casted2);
3449 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT32: "
3450 "data1=%f, data2=%f\n", casted1, casted2);
3452 return CMath::fequals<float32_t>(casted1, casted2, accuracy, tolerant);
3460 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT64: "
3461 "data1=%f, data2=%f\n", casted1, casted2);
3463 return CMath::fequals<float64_t>(casted1, casted2, accuracy, tolerant);
3471 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOATMAX: "
3472 "data1=%f, data2=%f\n", casted1, casted2);
3474 return CMath::fequals<floatmax_t>(casted1, casted2, accuracy, tolerant);
3483 if (
CMath::abs(casted1_real-casted2_real)>accuracy ||
3484 CMath::abs(casted1_imag-casted2_imag)>accuracy)
3486 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_COMPLEX128: "
3487 "data1=%f+i%f, data2=%f+i%f\n",
3488 casted1_real, casted1_imag,
3489 casted2_real, casted2_imag);
3500 if (!casted1 && ! casted2)
3502 SG_SDEBUG(
"leaving TParameter::compare_ptype(): SGObjects are equal\n");
3509 if (!(casted1->
equals(casted2, accuracy)))
3511 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3512 "equals returned false\n");
3518 if (!(casted2->
equals(casted1, accuracy)))
3520 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3521 "equals returned false\n");
3529 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3530 "-type: %d\n", ptype);
3534 SG_SDEBUG(
"leaving TParameter::compare_ptype(): Data are equal\n");
3540 SG_SDEBUG(
"entering TParameter::copy_ptype()\n");
3549 *((
bool*)target)=*((
bool*)source);
3550 SG_SDEBUG(
"after copy of ptype PT_BOOL: source %d, target %d\n",
3551 *((
bool*)source), *((
bool*)target));
3556 *((
char*)target)=*((
char*)source);
3557 SG_SDEBUG(
"after copy of ptype PT_CHAR: source %c, target %c\n",
3558 *((
char*)source), *((
char*)target));
3563 *((int8_t*)target)=*((int8_t*)source);
3564 SG_SDEBUG(
"after copy of ptype PT_INT8: source %d, target %d\n",
3565 *((int8_t*)source), *((int8_t*)target));
3570 *((uint8_t*)target)=*((uint8_t*)source);
3571 SG_SDEBUG(
"after copy of ptype PT_UINT8: source %d, target %d\n",
3572 *((uint8_t*)source), *((uint8_t*)target));
3577 *((int16_t*)target)=*((int16_t*)source);
3578 SG_SDEBUG(
"after copy of ptype PT_INT16: source %d, target %d\n",
3579 *((int16_t*)source), *((int16_t*)target));
3584 *((uint16_t*)target)=*((uint16_t*)source);
3585 SG_SDEBUG(
"after copy of ptype PT_UINT16: source %d, target %d\n",
3586 *((uint16_t*)source), *((uint16_t*)target));
3591 *((int32_t*)target)=*((int32_t*)source);
3592 SG_SDEBUG(
"after copy of ptype PT_INT32: source %d, target %d\n",
3593 *((int32_t*)source), *((int32_t*)target));
3598 *((uint32_t*)target)=*((uint32_t*)source);
3599 SG_SDEBUG(
"after copy of ptype PT_UINT32: source %d, target %d\n",
3600 *((uint32_t*)source), *((uint32_t*)target));
3605 *((int64_t*)target)=*((int64_t*)source);
3606 SG_SDEBUG(
"after copy of ptype PT_INT64: source %d, target %d\n",
3607 *((int64_t*)source), *((int64_t*)target));
3612 *((uint64_t*)target)=*((uint64_t*)source);
3613 SG_SDEBUG(
"after copy of ptype PT_UINT64: source %d, target %d\n",
3614 *((uint64_t*)source), *((uint64_t*)target));
3620 SG_SDEBUG(
"after copy of ptype PT_FLOAT32: source %f, target %f\n",
3627 SG_SDEBUG(
"after copy of ptype PT_FLOAT64: source %f, target %f\n",
3634 SG_SDEBUG(
"after copy of ptype PT_FLOATMAX: source %Lf, target %Lf\n",
3641 SG_SDEBUG(
"after copy of ptype PT_COMPLEX128: "
3642 "source real %f, target real %f,"
3643 "source imag %f, target imag %f,"
3655 if (!casted1 && ! casted2)
3657 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Both SGObjects are NULL\n");
3672 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3673 "-type: %d\n", ptype);
3678 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Copy successful\n");
3683 void* data1,
void* data2,
float64_t accuracy,
bool tolerant)
3685 SG_SDEBUG(
"entering TParameter::compare_stype()\n");
3690 if (!data1 && !data2)
3692 SG_SDEBUG(
"leaving TParameter::compare_stype(): both data are NULL\n");
3697 if ((data1 && !data2) || (!data1 && data2))
3699 SG_SINFO(
"leaving TParameter::compare_stype(): data1 is at %p while "
3700 "data2 is at %p\n", data1, data2);
3720 SG_SINFO(
"leaving TParameter::compare_stype(): Length of "
3721 "sparse vector1 (%d) is different of vector 2 (%d)\n",
3726 SG_SDEBUG(
"Comparing sparse vectors\n");
3729 SG_SDEBUG(
"Comparing sparse entry %d at offset %d\n", i,
3744 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3745 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3748 pointer2, accuracy, tolerant))
3750 SG_SINFO(
"leaving TParameter::compare_stype(): Data of"
3751 " sparse vector element is different\n");
3758 SG_SINFO(
"leaving TParameter::compare_stype(): Feature "
3759 "index of sparse vector element is different. "
3760 "source: %d, target: %d\n",
3773 if (str_ptr1->
slen != str_ptr2->
slen)
3775 SG_SINFO(
"leaving TParameter::compare_stype(): Length of "
3776 "string1 (%d) is different of string2 (%d)\n",
3784 SG_SDEBUG(
"Comparing string element %d at offset %d\n", i,
3786 void* pointer1=str_ptr1->
string+i*size_ptype;
3787 void* pointer2=str_ptr2->
string+i*size_ptype;
3790 pointer2, accuracy, tolerant))
3792 SG_SINFO(
"leaving TParameter::compare_stype(): Data of"
3793 " string element is different\n");
3801 SG_SERROR(
"TParameter::compare_stype(): Undefined struct type\n");
3806 SG_SDEBUG(
"leaving TParameter::compare_stype(): Data were equal\n");
3811 void* source,
void* target)
3813 SG_SDEBUG(
"entering TParameter::copy_stype()\n");
3841 if (source_ptr->
slen != target_ptr->
slen)
3843 SG_SDEBUG(
"string lengths different (source: %d vs target: %d),"
3844 " freeing memory.\n", source_ptr->
slen, target_ptr->
slen);
3847 SG_FREE(target_ptr->
string);
3855 size_t num_bytes=source_ptr->
slen * size_ptype;
3857 SG_SDEBUG(
"target string data NULL, allocating %d bytes.\n",
3859 target_ptr->
string=SG_MALLOC(
char, num_bytes);
3866 SG_SDEBUG(
"Copying string element %d at offset %d\n", i,
3868 void* pointer1=source_ptr->
string+i*size_ptype;
3869 void* pointer2=target_ptr->
string+i*size_ptype;
3873 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of string"
3874 " element failed.\n");
3888 SG_SDEBUG(
"sparse vector lengths different (source: %d vs target: %d),"
3889 " freeing memory.\n",
3904 SG_SDEBUG(
"target sparse data NULL, allocating %d bytes.\n",
3913 SG_SDEBUG(
"Copying sparse entry %d at offset %d\n", i,
3928 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3929 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3933 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of sparse"
3934 " vector element failed\n");
3946 SG_SERROR(
"TParameter::copy_stype(): Undefined struct type\n");
3952 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy successful\n");
3958 SG_SDEBUG(
"entering TParameter::copy()\n");
3962 SG_SDEBUG(
"leaving TParameter::copy(): other parameter is NULL\n");
3968 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of source is NULL\n");
3974 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of target is NULL\n");
3980 SG_SDEBUG(
"leaving TParameter::copy(): name \"%s\" is different from"
3981 " target parameter's "
3986 SG_SDEBUG(
"Comparing datatypes without length\n");
3989 SG_SDEBUG(
"leaving TParameter::copy(): type of \"%s\" is different "
3990 "from target parameter's \"%s\" type\n",
m_name, target->
m_name);
4003 SG_SDEBUG(
"leaving TParameter::copy(): scalar data copy error\n");
4008 case CT_VECTOR:
case CT_SGVECTOR:
4010 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
4015 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
4027 SG_SDEBUG(
"allocating %d bytes memory for target vector\n", num_bytes);
4029 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
4033 memset(*(
void**)target->
m_parameter, 0, num_bytes);
4048 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
4052 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
4057 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
4067 case CT_MATRIX:
case CT_SGMATRIX:
4069 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
4074 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
4083 SG_SDEBUG(
"allocating memory for target vector\n");
4092 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
4097 memset(*(
void**)target->
m_parameter, 0, num_bytes);
4103 SG_SDEBUG(
"%d bytes are allocated\n", num_bytes);
4120 for (
index_t i=0; i<length; ++i)
4122 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
4126 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
4131 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
4148 SG_SERROR(
"TParameter::copy(): Not yet implemented for "
4152 case CT_UNDEFINED:
default:
4153 SG_SERROR(
"Implementation error: undefined container type\n");
4157 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)
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)
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 bool copy_stype(EStructType stype, EPrimitiveType ptype, void *source, void *target)
bool operator>(const TParameter &other) const
SGSparseVectorEntry< T > * features